Commit 3d65692a authored by Christoph Hellwig's avatar Christoph Hellwig Committed by James Bottomley

[SCSI] aic7xxx: remove ahc_find_softc

there's absolutely no reason not to trust the driver private data
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 6bc9dace
...@@ -190,25 +190,13 @@ aic7770_eisa_dev_probe(struct device *dev) ...@@ -190,25 +190,13 @@ aic7770_eisa_dev_probe(struct device *dev)
static int static int
aic7770_eisa_dev_remove(struct device *dev) aic7770_eisa_dev_remove(struct device *dev)
{ {
struct ahc_softc *ahc; struct ahc_softc *ahc = dev_get_drvata(dev);
u_long l; u_long s;
/* ahc_lock(ahc, &s);
* We should be able to just perform ahc_intr_enable(ahc, FALSE);
* the free directly, but check our ahc_unlock(ahc, &s);
* list for extra sanity. ahc_free(ahc);
*/
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);
return (0); return (0);
} }
...@@ -1200,7 +1200,6 @@ void ahc_pause_and_flushwork(struct ahc_softc *ahc); ...@@ -1200,7 +1200,6 @@ void ahc_pause_and_flushwork(struct ahc_softc *ahc);
int ahc_suspend(struct ahc_softc *ahc); int ahc_suspend(struct ahc_softc *ahc);
int ahc_resume(struct ahc_softc *ahc); int ahc_resume(struct ahc_softc *ahc);
void ahc_softc_insert(struct ahc_softc *); 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_unit(struct ahc_softc *, int);
void ahc_set_name(struct ahc_softc *, char *); void ahc_set_name(struct ahc_softc *, char *);
void ahc_alloc_scbs(struct ahc_softc *ahc); void ahc_alloc_scbs(struct ahc_softc *ahc);
......
...@@ -3934,22 +3934,6 @@ ahc_softc_insert(struct ahc_softc *ahc) ...@@ -3934,22 +3934,6 @@ ahc_softc_insert(struct ahc_softc *ahc)
ahc->init_level++; 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 void
ahc_set_unit(struct ahc_softc *ahc, int unit) ahc_set_unit(struct ahc_softc *ahc, int unit)
{ {
......
...@@ -140,27 +140,17 @@ struct pci_driver aic7xxx_pci_driver = { ...@@ -140,27 +140,17 @@ struct pci_driver aic7xxx_pci_driver = {
static void static void
ahc_linux_pci_dev_remove(struct pci_dev *pdev) ahc_linux_pci_dev_remove(struct pci_dev *pdev)
{ {
struct ahc_softc *ahc; struct ahc_softc *ahc = pci_get_drvdata(pdev);
u_long l; u_long s;
/* ahc_list_lock(&s);
* We should be able to just perform TAILQ_REMOVE(&ahc_tailq, ahc, links);
* the free directly, but check our ahc_list_unlock(&s);
* 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;
TAILQ_REMOVE(&ahc_tailq, ahc, links); ahc_lock(ahc, &s);
ahc_list_unlock(&l); ahc_intr_enable(ahc, FALSE);
ahc_lock(ahc, &s); ahc_unlock(ahc, &s);
ahc_intr_enable(ahc, FALSE); ahc_free(ahc);
ahc_unlock(ahc, &s);
ahc_free(ahc);
} else
ahc_list_unlock(&l);
} }
static int static int
......
...@@ -297,20 +297,13 @@ int ...@@ -297,20 +297,13 @@ int
ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
off_t offset, int length, int inout) off_t offset, int length, int inout)
{ {
struct ahc_softc *ahc; struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata;
struct info_str info; struct info_str info;
char ahc_info[256]; char ahc_info[256];
u_long s;
u_int max_targ; u_int max_targ;
u_int i; u_int i;
int retval; 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? */ /* Has data been written to the file? */
if (inout == TRUE) { if (inout == TRUE) {
retval = ahc_proc_write_seeprom(ahc, buffer, length); 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,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; retval = info.pos > info.offset ? info.pos - info.offset : 0;
done: done:
ahc_list_unlock(&s);
return (retval); return (retval);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment