aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2005-06-10 18:14:30 -0400
committerJames Bottomley <jejb@titanic.(none)>2005-06-11 19:43:48 -0400
commit3d65692aed727c7fb4105f03795781ace437a84e (patch)
treeadbbd860235025d102a2aeeec130f0687d180d1e /drivers
parent6bc9dace767f1fffdf975b3398b3c4e37cd5ae18 (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')
-rw-r--r--drivers/scsi/aic7xxx/aic7770_osm.c24
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx.h1
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_core.c16
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm_pci.c28
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_proc.c10
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)
190static int 190static int
191aic7770_eisa_dev_remove(struct device *dev) 191aic7770_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);
1200int ahc_suspend(struct ahc_softc *ahc); 1200int ahc_suspend(struct ahc_softc *ahc);
1201int ahc_resume(struct ahc_softc *ahc); 1201int ahc_resume(struct ahc_softc *ahc);
1202void ahc_softc_insert(struct ahc_softc *); 1202void ahc_softc_insert(struct ahc_softc *);
1203struct ahc_softc *ahc_find_softc(struct ahc_softc *ahc);
1204void ahc_set_unit(struct ahc_softc *, int); 1203void ahc_set_unit(struct ahc_softc *, int);
1205void ahc_set_name(struct ahc_softc *, char *); 1204void ahc_set_name(struct ahc_softc *, char *);
1206void ahc_alloc_scbs(struct ahc_softc *ahc); 1205void 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 */
3941struct ahc_softc *
3942ahc_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
3953void 3937void
3954ahc_set_unit(struct ahc_softc *ahc, int unit) 3938ahc_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 = {
140static void 140static void
141ahc_linux_pci_dev_remove(struct pci_dev *pdev) 141ahc_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
166static int 156static 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
297ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, 297ahc_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;
374done: 367done:
375 ahc_list_unlock(&s);
376 return (retval); 368 return (retval);
377} 369}