[PATCH] driver/base/soc: Use kobj_to_dev() API

From: zhouchuangao
Date: Sun Apr 26 2020 - 01:14:21 EST


Use kobj_to_dev() API instead of container_of().

Signed-off-by: zhouchuangao <zhouchuangao@xxxxxxxxxx>
---
drivers/base/soc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/soc.c b/drivers/base/soc.c
index 4af11a4..a5bae55 100644
--- a/drivers/base/soc.c
+++ b/drivers/base/soc.c
@@ -46,7 +46,7 @@ static umode_t soc_attribute_mode(struct kobject *kobj,
struct attribute *attr,
int index)
{
- struct device *dev = container_of(kobj, struct device, kobj);
+ struct device *dev = kobj_to_dev(kobj);
struct soc_device *soc_dev = container_of(dev, struct soc_device, dev);

if ((attr == &dev_attr_machine.attr)
--
2.7.4