diff options
author | Christoph Hellwig <hch@lst.de> | 2005-06-10 18:14:30 -0400 |
---|---|---|
committer | James Bottomley <jejb@titanic.(none)> | 2005-06-11 19:43:48 -0400 |
commit | 3d65692aed727c7fb4105f03795781ace437a84e (patch) | |
tree | adbbd860235025d102a2aeeec130f0687d180d1e /drivers/scsi | |
parent | 6bc9dace767f1fffdf975b3398b3c4e37cd5ae18 (diff) |
[SCSI] aic7xxx: remove ahc_find_softc
there's absolutely no reason not to trust the driver private data
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/aic7xxx/aic7770_osm.c | 24 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx.h | 1 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_core.c | 16 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_osm_pci.c | 28 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_proc.c | 10 |
5 files changed, 16 insertions, 63 deletions
diff --git a/drivers/scsi/aic7xxx/aic7770_osm.c b/drivers/scsi/aic7xxx/aic7770_osm.c index 682ca0b32b44..d0e9b54ab008 100644 --- a/drivers/scsi/aic7xxx/aic7770_osm.c +++ b/drivers/scsi/aic7xxx/aic7770_osm.c | |||
@@ -190,25 +190,13 @@ aic7770_eisa_dev_probe(struct device *dev) | |||
190 | static int | 190 | static int |
191 | aic7770_eisa_dev_remove(struct device *dev) | 191 | aic7770_eisa_dev_remove(struct device *dev) |
192 | { | 192 | { |
193 | struct ahc_softc *ahc; | 193 | struct ahc_softc *ahc = dev_get_drvata(dev); |
194 | u_long l; | 194 | u_long s; |
195 | 195 | ||
196 | /* | 196 | ahc_lock(ahc, &s); |
197 | * We should be able to just perform | 197 | ahc_intr_enable(ahc, FALSE); |
198 | * the free directly, but check our | 198 | ahc_unlock(ahc, &s); |
199 | * list for extra sanity. | 199 | ahc_free(ahc); |
200 | */ | ||
201 | ahc_list_lock(&l); | ||
202 | ahc = ahc_find_softc((struct ahc_softc *)dev->driver_data); | ||
203 | if (ahc != NULL) { | ||
204 | u_long s; | ||
205 | |||
206 | ahc_lock(ahc, &s); | ||
207 | ahc_intr_enable(ahc, FALSE); | ||
208 | ahc_unlock(ahc, &s); | ||
209 | ahc_free(ahc); | ||
210 | } | ||
211 | ahc_list_unlock(&l); | ||
212 | 200 | ||
213 | return (0); | 201 | return (0); |
214 | } | 202 | } |
diff --git a/drivers/scsi/aic7xxx/aic7xxx.h b/drivers/scsi/aic7xxx/aic7xxx.h index 8ff16fd8ed49..d094e7371734 100644 --- a/drivers/scsi/aic7xxx/aic7xxx.h +++ b/drivers/scsi/aic7xxx/aic7xxx.h | |||
@@ -1200,7 +1200,6 @@ void ahc_pause_and_flushwork(struct ahc_softc *ahc); | |||
1200 | int ahc_suspend(struct ahc_softc *ahc); | 1200 | int ahc_suspend(struct ahc_softc *ahc); |
1201 | int ahc_resume(struct ahc_softc *ahc); | 1201 | int ahc_resume(struct ahc_softc *ahc); |
1202 | void ahc_softc_insert(struct ahc_softc *); | 1202 | void ahc_softc_insert(struct ahc_softc *); |
1203 | struct ahc_softc *ahc_find_softc(struct ahc_softc *ahc); | ||
1204 | void ahc_set_unit(struct ahc_softc *, int); | 1203 | void ahc_set_unit(struct ahc_softc *, int); |
1205 | void ahc_set_name(struct ahc_softc *, char *); | 1204 | void ahc_set_name(struct ahc_softc *, char *); |
1206 | void ahc_alloc_scbs(struct ahc_softc *ahc); | 1205 | void ahc_alloc_scbs(struct ahc_softc *ahc); |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c index 9a6b4a570aa7..8a2bb6f8d77b 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_core.c +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c | |||
@@ -3934,22 +3934,6 @@ ahc_softc_insert(struct ahc_softc *ahc) | |||
3934 | ahc->init_level++; | 3934 | ahc->init_level++; |
3935 | } | 3935 | } |
3936 | 3936 | ||
3937 | /* | ||
3938 | * Verify that the passed in softc pointer is for a | ||
3939 | * controller that is still configured. | ||
3940 | */ | ||
3941 | struct ahc_softc * | ||
3942 | ahc_find_softc(struct ahc_softc *ahc) | ||
3943 | { | ||
3944 | struct ahc_softc *list_ahc; | ||
3945 | |||
3946 | TAILQ_FOREACH(list_ahc, &ahc_tailq, links) { | ||
3947 | if (list_ahc == ahc) | ||
3948 | return (ahc); | ||
3949 | } | ||
3950 | return (NULL); | ||
3951 | } | ||
3952 | |||
3953 | void | 3937 | void |
3954 | ahc_set_unit(struct ahc_softc *ahc, int unit) | 3938 | ahc_set_unit(struct ahc_softc *ahc, int unit) |
3955 | { | 3939 | { |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c index 9cd4fe1c4ef2..89d737ee551a 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c | |||
@@ -140,27 +140,17 @@ struct pci_driver aic7xxx_pci_driver = { | |||
140 | static void | 140 | static void |
141 | ahc_linux_pci_dev_remove(struct pci_dev *pdev) | 141 | ahc_linux_pci_dev_remove(struct pci_dev *pdev) |
142 | { | 142 | { |
143 | struct ahc_softc *ahc; | 143 | struct ahc_softc *ahc = pci_get_drvdata(pdev); |
144 | u_long l; | 144 | u_long s; |
145 | 145 | ||
146 | /* | 146 | ahc_list_lock(&s); |
147 | * We should be able to just perform | 147 | TAILQ_REMOVE(&ahc_tailq, ahc, links); |
148 | * the free directly, but check our | 148 | ahc_list_unlock(&s); |
149 | * list for extra sanity. | ||
150 | */ | ||
151 | ahc_list_lock(&l); | ||
152 | ahc = ahc_find_softc((struct ahc_softc *)pci_get_drvdata(pdev)); | ||
153 | if (ahc != NULL) { | ||
154 | u_long s; | ||
155 | 149 | ||
156 | TAILQ_REMOVE(&ahc_tailq, ahc, links); | 150 | ahc_lock(ahc, &s); |
157 | ahc_list_unlock(&l); | 151 | ahc_intr_enable(ahc, FALSE); |
158 | ahc_lock(ahc, &s); | 152 | ahc_unlock(ahc, &s); |
159 | ahc_intr_enable(ahc, FALSE); | 153 | ahc_free(ahc); |
160 | ahc_unlock(ahc, &s); | ||
161 | ahc_free(ahc); | ||
162 | } else | ||
163 | ahc_list_unlock(&l); | ||
164 | } | 154 | } |
165 | 155 | ||
166 | static int | 156 | static int |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c index 9c7f1056710d..ab4469d83fb1 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_proc.c +++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c | |||
@@ -297,20 +297,13 @@ int | |||
297 | ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | 297 | ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, |
298 | off_t offset, int length, int inout) | 298 | off_t offset, int length, int inout) |
299 | { | 299 | { |
300 | struct ahc_softc *ahc; | 300 | struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata; |
301 | struct info_str info; | 301 | struct info_str info; |
302 | char ahc_info[256]; | 302 | char ahc_info[256]; |
303 | u_long s; | ||
304 | u_int max_targ; | 303 | u_int max_targ; |
305 | u_int i; | 304 | u_int i; |
306 | int retval; | 305 | int retval; |
307 | 306 | ||
308 | retval = -EINVAL; | ||
309 | ahc_list_lock(&s); | ||
310 | ahc = ahc_find_softc(*(struct ahc_softc **)shost->hostdata); | ||
311 | if (ahc == NULL) | ||
312 | goto done; | ||
313 | |||
314 | /* Has data been written to the file? */ | 307 | /* Has data been written to the file? */ |
315 | if (inout == TRUE) { | 308 | if (inout == TRUE) { |
316 | retval = ahc_proc_write_seeprom(ahc, buffer, length); | 309 | retval = ahc_proc_write_seeprom(ahc, buffer, length); |
@@ -372,6 +365,5 @@ ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | |||
372 | } | 365 | } |
373 | retval = info.pos > info.offset ? info.pos - info.offset : 0; | 366 | retval = info.pos > info.offset ? info.pos - info.offset : 0; |
374 | done: | 367 | done: |
375 | ahc_list_unlock(&s); | ||
376 | return (retval); | 368 | return (retval); |
377 | } | 369 | } |