public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix aic7xxx probing
@ 2004-06-24 22:49 James Bottomley
  2004-06-25  4:56 ` Zwane Mwaikambo
  0 siblings, 1 reply; 7+ messages in thread
From: James Bottomley @ 2004-06-24 22:49 UTC (permalink / raw)
  To: SCSI Mailing List

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 =====
--- 1.54/drivers/scsi/aic7xxx/aic7xxx_osm.c	2004-04-26 02:09:37 -04:00
+++ edited/drivers/scsi/aic7xxx/aic7xxx_osm.c	2004-06-24 18:39:54 -04:00
@@ -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 =====
--- 1.54/drivers/scsi/aic7xxx/aic7xxx_osm.h	2004-05-12 11:46:27 -04:00
+++ edited/drivers/scsi/aic7xxx/aic7xxx_osm.h	2004-06-24 18:41:49 -04:00
@@ -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) {
 }


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fix aic7xxx probing
  2004-06-24 22:49 [PATCH] fix aic7xxx probing James Bottomley
@ 2004-06-25  4:56 ` Zwane Mwaikambo
  2004-06-25 13:29   ` James Bottomley
  0 siblings, 1 reply; 7+ messages in thread
From: Zwane Mwaikambo @ 2004-06-25  4:56 UTC (permalink / raw)
  To: James Bottomley; +Cc: SCSI Mailing List, William Lee Irwin III

On Thu, 24 Jun 2004, James Bottomley wrote:

> 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.

This patch applied against 2.6.7-mm2 doesn't detect my PCI HBA whereas
2.6.7-mm2 currently does.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fix aic7xxx probing
  2004-06-25  4:56 ` Zwane Mwaikambo
@ 2004-06-25 13:29   ` James Bottomley
  2004-06-25 14:35     ` Zwane Mwaikambo
  0 siblings, 1 reply; 7+ messages in thread
From: James Bottomley @ 2004-06-25 13:29 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: SCSI Mailing List, William Lee Irwin III

On Thu, 2004-06-24 at 23:56, Zwane Mwaikambo wrote:
> 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 =====
--- 1.54/drivers/scsi/aic7xxx/aic7xxx_osm.c	2004-04-26 02:09:37 -04:00
+++ edited/aic7xxx_osm.c	2004-06-25 09:22:30 -04:00
@@ -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 =====
--- 1.54/drivers/scsi/aic7xxx/aic7xxx_osm.h	2004-05-12 11:46:27 -04:00
+++ edited/aic7xxx_osm.h	2004-06-24 18:41:49 -04:00
@@ -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 =====
--- 1.12/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c	2003-12-19 16:31:43 -05:00
+++ edited/aic7xxx_osm_pci.c	2004-06-25 09:24:54 -04:00
@@ -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;


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fix aic7xxx probing
  2004-06-25 13:29   ` James Bottomley
@ 2004-06-25 14:35     ` Zwane Mwaikambo
  2004-06-25 14:52       ` James Bottomley
  0 siblings, 1 reply; 7+ messages in thread
From: Zwane Mwaikambo @ 2004-06-25 14:35 UTC (permalink / raw)
  To: James Bottomley; +Cc: SCSI Mailing List, William Lee Irwin III

On Fri, 25 Jun 2004, James Bottomley wrote:

> On Thu, 2004-06-24 at 23:56, Zwane Mwaikambo wrote:
> > 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.

Doesn't detect the HBA with that patch either.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fix aic7xxx probing
  2004-06-25 14:35     ` Zwane Mwaikambo
@ 2004-06-25 14:52       ` James Bottomley
  2004-06-25 15:09         ` Zwane Mwaikambo
  0 siblings, 1 reply; 7+ messages in thread
From: James Bottomley @ 2004-06-25 14:52 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: SCSI Mailing List, William Lee Irwin III

On Fri, 2004-06-25 at 09:35, Zwane Mwaikambo wrote:
> 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 =====
--- 1.54/drivers/scsi/aic7xxx/aic7xxx_osm.c	2004-04-26 02:09:37 -04:00
+++ edited/drivers/scsi/aic7xxx/aic7xxx_osm.c	2004-06-25 10:50:05 -04:00
@@ -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 =====
--- 1.54/drivers/scsi/aic7xxx/aic7xxx_osm.h	2004-05-12 11:46:27 -04:00
+++ edited/drivers/scsi/aic7xxx/aic7xxx_osm.h	2004-06-24 18:41:49 -04:00
@@ -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 =====
--- 1.12/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c	2003-12-19 16:31:43 -05:00
+++ edited/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c	2004-06-25 09:24:54 -04:00
@@ -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;


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fix aic7xxx probing
  2004-06-25 14:52       ` James Bottomley
@ 2004-06-25 15:09         ` Zwane Mwaikambo
  2004-06-25 15:16           ` James Bottomley
  0 siblings, 1 reply; 7+ messages in thread
From: Zwane Mwaikambo @ 2004-06-25 15:09 UTC (permalink / raw)
  To: James Bottomley; +Cc: SCSI Mailing List, William Lee Irwin III

On Fri, 25 Jun 2004, James Bottomley wrote:

> On Fri, 2004-06-25 at 09:35, Zwane Mwaikambo wrote:
> > 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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fix aic7xxx probing
  2004-06-25 15:09         ` Zwane Mwaikambo
@ 2004-06-25 15:16           ` James Bottomley
  0 siblings, 0 replies; 7+ messages in thread
From: James Bottomley @ 2004-06-25 15:16 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: SCSI Mailing List, William Lee Irwin III

On Fri, 2004-06-25 at 10:09, Zwane Mwaikambo wrote:
> 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



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-06-25 15:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-24 22:49 [PATCH] fix aic7xxx probing James Bottomley
2004-06-25  4:56 ` Zwane Mwaikambo
2004-06-25 13:29   ` James Bottomley
2004-06-25 14:35     ` Zwane Mwaikambo
2004-06-25 14:52       ` James Bottomley
2004-06-25 15:09         ` Zwane Mwaikambo
2004-06-25 15:16           ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox