mmc: core: use kobj_to_dev()
authorMinghao Chi <chi.minghao@zte.com.cn>
Mon, 25 Apr 2022 10:53:39 +0000 (10:53 +0000)
committerUlf Hansson <ulf.hansson@linaro.org>
Wed, 4 May 2022 09:53:44 +0000 (11:53 +0200)
Use kobj_to_dev() instead of open-coding it.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Link: https://lore.kernel.org/r/20220425105339.3515368-1-chi.minghao@zte.com.cn
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/block.c

index 6cb701aa1abc96c7a6e56d7b0b1a9e6a781d8103..9def975df52b31b9a777f3b110ac1ec9b512566d 100644 (file)
@@ -330,7 +330,7 @@ static struct attribute *mmc_disk_attrs[] = {
 static umode_t mmc_disk_attrs_is_visible(struct kobject *kobj,
                struct attribute *a, int n)
 {
-       struct device *dev = container_of(kobj, struct device, kobj);
+       struct device *dev = kobj_to_dev(kobj);
        struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev));
        umode_t mode = a->mode;