summary refs log tree commit diff
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-03-08 06:51:49 +0100
committerJens Axboe <axboe@kernel.dk>2022-03-08 19:40:00 -0700
commite7f76552277ca79d9dfe4c59f7b3620a98467f9c (patch)
tree251b58be6faf96d6f9e383678f1f344b89d2d9bc /drivers/scsi/sd.c
parente02657ea7b86d1c41e095f49e4f7c7bb24bbee64 (diff)
downloadlinux-e7f76552277ca79d9dfe4c59f7b3620a98467f9c.tar.gz
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/sd.c')
-rw-r--r--drivers/scsi/sd.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 2d648d27bfd7..2a1e19e871d3 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3515,7 +3515,6 @@ static int sd_probe(struct device *dev)
 	}
 
 	sdkp->device = sdp;
-	sdkp->driver = &sd_template;
 	sdkp->disk = gd;
 	sdkp->index = index;
 	sdkp->max_retries = SD_MAX_RETRIES;
@@ -3548,7 +3547,7 @@ static int sd_probe(struct device *dev)
 	gd->minors = SD_MINORS;
 
 	gd->fops = &sd_fops;
-	gd->private_data = &sdkp->driver;
+	gd->private_data = sdkp;
 
 	/* defaults, until the device tells us otherwise */
 	sdp->sector_size = 512;