]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | Subject: Driver 'sd' needs updating |
2 | From: Hannes Reinecke <hare@suse.de> | |
3 | Date: Tue Oct 7 16:17:19 2008 +0200: | |
4 | Git: 2ec147acf8022cc363266fde3e8f5f89149926c8 | |
5 | References: bnc#406656 | |
6 | ||
7 | If a driver sets blk_queue_prep_rq(), it should clean it up itself, and | |
8 | not from the bus callbacks. This removes the need to hook into bus->remove(), | |
9 | which should not be used at the same time as driver->remove(). | |
10 | ||
11 | Signed-off-by: Hannes Reinecke <hare@suse.de> | |
12 | Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> | |
13 | ||
14 | --- | |
15 | drivers/scsi/scsi_lib.c | 1 + | |
16 | drivers/scsi/scsi_priv.h | 1 - | |
17 | drivers/scsi/scsi_sysfs.c | 17 ----------------- | |
18 | drivers/scsi/sd.c | 2 ++ | |
19 | drivers/scsi/sr.c | 1 + | |
20 | include/scsi/scsi_driver.h | 1 + | |
21 | 6 files changed, 5 insertions(+), 18 deletions(-) | |
22 | ||
23 | --- a/drivers/scsi/scsi_lib.c | |
24 | +++ b/drivers/scsi/scsi_lib.c | |
25 | @@ -1338,6 +1338,7 @@ int scsi_prep_fn(struct request_queue *q | |
26 | ret = scsi_setup_blk_pc_cmnd(sdev, req); | |
27 | return scsi_prep_return(q, req, ret); | |
28 | } | |
29 | +EXPORT_SYMBOL(scsi_prep_fn); | |
30 | ||
31 | /* | |
32 | * scsi_dev_queue_ready: if we can send requests to sdev, return 1 else | |
33 | --- a/drivers/scsi/scsi_priv.h | |
34 | +++ b/drivers/scsi/scsi_priv.h | |
35 | @@ -74,7 +74,6 @@ extern int scsi_init_queue(void); | |
36 | extern void scsi_exit_queue(void); | |
37 | struct request_queue; | |
38 | struct request; | |
39 | -extern int scsi_prep_fn(struct request_queue *, struct request *); | |
40 | extern struct kmem_cache *scsi_sdb_cache; | |
41 | ||
42 | /* scsi_proc.c */ | |
43 | --- a/drivers/scsi/scsi_sysfs.c | |
44 | +++ b/drivers/scsi/scsi_sysfs.c | |
45 | @@ -420,29 +420,12 @@ static int scsi_bus_resume(struct device | |
46 | return err; | |
47 | } | |
48 | ||
49 | -static int scsi_bus_remove(struct device *dev) | |
50 | -{ | |
51 | - struct device_driver *drv = dev->driver; | |
52 | - struct scsi_device *sdev = to_scsi_device(dev); | |
53 | - int err = 0; | |
54 | - | |
55 | - /* reset the prep_fn back to the default since the | |
56 | - * driver may have altered it and it's being removed */ | |
57 | - blk_queue_prep_rq(sdev->request_queue, scsi_prep_fn); | |
58 | - | |
59 | - if (drv && drv->remove) | |
60 | - err = drv->remove(dev); | |
61 | - | |
62 | - return 0; | |
63 | -} | |
64 | - | |
65 | struct bus_type scsi_bus_type = { | |
66 | .name = "scsi", | |
67 | .match = scsi_bus_match, | |
68 | .uevent = scsi_bus_uevent, | |
69 | .suspend = scsi_bus_suspend, | |
70 | .resume = scsi_bus_resume, | |
71 | - .remove = scsi_bus_remove, | |
72 | }; | |
73 | EXPORT_SYMBOL_GPL(scsi_bus_type); | |
74 | ||
75 | --- a/drivers/scsi/sd.c | |
76 | +++ b/drivers/scsi/sd.c | |
77 | @@ -1914,6 +1914,8 @@ static int sd_remove(struct device *dev) | |
78 | { | |
79 | struct scsi_disk *sdkp = dev_get_drvdata(dev); | |
80 | ||
81 | + blk_queue_prep_rq(sdkp->device->request_queue, scsi_prep_fn); | |
82 | + | |
83 | device_del(&sdkp->dev); | |
84 | del_gendisk(sdkp->disk); | |
85 | sd_shutdown(dev); | |
86 | --- a/drivers/scsi/sr.c | |
87 | +++ b/drivers/scsi/sr.c | |
88 | @@ -895,6 +895,7 @@ static int sr_remove(struct device *dev) | |
89 | { | |
90 | struct scsi_cd *cd = dev_get_drvdata(dev); | |
91 | ||
92 | + blk_queue_prep_rq(cd->device->request_queue, scsi_prep_fn); | |
93 | del_gendisk(cd->disk); | |
94 | ||
95 | mutex_lock(&sr_ref_mutex); | |
96 | --- a/include/scsi/scsi_driver.h | |
97 | +++ b/include/scsi/scsi_driver.h | |
98 | @@ -32,5 +32,6 @@ int scsi_setup_blk_pc_cmnd(struct scsi_d | |
99 | int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req); | |
100 | int scsi_prep_state_check(struct scsi_device *sdev, struct request *req); | |
101 | int scsi_prep_return(struct request_queue *q, struct request *req, int ret); | |
102 | +int scsi_prep_fn(struct request_queue *, struct request *); | |
103 | ||
104 | #endif /* _SCSI_SCSI_DRIVER_H */ |