Skip to contentSkip to conversation

ide: ide-generic, add another device exception

PATCH Applied Jiri Slaby 5 participants 12 messages Jun 4, 2007 – Jun 9, 2007 libata

lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/1 ide: ide-generic, add another device exception

ide-generic, add another device exception

This device is char device and is grabbed by generic ide driver:
00:0b.0 Class ffff: National Semiconductor Corporation 87410 IDE (rev ff) (prog-if ff)
Control: I/O+ Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-

Disallow generic driver to grab it by adding next condition. Also consolidate exceptions to one bigger 'switch (dev->vendor)'.

Cc Ingo Korb <[email protected]>
Cc Bartlomiej Zolnierkiewicz <[email protected]>

---
commit 879404085754892c27ff2d1c73d310582b872a98
tree abb7f3b7522c4076da230125afa9d34cbf48ff91
parent f6d5d1877b0f7ac82f5e1fec2ead0429eeb069c8
author Jiri Slaby <[email protected]> Mon, 04 Jun 2007 11:19:39 +0200 committer Jiri Slaby <[email protected]> Mon, 04 Jun 2007 11:19:39 +0200

 drivers/ide/pci/generic.c |   37 +++++++++++++++++++++++--------------
 1 files changed, 23 insertions(+), 14 deletions(-)
drivers/ide/pci/generic.c +23 -14
index f2c5a14..0d51a11 100644
@@ -198,32 +198,41 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = {
 static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
 	ide_pci_device_t *d = &generic_chipsets[id->driver_data];
-	u16 command;
 	int ret = -ENODEV;
 
 	/* Don't use the generic entry unless instructed to do so */
 	if (id->driver_data == 0 && ide_generic_all == 0)
 			goto out;
 
-	if (dev->vendor == PCI_VENDOR_ID_UMC &&
-	    dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
-	    (!(PCI_FUNC(dev->devfn) & 1)))
-		goto out; /* UM8886A/BF pair */
-
-	if (dev->vendor == PCI_VENDOR_ID_OPTI &&
-	    dev->device == PCI_DEVICE_ID_OPTI_82C558 &&
-	    (!(PCI_FUNC(dev->devfn) & 1)))
-		goto out;
-
-	if (dev->vendor == PCI_VENDOR_ID_JMICRON) {
-		if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 && PCI_FUNC(dev->devfn) != 1)
+	switch (dev->vendor) {
+	case PCI_VENDOR_ID_UMC:
+		if (dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
+				!(PCI_FUNC(dev->devfn) & 1))
+			goto out; /* UM8886A/BF pair */
+		break;
+	case PCI_VENDOR_ID_OPTI:
+		if (dev->device == PCI_DEVICE_ID_OPTI_82C558 &&
+				!(PCI_FUNC(dev->devfn) & 1))
+			goto out;
+		break;
+	case PCI_VENDOR_ID_JMICRON:
+		if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 &&
+				PCI_FUNC(dev->devfn) != 1)
+			goto out;
+		break;
+	case PCI_VENDOR_ID_NS:
+		if (dev->device == PCI_DEVICE_ID_NS_87410 &&
+				(dev->class >> 8) != PCI_CLASS_STORAGE_IDE)
 			goto out;
+		break;
 	}
 
 	if (dev->vendor != PCI_VENDOR_ID_JMICRON) {
+		u16 command;
 		pci_read_config_word(dev, PCI_COMMAND, &command);
 		if (!(command & PCI_COMMAND_IO)) {
-			printk(KERN_INFO "Skipping disabled %s IDE controller.\n", d->name);
+			printk(KERN_INFO "Skipping disabled %s IDE "
+					"controller.\n", d->name);
 			goto out;
 		}
 	}
#1 lore raw

Hello.

Quoted 39 lines · Jiri Slaby
drivers/ide/pci/generic.c +12 -13
index f2c5a14..0d51a11 100644
@@ -198,32 +198,41 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = {
 static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
 	ide_pci_device_t *d = &generic_chipsets[id->driver_data];
-	u16 command;
 	int ret = -ENODEV;
 
 	/* Don't use the generic entry unless instructed to do so */
 	if (id->driver_data == 0 && ide_generic_all == 0)
 			goto out;
 
-	if (dev->vendor == PCI_VENDOR_ID_UMC &&
-	    dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
-	    (!(PCI_FUNC(dev->devfn) & 1)))
-		goto out; /* UM8886A/BF pair */
-
-	if (dev->vendor == PCI_VENDOR_ID_OPTI &&
-	    dev->device == PCI_DEVICE_ID_OPTI_82C558 &&
-	    (!(PCI_FUNC(dev->devfn) & 1)))
-		goto out;
-
-	if (dev->vendor == PCI_VENDOR_ID_JMICRON) {
-		if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 && PCI_FUNC(dev->devfn) != 1)
+	switch (dev->vendor) {
+	case PCI_VENDOR_ID_UMC:
+		if (dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
+				!(PCI_FUNC(dev->devfn) & 1))
+			goto out; /* UM8886A/BF pair */
+		break;
+	case PCI_VENDOR_ID_OPTI:
+		if (dev->device == PCI_DEVICE_ID_OPTI_82C558 &&
+				!(PCI_FUNC(dev->devfn) & 1))
+			goto out;
+		break;
+	case PCI_VENDOR_ID_JMICRON:

drivers/ide/pci/generic.c static ide_pci_device_t generic_chipsets[] __devinitdata = { · line 228

Quoted 10 lines
drivers/ide/pci/generic.c +8 -0
+		if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 &&
+				PCI_FUNC(dev->devfn) != 1)
+			goto out;
+		break;
+	case PCI_VENDOR_ID_NS:
+		if (dev->device == PCI_DEVICE_ID_NS_87410 &&
+				(dev->class >> 8) != PCI_CLASS_STORAGE_IDE)
 			goto out;
+		break;
 	}

Could you intend the if() conditions carried to another line the way they
were intended before?

MBR, Sergei

author
#2 lore raw

Sergei Shtylyov napsal(a):

Quoted 51 lines

Hello.

Quoted 47 lines · Jiri Slaby
drivers/ide/pci/generic.c +17 -13
index f2c5a14..0d51a11 100644
@@ -198,32 +198,41 @@ static ide_pci_device_t generic_chipsets[]
 __devinitdata = {
 static int __devinit generic_init_one(struct pci_dev *dev, const
 struct pci_device_id *id)
 {
     ide_pci_device_t *d = &generic_chipsets[id->driver_data];
-    u16 command;
     int ret = -ENODEV;
 
     /* Don't use the generic entry unless instructed to do so */
     if (id->driver_data == 0 && ide_generic_all == 0)
             goto out;
 
-    if (dev->vendor == PCI_VENDOR_ID_UMC &&
-        dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
-        (!(PCI_FUNC(dev->devfn) & 1)))
-        goto out; /* UM8886A/BF pair */
-
-    if (dev->vendor == PCI_VENDOR_ID_OPTI &&
-        dev->device == PCI_DEVICE_ID_OPTI_82C558 &&
-        (!(PCI_FUNC(dev->devfn) & 1)))
-        goto out;
-
-    if (dev->vendor == PCI_VENDOR_ID_JMICRON) {
-        if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 &&
 PCI_FUNC(dev->devfn) != 1)
+    switch (dev->vendor) {
+    case PCI_VENDOR_ID_UMC:
+        if (dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
+                !(PCI_FUNC(dev->devfn) & 1))
+            goto out; /* UM8886A/BF pair */
+        break;
+    case PCI_VENDOR_ID_OPTI:
+        if (dev->device == PCI_DEVICE_ID_OPTI_82C558 &&
+                !(PCI_FUNC(dev->devfn) & 1))
+            goto out;
+        break;
+    case PCI_VENDOR_ID_JMICRON:
+        if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 &&
+                PCI_FUNC(dev->devfn) != 1)
+            goto out;
+        break;
+    case PCI_VENDOR_ID_NS:
Quoted 8 lines

drivers/ide/pci/generic.c static ide_pci_device_t generic_chipsets[] __devinitdata = { · line 228

Quoted 5 lines
drivers/ide/pci/generic.c +3 -0
+        if (dev->device == PCI_DEVICE_ID_NS_87410 &&
+                (dev->class >> 8) != PCI_CLASS_STORAGE_IDE)
             goto out;
+        break;
     }

Could you intend the if() conditions carried to another line the way
they were intended before?

I could, if you tell me the reason.

regards,

Signature · 4 lines
http://www.fi.muni.cz/~xslaby/            Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8  22A0 32CC 55C3 39D4 7A7E
#3 lore raw

Hello.

Quoted 56 lines · Jiri Slaby
Quoted 47 lines
Quoted 47 lines
drivers/ide/pci/generic.c +0 -0
index f2c5a14..0d51a11 100644
@@ -198,32 +198,41 @@ static ide_pci_device_t generic_chipsets[]
 __devinitdata = {

static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id)

{
    ide_pci_device_t *d = &generic_chipsets[id->driver_data];
drivers/ide/pci/generic.c +0 -13
-    u16 command;
    int ret = -ENODEV;
 
    /* Don't use the generic entry unless instructed to do so */
    if (id->driver_data == 0 && ide_generic_all == 0)
            goto out;
 
-    if (dev->vendor == PCI_VENDOR_ID_UMC &&
-        dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
-        (!(PCI_FUNC(dev->devfn) & 1)))
-        goto out; /* UM8886A/BF pair */
-
-    if (dev->vendor == PCI_VENDOR_ID_OPTI &&
-        dev->device == PCI_DEVICE_ID_OPTI_82C558 &&
-        (!(PCI_FUNC(dev->devfn) & 1)))
-        goto out;
-
-    if (dev->vendor == PCI_VENDOR_ID_JMICRON) {
-        if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 &&

PCI_FUNC(dev->devfn) != 1)

drivers/ide/pci/generic.c +17 -0
+    switch (dev->vendor) {
+    case PCI_VENDOR_ID_UMC:
+        if (dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
+                !(PCI_FUNC(dev->devfn) & 1))
+            goto out; /* UM8886A/BF pair */
+        break;
+    case PCI_VENDOR_ID_OPTI:
+        if (dev->device == PCI_DEVICE_ID_OPTI_82C558 &&
+                !(PCI_FUNC(dev->devfn) & 1))
+            goto out;
+        break;
+    case PCI_VENDOR_ID_JMICRON:
+        if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 &&
+                PCI_FUNC(dev->devfn) != 1)
+            goto out;
+        break;
+    case PCI_VENDOR_ID_NS:
Quoted 8 lines

drivers/ide/pci/generic.c static ide_pci_device_t generic_chipsets[] __devinitdata = { · line 228

Quoted 5 lines
drivers/ide/pci/generic.c +3 -0
+        if (dev->device == PCI_DEVICE_ID_NS_87410 &&
+                (dev->class >> 8) != PCI_CLASS_STORAGE_IDE)
            goto out;
+        break;
    }

Could you intend the if() conditions carried to another line the way
they were intended before?

Quoted 1 line

I could, if you tell me the reason.

Sorry -- I thought it was a part of kernel style, but it appeared to be my
aesthetical preference only. :-)

Quoted 1 line

regards,

MBR, Sergei

author
#4 lore raw

Sergei Shtylyov napsal(a):

Quoted 1 line

Hello.

Hi.

Quoted 2 lines

Sorry -- I thought it was a part of kernel style, but it appeared to
be my aesthetical preference only. :-)

Ok, anyway thanks for reviewing,

Signature · 4 lines
http://www.fi.muni.cz/~xslaby/            Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8  22A0 32CC 55C3 39D4 7A7E
#5 lore raw
In reply to Jiri Slaby
Quoted 1 line · Jiri Slaby

ide-generic, add another device exception

ide-generic is a generic ISA IDE driver, this one is drivers/ide/pci/generic (a generic IDE PCI driver) - fixed patch description to avoid confusion.

[ Yes, both drivers need a rename - patches are welcomed. ]

Quoted 10 lines

This device is char device and is grabbed by generic ide driver:
00:0b.0 Class ffff: National Semiconductor Corporation 87410 IDE (rev ff) (prog-if ff)
Control: I/O+ Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-

Disallow generic driver to grab it by adding next condition. Also consolidate exceptions to one bigger 'switch (dev->vendor)'.

Cc Ingo Korb <[email protected]>
Cc Bartlomiej Zolnierkiewicz <[email protected]>

applied, thanks.

#6 lore raw
Quoted 7 lines · Bartlomiej Zolnierkiewicz
Quoted 1 line · Jiri Slaby

ide-generic, add another device exception

ide-generic is a generic ISA IDE driver, this one is drivers/ide/pci/generic (a generic IDE PCI driver) - fixed patch description to avoid confusion.

[ Yes, both drivers need a rename - patches are welcomed. ]

Probably best to do a rename from your side, in git.

Jeff

#7 lore raw

Hi,

Quoted 10 lines · Jeff Garzik
Quoted 7 lines · Bartlomiej Zolnierkiewicz
Quoted 1 line · Jiri Slaby

ide-generic, add another device exception

ide-generic is a generic ISA IDE driver, this one is drivers/ide/pci/generic (a generic IDE PCI driver) - fixed patch description to avoid confusion.

[ Yes, both drivers need a rename - patches are welcomed. ]

Probably best to do a rename from your side, in git.

AFAIR git-quiltimport of quilt patches should handle this just fine?

My previous description of the issue was a bit too cryptic: besides changing ide/ide-generic.c and ide/pci/generic.c filenames, ide/Kconfig (names of config options) and ide/Makefile should be updated accordingly. Also enhancing Kconfig entries for both drivers to be more verbose would be more than appropriate.

Since I'm quite time constrained and I'm working on other IDE issues I would prefer that somebody else handle this task and just send me patches.

8)

Thanks,
Bart

#9 lore raw
In reply to Bartlomiej Zolnierkiewicz
Quoted 5 lines · On Fri, 8 Jun 2007 14:18:55 +0200 Bartlomiej Zolnierkiewicz…
Quoted 1 line · Jiri Slaby

ide-generic, add another device exception

ide-generic is a generic ISA IDE driver, this one is drivers/ide/pci/generic (a generic IDE PCI driver) - fixed patch description to avoid confusion.

Nope ide-generic is a generic I/O based ST506 interface. It covers a bit more than just ISA bus.

Quoted 2 lines

[ Yes, both drivers need a rename - patches are welcomed. ]

Good way to break everyones module settings

Alan

#10 lore raw
Quoted 11 lines · Alan Cox
Quoted 5 lines · On Fri, 8 Jun 2007 14:18:55 +0200 Bartlomiej Zolnierkiewicz…
Quoted 1 line · Jiri Slaby

ide-generic, add another device exception

ide-generic is a generic ISA IDE driver, this one is drivers/ide/pci/generic (a generic IDE PCI driver) - fixed patch description to avoid confusion.

Nope ide-generic is a generic I/O based ST506 interface. It covers a bit more than just ISA bus.

If so then can we finally get rid of hd.c?

Quoted 3 lines
Quoted 1 line

[ Yes, both drivers need a rename - patches are welcomed. ]

Good way to break everyones module settings

MODULE_ALIAS() should cover this up nicely.

Thanks,
Bart

#11 lore raw
Quoted 7 lines · On Sat, 9 Jun 2007 00:42:50 +0200 Bartlomiej Zolnierkiewicz…
Quoted 6 lines · Alan Cox
Quoted 3 lines · On Fri, 8 Jun 2007 14:18:55 +0200 Bartlomiej Zolnierkiewicz…
Quoted 1 line · Jiri Slaby

ide-generic, add another device exception

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

ide-generic is a generic ISA IDE driver, this one is drivers/ide/pci/generic (a generic IDE PCI driver) - fixed patch description to avoid confusion.

Nope ide-generic is a generic I/O based ST506 interface. It covers a bit more than just ISA bus.

If so then can we finally get rid of hd.c?

Ok ST-506 register set. ST-506 MFM command set is a bit different and does need hd.c (SFF only deals with PCI controllers)

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

[ Yes, both drivers need a rename - patches are welcomed. ]

Good way to break everyones module settings

MODULE_ALIAS() should cover this up nicely.

No problem with that. Just need to be sure it gets done.

#8 lore raw
In reply to Bartlomiej Zolnierkiewicz
Quoted 5 lines · Bartlomiej Zolnierkiewicz

Hi,

Quoted 2 lines · Jeff Garzik
Quoted 1 line · Bartlomiej Zolnierkiewicz

On Monday 04 June 2007, Jiri Slaby wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line

ide-generic, add another device exception

ide-generic is a generic ISA IDE driver, this one is drivers/ide/pci/generic (a generic IDE PCI driver) - fixed patch description to avoid confusion.

[ Yes, both drivers need a rename - patches are welcomed. ]

Probably best to do a rename from your side, in git.

AFAIR git-quiltimport of quilt patches should handle this just fine?

'git mv old_name new_name'