* [PATCH] Re-xmit: PCI IDs module alias fix
@ 2003-03-31 23:18 Rusty Russell
0 siblings, 0 replies; only message in thread
From: Rusty Russell @ 2003-03-31 23:18 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel
Linus, please apply (OK'd by Greg Kroah-Hartmann).
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Name: Subdivide PCI class for aliases
Author: Rusty Russell
Status: Tested on 2.5.66-bk2
D: The previous handling of PCI class masks was too primitive: the
D: class field is not "all or nothing" but has base class, subclass
D: and interface fields. This patch changes the alias form from:
D: pci:vNdNsvNsdNcN to pci:vNdNsvNsdNbcNscNiN.
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.66-bk2/scripts/file2alias.c working-2.5.66-bk2-pci-alias/scripts/file2alias.c
--- linux-2.5.66-bk2/scripts/file2alias.c 2003-02-18 11:18:57.000000000 +1100
+++ working-2.5.66-bk2-pci-alias/scripts/file2alias.c 2003-03-27 16:35:37.000000000 +1100
@@ -81,10 +81,14 @@ static int do_usb_entry(const char *file
return 1;
}
-/* Looks like: pci:vNdNsvNsdNcN. */
+/* Looks like: pci:vNdNsvNsdNbcNscNiN. */
static int do_pci_entry(const char *filename,
struct pci_device_id *id, char *alias)
{
+ /* Class field can be divided into these three. */
+ unsigned char baseclass, subclass, interface,
+ baseclass_mask, subclass_mask, interface_mask;
+
id->vendor = TO_NATIVE(id->vendor);
id->device = TO_NATIVE(id->device);
id->subvendor = TO_NATIVE(id->subvendor);
@@ -97,13 +101,26 @@ static int do_pci_entry(const char *file
ADD(alias, "d", id->device != PCI_ANY_ID, id->device);
ADD(alias, "sv", id->subvendor != PCI_ANY_ID, id->subvendor);
ADD(alias, "sd", id->subdevice != PCI_ANY_ID, id->subdevice);
- if (id->class_mask != 0 && id->class_mask != ~0) {
+
+ baseclass = (id->class) >> 16;
+ baseclass_mask = (id->class_mask) >> 16;
+ subclass = (id->class) >> 8;
+ subclass_mask = (id->class_mask) >> 8;
+ interface = id->class;
+ interface_mask = id->class_mask;
+
+ if ((baseclass_mask != 0 && baseclass_mask != 0xFF)
+ || (subclass_mask != 0 && subclass_mask != 0xFF)
+ || (interface_mask != 0 && interface_mask != 0xFF)) {
fprintf(stderr,
- "*** Warning: Can't handle class_mask in %s:%04X\n",
+ "*** Warning: Can't handle masks in %s:%04X\n",
filename, id->class_mask);
return 0;
}
- ADD(alias, "c", id->class_mask == ~0, id->class);
+
+ ADD(alias, "bc", baseclass_mask == 0xFF, baseclass);
+ ADD(alias, "sc", subclass_mask == 0xFF, subclass);
+ ADD(alias, "i", interface_mask == 0xFF, interface);
return 1;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-03-31 23:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-31 23:18 [PATCH] Re-xmit: PCI IDs module alias fix Rusty Russell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®