fix aic7xxx probing
Subsystems (2)
PATCH 1/1 fix aic7xxx probing
It looks like there's still a problem with the probing:
ahc_linux_pci_init() returns the number of boards attached ahc_linux_eisa_init() returns 0 on success or error
The only reason the current code actually works on PCI seems to be that it's already attached the devices by the time it returns what the ahc_linux_detect() assumes to be a failure code.
James
===== drivers/scsi/aic7xxx/aic7xxx_osm.c 1.54 vs edited =====
drivers/scsi/aic7xxx/aic7xxx_osm.c +5 -11
@@ -842,9 +842,7 @@static int ahc_linux_detect (Scsi_Host_Template *template) { -struct ahc_softc *ahc;int found =0 ; -int eisa_err, pci_err;#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,5 ,0 )/*
@@ -892,13 +890,11 @@*/ ahc_list_lockinit (); - pci_err =ahc_linux_pci_init (); - eisa_err =ahc_linux_eisa_init (); - -if (pci_err && eisa_err) - goto out; - - + found =ahc_linux_pci_init (); +if (!ahc_linux_eisa_init ()) + found++; + +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,5 ,0 )/* * Register with the SCSI layer all * controllers we've found.
@@ -908,9 +904,7 @@if (ahc_linux_register_host (ahc, template) ==0 ) found++; } -out: -#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,5 ,0 )spin_lock_irq (&io_request_lock);#endif aic7xxx_detect_complete++;
===== drivers/scsi/aic7xxx/aic7xxx_osm.h 1.54 vs edited =====
drivers/scsi/aic7xxx/aic7xxx_osm.h +1 -1
@@ -940,7 +940,7 @@ }#else static inline int ahc_linux_pci_init (void ) { -return -ENODEV ; +return 0 ; }static inline void ahc_linux_pci_exit (void ) { }
Quoted 8 lines · James Bottomley
It looks like there's still a problem with the probing:
ahc_linux_pci_init()returns the number of boards attachedahc_linux_eisa_init()returns 0 on success or errorThe only reason the current code actually works on PCI seems to be that it's already attached the devices by the time it returns what the
ahc_linux_detect()assumes to be a failure code.
This patch applied against 2.6.7-mm2 doesn't detect my PCI HBA whereas 2.6.7-mm2 currently does.
Quoted 2 lines · Zwane Mwaikambo
This patch applied against 2.6.7-mm2 doesn't detect my PCI HBA whereas 2.6.7-mm2 currently does.
Thanks, had another look at the code and it seems that the meaning of the return value for ahc_linux_pci_init() is different depending on kernel version, sigh. For < 2.4.0 it means number of boards found, otherwise it's zero or error.
We really need to scrub this 2.2 code out of the driver, but in the meantime, can you test the attached? (backing out the original). It just makes the return of ahc_linux_pci_init() consistent.
Thanks,
James
===== aic7xxx_osm.c 1.54 vs edited =====
aic7xxx_osm.c renamed from drivers/scsi/aic7xxx/aic7xxx_osm.c +5 -11
@@ -842,9 +842,7 @@static int ahc_linux_detect (Scsi_Host_Template *template) { -struct ahc_softc *ahc;int found =0 ; -int eisa_err, pci_err;#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,5 ,0 )/*
@@ -892,13 +890,11 @@*/ ahc_list_lockinit (); - pci_err =ahc_linux_pci_init (); - eisa_err =ahc_linux_eisa_init (); - -if (pci_err && eisa_err) - goto out; - - + found =ahc_linux_pci_init (); +if (!ahc_linux_eisa_init ()) + found++; + +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,5 ,0 )/* * Register with the SCSI layer all * controllers we've found.
@@ -908,9 +904,7 @@if (ahc_linux_register_host (ahc, template) ==0 ) found++; } -out: -#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,5 ,0 )spin_lock_irq (&io_request_lock);#endif aic7xxx_detect_complete++;
===== aic7xxx_osm.h 1.54 vs edited =====
aic7xxx_osm.h renamed from drivers/scsi/aic7xxx/aic7xxx_osm.h +1 -1
@@ -940,7 +940,7 @@ }#else static inline int ahc_linux_pci_init (void ) { -return -ENODEV ; +return 0 ; }static inline void ahc_linux_pci_exit (void ) { }
===== aic7xxx_osm_pci.c 1.12 vs edited =====
aic7xxx_osm_pci.c renamed from drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +2 -1
@@ -198,7 +198,8 @@ahc_linux_pci_init (void) {#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,4 ,0 ) -return (pci_module_init (&aic7xxx_pci_driver)); +/* Translate error or zero return into zero or one */ +return pci_module_init (&aic7xxx_pci_driver) ?0 :1 ;#else struct pci_dev *pdev;u_int class;
Quoted 4 lines · James Bottomley
Quoted 2 lines · Zwane Mwaikambo
This patch applied against 2.6.7-mm2 doesn't detect my PCI HBA whereas 2.6.7-mm2 currently does.
Quoted 8 lines
Thanks, had another look at the code and it seems that the meaning of the return value for
ahc_linux_pci_init()is different depending on kernel version, sigh. For < 2.4.0 it means number of boards found, otherwise it's zero or error.We really need to scrub this 2.2 code out of the driver, but in the meantime, can you test the attached? (backing out the original). It just makes the return of
ahc_linux_pci_init()consistent.
Doesn't detect the HBA with that patch either.
Quoted 1 line · Zwane Mwaikambo
Doesn't detect the HBA with that patch either.
Hmm, probably doesn't do direct host addition in certain cases. How about third time lucky?
James
===== drivers/scsi/aic7xxx/aic7xxx_osm.c 1.54 vs edited =====
drivers/scsi/aic7xxx/aic7xxx_osm.c +4 -9
@@ -844,7 +844,6 @@ {struct ahc_softc *ahc;int found =0 ; -int eisa_err, pci_err;#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,5 ,0 )/*
@@ -892,13 +891,10 @@*/ ahc_list_lockinit (); - pci_err =ahc_linux_pci_init (); - eisa_err =ahc_linux_eisa_init (); - -if (pci_err && eisa_err) - goto out; - - + found =ahc_linux_pci_init (); +if (!ahc_linux_eisa_init ()) + found++; +/* * Register with the SCSI layer all * controllers we've found.
@@ -908,7 +904,6 @@if (ahc_linux_register_host (ahc, template) ==0 ) found++; } -out:#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,5 ,0 )spin_lock_irq (&io_request_lock);
===== drivers/scsi/aic7xxx/aic7xxx_osm.h 1.54 vs edited =====
drivers/scsi/aic7xxx/aic7xxx_osm.h +1 -1
@@ -940,7 +940,7 @@ }#else static inline int ahc_linux_pci_init (void ) { -return -ENODEV ; +return 0 ; }static inline void ahc_linux_pci_exit (void ) { }
===== drivers/scsi/aic7xxx/aic7xxx_osm_pci.c 1.12 vs edited =====
drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +2 -1
@@ -198,7 +198,8 @@ahc_linux_pci_init (void) {#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,4 ,0 ) -return (pci_module_init (&aic7xxx_pci_driver)); +/* Translate error or zero return into zero or one */ +return pci_module_init (&aic7xxx_pci_driver) ?0 :1 ;#else struct pci_dev *pdev;u_int class;
Quoted 5 lines · James Bottomley
Quoted 1 line · Zwane Mwaikambo
Doesn't detect the HBA with that patch either.
Hmm, probably doesn't do direct host addition in certain cases. How about third time lucky?
Indeed, third time is the charm ;)
Thanks,
Zwane
Quoted 1 line · Zwane Mwaikambo
Indeed, third time is the charm ;)
Thanks, for testing this; sorry I have so much difficulty working out how aic7xxx should be operating...
I'll apply this one...it should get my eagle back working again.
James