aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2009-06-18 03:57:18 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-06-21 13:01:27 -0400
commitb391277a56b9eaaff4474339c703e574ed7fab5b (patch)
tree81964fbb0a7582e110a0dc06b4ddfce8508c1bd3 /drivers/scsi
parent24add1c4326ce5ca22e7af8b84bb113cd48efac9 (diff)
sd, sr: fix Driver 'sd' needs updating message
If a SCSI ULD driver sets blk_queue_prep_rq(), it should clean it up itself on remove(), and not from the bus callbacks. This removes the need to hook into bus->remove(), which should not be used at the same time as driver->remove(). [jejb: fix sdkp initialisation problem due to mismerge] Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/scsi_lib.c1
-rw-r--r--drivers/scsi/scsi_priv.h1
-rw-r--r--drivers/scsi/scsi_sysfs.c17
-rw-r--r--drivers/scsi/sd.c1
-rw-r--r--drivers/scsi/sr.c1
5 files changed, 3 insertions, 18 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 30f3275e119e..f3c40898fc7d 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1207,6 +1207,7 @@ int scsi_prep_fn(struct request_queue *q, struct request *req)
1207 ret = scsi_setup_blk_pc_cmnd(sdev, req); 1207 ret = scsi_setup_blk_pc_cmnd(sdev, req);
1208 return scsi_prep_return(q, req, ret); 1208 return scsi_prep_return(q, req, ret);
1209} 1209}
1210EXPORT_SYMBOL(scsi_prep_fn);
1210 1211
1211/* 1212/*
1212 * scsi_dev_queue_ready: if we can send requests to sdev, return 1 else 1213 * scsi_dev_queue_ready: if we can send requests to sdev, return 1 else
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
index 00264aab8c8a..021e503c8c44 100644
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -87,7 +87,6 @@ extern int scsi_init_queue(void);
87extern void scsi_exit_queue(void); 87extern void scsi_exit_queue(void);
88struct request_queue; 88struct request_queue;
89struct request; 89struct request;
90extern int scsi_prep_fn(struct request_queue *, struct request *);
91extern struct kmem_cache *scsi_sdb_cache; 90extern struct kmem_cache *scsi_sdb_cache;
92 91
93/* scsi_proc.c */ 92/* scsi_proc.c */
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index fa4711d12744..91482f2dcc50 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -420,29 +420,12 @@ static int scsi_bus_resume(struct device * dev)
420 return err; 420 return err;
421} 421}
422 422
423static int scsi_bus_remove(struct device *dev)
424{
425 struct device_driver *drv = dev->driver;
426 struct scsi_device *sdev = to_scsi_device(dev);
427 int err = 0;
428
429 /* reset the prep_fn back to the default since the
430 * driver may have altered it and it's being removed */
431 blk_queue_prep_rq(sdev->request_queue, scsi_prep_fn);
432
433 if (drv && drv->remove)
434 err = drv->remove(dev);
435
436 return 0;
437}
438
439struct bus_type scsi_bus_type = { 423struct bus_type scsi_bus_type = {
440 .name = "scsi", 424 .name = "scsi",
441 .match = scsi_bus_match, 425 .match = scsi_bus_match,
442 .uevent = scsi_bus_uevent, 426 .uevent = scsi_bus_uevent,
443 .suspend = scsi_bus_suspend, 427 .suspend = scsi_bus_suspend,
444 .resume = scsi_bus_resume, 428 .resume = scsi_bus_resume,
445 .remove = scsi_bus_remove,
446}; 429};
447EXPORT_SYMBOL_GPL(scsi_bus_type); 430EXPORT_SYMBOL_GPL(scsi_bus_type);
448 431
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index e4ef11af18a2..5616cd780ff3 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2123,6 +2123,7 @@ static int sd_remove(struct device *dev)
2123 2123
2124 async_synchronize_full(); 2124 async_synchronize_full();
2125 sdkp = dev_get_drvdata(dev); 2125 sdkp = dev_get_drvdata(dev);
2126 blk_queue_prep_rq(sdkp->device->request_queue, scsi_prep_fn);
2126 device_del(&sdkp->dev); 2127 device_del(&sdkp->dev);
2127 del_gendisk(sdkp->disk); 2128 del_gendisk(sdkp->disk);
2128 sd_shutdown(dev); 2129 sd_shutdown(dev);
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index cd350dfc1216..cce0fe4c8a3b 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -881,6 +881,7 @@ static int sr_remove(struct device *dev)
881{ 881{
882 struct scsi_cd *cd = dev_get_drvdata(dev); 882 struct scsi_cd *cd = dev_get_drvdata(dev);
883 883
884 blk_queue_prep_rq(cd->device->request_queue, scsi_prep_fn);
884 del_gendisk(cd->disk); 885 del_gendisk(cd->disk);
885 886
886 mutex_lock(&sr_ref_mutex); 887 mutex_lock(&sr_ref_mutex);