diff options
author | Matthew Wilcox <matthew@wil.cx> | 2007-07-17 15:38:03 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-07-18 12:17:57 -0400 |
commit | 3ac709c113daa19e375e8b0fef318fab1713f687 (patch) | |
tree | 210b4b746f02197ac8c48dbcd424cbc716a7ae22 | |
parent | 88e2f98e1b3eb27ae708daa3b37dd50f3f06c952 (diff) |
[SCSI] a4000t, zorro7xx, mvme16x, bvme6000,sim710: xxx_device_remove seems buggy
Fix drivers misusing dev_to_shost
Some drivers were using dev_to_shost to go from a struct device to the
corresponding shost. Unfortunately, dev_to_shost only looks up the tree
to find an shost (it's designed to go from a scsi_device or a
scsi_target to the parent scsi_host), and these drivers were calling it
with the parent of the scsi_host.
I've fixed this by saving a pointer to the Scsi_Host in the drvdata,
which matches what most scsi drivers do.
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r-- | drivers/scsi/a4000t.c | 3 | ||||
-rw-r--r-- | drivers/scsi/bvme6000_scsi.c | 3 | ||||
-rw-r--r-- | drivers/scsi/mvme16x_scsi.c | 3 | ||||
-rw-r--r-- | drivers/scsi/sim710.c | 3 | ||||
-rw-r--r-- | drivers/scsi/zorro7xx.c | 3 |
5 files changed, 10 insertions, 5 deletions
diff --git a/drivers/scsi/a4000t.c b/drivers/scsi/a4000t.c index 6a5784683ed3..0c758d1452ba 100644 --- a/drivers/scsi/a4000t.c +++ b/drivers/scsi/a4000t.c | |||
@@ -79,6 +79,7 @@ static int __devinit a4000t_probe(struct device *dev) | |||
79 | goto out_put_host; | 79 | goto out_put_host; |
80 | } | 80 | } |
81 | 81 | ||
82 | dev_set_drvdata(dev, host); | ||
82 | scsi_scan_host(host); | 83 | scsi_scan_host(host); |
83 | 84 | ||
84 | return 0; | 85 | return 0; |
@@ -95,7 +96,7 @@ static int __devinit a4000t_probe(struct device *dev) | |||
95 | 96 | ||
96 | static __devexit int a4000t_device_remove(struct device *dev) | 97 | static __devexit int a4000t_device_remove(struct device *dev) |
97 | { | 98 | { |
98 | struct Scsi_Host *host = dev_to_shost(dev); | 99 | struct Scsi_Host *host = dev_get_drvdata(dev); |
99 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); | 100 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); |
100 | 101 | ||
101 | scsi_remove_host(host); | 102 | scsi_remove_host(host); |
diff --git a/drivers/scsi/bvme6000_scsi.c b/drivers/scsi/bvme6000_scsi.c index 012cdea7946d..cac354086737 100644 --- a/drivers/scsi/bvme6000_scsi.c +++ b/drivers/scsi/bvme6000_scsi.c | |||
@@ -74,6 +74,7 @@ bvme6000_probe(struct device *dev) | |||
74 | goto out_put_host; | 74 | goto out_put_host; |
75 | } | 75 | } |
76 | 76 | ||
77 | dev_set_drvdata(dev, host); | ||
77 | scsi_scan_host(host); | 78 | scsi_scan_host(host); |
78 | 79 | ||
79 | return 0; | 80 | return 0; |
@@ -89,7 +90,7 @@ bvme6000_probe(struct device *dev) | |||
89 | static __devexit int | 90 | static __devexit int |
90 | bvme6000_device_remove(struct device *dev) | 91 | bvme6000_device_remove(struct device *dev) |
91 | { | 92 | { |
92 | struct Scsi_Host *host = dev_to_shost(dev); | 93 | struct Scsi_Host *host = dev_get_drvdata(dev); |
93 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); | 94 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); |
94 | 95 | ||
95 | scsi_remove_host(host); | 96 | scsi_remove_host(host); |
diff --git a/drivers/scsi/mvme16x_scsi.c b/drivers/scsi/mvme16x_scsi.c index d6ef22a941c4..1bdddad48571 100644 --- a/drivers/scsi/mvme16x_scsi.c +++ b/drivers/scsi/mvme16x_scsi.c | |||
@@ -89,6 +89,7 @@ mvme16x_probe(struct device *dev) | |||
89 | out_be32(0xfff4202c, v); | 89 | out_be32(0xfff4202c, v); |
90 | } | 90 | } |
91 | 91 | ||
92 | dev_set_drvdata(dev, host); | ||
92 | scsi_scan_host(host); | 93 | scsi_scan_host(host); |
93 | 94 | ||
94 | return 0; | 95 | return 0; |
@@ -104,7 +105,7 @@ mvme16x_probe(struct device *dev) | |||
104 | static __devexit int | 105 | static __devexit int |
105 | mvme16x_device_remove(struct device *dev) | 106 | mvme16x_device_remove(struct device *dev) |
106 | { | 107 | { |
107 | struct Scsi_Host *host = dev_to_shost(dev); | 108 | struct Scsi_Host *host = dev_get_drvdata(dev); |
108 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); | 109 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); |
109 | 110 | ||
110 | /* Disable scsi chip ints */ | 111 | /* Disable scsi chip ints */ |
diff --git a/drivers/scsi/sim710.c b/drivers/scsi/sim710.c index 018c65f73ac4..6ab11b487ec3 100644 --- a/drivers/scsi/sim710.c +++ b/drivers/scsi/sim710.c | |||
@@ -139,6 +139,7 @@ sim710_probe_common(struct device *dev, unsigned long base_addr, | |||
139 | goto out_put_host; | 139 | goto out_put_host; |
140 | } | 140 | } |
141 | 141 | ||
142 | dev_set_drvdata(dev, host); | ||
142 | scsi_scan_host(host); | 143 | scsi_scan_host(host); |
143 | 144 | ||
144 | return 0; | 145 | return 0; |
@@ -156,7 +157,7 @@ sim710_probe_common(struct device *dev, unsigned long base_addr, | |||
156 | static __devexit int | 157 | static __devexit int |
157 | sim710_device_remove(struct device *dev) | 158 | sim710_device_remove(struct device *dev) |
158 | { | 159 | { |
159 | struct Scsi_Host *host = dev_to_shost(dev); | 160 | struct Scsi_Host *host = dev_get_drvdata(dev); |
160 | struct NCR_700_Host_Parameters *hostdata = | 161 | struct NCR_700_Host_Parameters *hostdata = |
161 | (struct NCR_700_Host_Parameters *)host->hostdata[0]; | 162 | (struct NCR_700_Host_Parameters *)host->hostdata[0]; |
162 | 163 | ||
diff --git a/drivers/scsi/zorro7xx.c b/drivers/scsi/zorro7xx.c index 50703877a585..c822debc2668 100644 --- a/drivers/scsi/zorro7xx.c +++ b/drivers/scsi/zorro7xx.c | |||
@@ -130,6 +130,7 @@ static int __devinit zorro7xx_init_one(struct zorro_dev *z, | |||
130 | goto out_put_host; | 130 | goto out_put_host; |
131 | } | 131 | } |
132 | 132 | ||
133 | zorro_set_drvdata(z, host); | ||
133 | scsi_scan_host(host); | 134 | scsi_scan_host(host); |
134 | 135 | ||
135 | return 0; | 136 | return 0; |
@@ -148,7 +149,7 @@ static int __devinit zorro7xx_init_one(struct zorro_dev *z, | |||
148 | 149 | ||
149 | static __devexit void zorro7xx_remove_one(struct zorro_dev *z) | 150 | static __devexit void zorro7xx_remove_one(struct zorro_dev *z) |
150 | { | 151 | { |
151 | struct Scsi_Host *host = dev_to_shost(&z->dev); | 152 | struct Scsi_Host *host = zorro_get_drvdata(z); |
152 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); | 153 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); |
153 | 154 | ||
154 | scsi_remove_host(host); | 155 | scsi_remove_host(host); |