[SCSI] aic7xxx: remove ahc_find_softc
authorChristoph Hellwig <hch@lst.de>
Fri, 10 Jun 2005 22:14:30 +0000 (00:14 +0200)
committerJames Bottomley <jejb@titanic.(none)>
Sat, 11 Jun 2005 23:43:48 +0000 (18:43 -0500)
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>
drivers/scsi/aic7xxx/aic7770_osm.c
drivers/scsi/aic7xxx/aic7xxx.h
drivers/scsi/aic7xxx/aic7xxx_core.c
drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
drivers/scsi/aic7xxx/aic7xxx_proc.c

index 682ca0b32b44b33b0cedbb8a469ee0ec78dccc6f..d0e9b54ab008d411884c869697e81d0b5ede9a3a 100644 (file)
@@ -190,25 +190,13 @@ aic7770_eisa_dev_probe(struct device *dev)
 static int
 aic7770_eisa_dev_remove(struct device *dev)
 {
-       struct ahc_softc *ahc;
-       u_long l;
+       struct ahc_softc *ahc = dev_get_drvata(dev);
+       u_long s;
 
-       /*
-        * We should be able to just perform
-        * the free directly, but check our
-        * list for extra sanity.
-        */
-       ahc_list_lock(&l);
-       ahc = ahc_find_softc((struct ahc_softc *)dev->driver_data);
-       if (ahc != NULL) {
-               u_long s;
-
-               ahc_lock(ahc, &s);
-               ahc_intr_enable(ahc, FALSE);
-               ahc_unlock(ahc, &s);
-               ahc_free(ahc);
-       }
-       ahc_list_unlock(&l);
+       ahc_lock(ahc, &s);
+       ahc_intr_enable(ahc, FALSE);
+       ahc_unlock(ahc, &s);
+       ahc_free(ahc);
 
        return (0);
 }
index 8ff16fd8ed49ab98aac91961ed54b84e3218c112..d094e73717345a4a3fa1b3b09760b2010e319ee9 100644 (file)
@@ -1200,7 +1200,6 @@ void                       ahc_pause_and_flushwork(struct ahc_softc *ahc);
 int                     ahc_suspend(struct ahc_softc *ahc); 
 int                     ahc_resume(struct ahc_softc *ahc);
 void                    ahc_softc_insert(struct ahc_softc *);
-struct ahc_softc       *ahc_find_softc(struct ahc_softc *ahc);
 void                    ahc_set_unit(struct ahc_softc *, int);
 void                    ahc_set_name(struct ahc_softc *, char *);
 void                    ahc_alloc_scbs(struct ahc_softc *ahc);
index 9a6b4a570aa704d93ef32cbabc7ccb6399e6cc05..8a2bb6f8d77b003396b4ac3721d24c9fa0717723 100644 (file)
@@ -3934,22 +3934,6 @@ ahc_softc_insert(struct ahc_softc *ahc)
        ahc->init_level++;
 }
 
-/*
- * Verify that the passed in softc pointer is for a
- * controller that is still configured.
- */
-struct ahc_softc *
-ahc_find_softc(struct ahc_softc *ahc)
-{
-       struct ahc_softc *list_ahc;
-
-       TAILQ_FOREACH(list_ahc, &ahc_tailq, links) {
-               if (list_ahc == ahc)
-                       return (ahc);
-       }
-       return (NULL);
-}
-
 void
 ahc_set_unit(struct ahc_softc *ahc, int unit)
 {
index 9cd4fe1c4ef2ce7133022fe11dfe72e1bd1b00a6..89d737ee551a71c978f9670fdd58a096c9f0c6ae 100644 (file)
@@ -140,27 +140,17 @@ struct pci_driver aic7xxx_pci_driver = {
 static void
 ahc_linux_pci_dev_remove(struct pci_dev *pdev)
 {
-       struct ahc_softc *ahc;
-       u_long l;
+       struct ahc_softc *ahc = pci_get_drvdata(pdev);
+       u_long s;
 
-       /*
-        * We should be able to just perform
-        * the free directly, but check our
-        * list for extra sanity.
-        */
-       ahc_list_lock(&l);
-       ahc = ahc_find_softc((struct ahc_softc *)pci_get_drvdata(pdev));
-       if (ahc != NULL) {
-               u_long s;
+       ahc_list_lock(&s);
+       TAILQ_REMOVE(&ahc_tailq, ahc, links);
+       ahc_list_unlock(&s);
 
-               TAILQ_REMOVE(&ahc_tailq, ahc, links);
-               ahc_list_unlock(&l);
-               ahc_lock(ahc, &s);
-               ahc_intr_enable(ahc, FALSE);
-               ahc_unlock(ahc, &s);
-               ahc_free(ahc);
-       } else
-               ahc_list_unlock(&l);
+       ahc_lock(ahc, &s);
+       ahc_intr_enable(ahc, FALSE);
+       ahc_unlock(ahc, &s);
+       ahc_free(ahc);
 }
 
 static int
index 9c7f1056710db68337a921b36daf35a1bae79de9..ab4469d83fb1d95fee4f5e06fa87dcfa39491f12 100644 (file)
@@ -297,20 +297,13 @@ int
 ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
                    off_t offset, int length, int inout)
 {
-       struct  ahc_softc *ahc;
+       struct  ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata;
        struct  info_str info;
        char    ahc_info[256];
-       u_long  s;
        u_int   max_targ;
        u_int   i;
        int     retval;
 
-       retval = -EINVAL;
-       ahc_list_lock(&s);
-       ahc = ahc_find_softc(*(struct ahc_softc **)shost->hostdata);
-       if (ahc == NULL)
-               goto done;
-
         /* Has data been written to the file? */ 
        if (inout == TRUE) {
                retval = ahc_proc_write_seeprom(ahc, buffer, length);
@@ -372,6 +365,5 @@ ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
        }
        retval = info.pos > info.offset ? info.pos - info.offset : 0;
 done:
-       ahc_list_unlock(&s);
        return (retval);
 }