virtio-blk: Use kobj_to_dev() instead of container_of()
authorTian Tao <tiantao6@hisilicon.com>
Fri, 21 Aug 2020 01:19:15 +0000 (09:19 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 1 Sep 2020 22:49:26 +0000 (16:49 -0600)
Use kobj_to_dev() instead of container_of()

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/virtio_blk.c

index b2e48dac1ebdb88308d59a27cefdf2df853c3dfd..ca63a41059d68e9c42cc74ccfd5e3392555ece55 100644 (file)
@@ -646,7 +646,7 @@ static struct attribute *virtblk_attrs[] = {
 static umode_t virtblk_attrs_are_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 gendisk *disk = dev_to_disk(dev);
        struct virtio_blk *vblk = disk->private_data;
        struct virtio_device *vdev = vblk->vdev;