diff options
author | Christoph Hellwig <hch@lst.de> | 2022-03-08 06:51:49 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-03-09 03:40:00 +0100 |
commit | e7f76552277ca79d9dfe4c59f7b3620a98467f9c (patch) | |
tree | 251b58be6faf96d6f9e383678f1f344b89d2d9bc /drivers/scsi/sr.c | |
parent | blk-mq: handle already freed tags gracefully in blk_mq_free_rqs (diff) | |
download | linux-e7f76552277ca79d9dfe4c59f7b3620a98467f9c.tar.xz linux-e7f76552277ca79d9dfe4c59f7b3620a98467f9c.zip |
scsi: don't use disk->private_data to find the scsi_driver
Requiring every ULP to have the scsi_drive as first member of the
private data is rather fragile and not necessary anyway. Just use
the driver hanging off the SCSI device instead.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20220308055200.735835-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/scsi/sr.c')
-rw-r--r-- | drivers/scsi/sr.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index f925b1f1f9ad..569bda76a517 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -147,7 +147,7 @@ static void sr_kref_release(struct kref *kref); static inline struct scsi_cd *scsi_cd(struct gendisk *disk) { - return container_of(disk->private_data, struct scsi_cd, driver); + return disk->private_data; } static int sr_runtime_suspend(struct device *dev) @@ -692,7 +692,6 @@ static int sr_probe(struct device *dev) cd->device = sdev; cd->disk = disk; - cd->driver = &sr_template; cd->capacity = 0x1fffff; cd->device->changed = 1; /* force recheck CD type */ cd->media_present = 1; @@ -713,7 +712,7 @@ static int sr_probe(struct device *dev) sr_vendor_init(cd); set_capacity(disk, cd->capacity); - disk->private_data = &cd->driver; + disk->private_data = cd; if (register_cdrom(disk, &cd->cdi)) goto fail_minor; |