X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fsysfs.c;h=ea386fa8fbdfbf4a7dd616ef8469eed2c4bed7a7;hb=69388a6a3cc4c615ac89b9b298c8e70a6ba6e311;hp=70419ecfca2a30b659a6430e6253b8776e155ac4;hpb=152967235012b72c4c99f2d9631d19a2afc0ef8c;p=pciutils.git diff --git a/lib/sysfs.c b/lib/sysfs.c index 70419ec..ea386fa 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -2,7 +2,7 @@ * The PCI Library -- Configuration Access via /sys/bus/pci * * Copyright (c) 2003 Matthew Wilcox - * Copyright (c) 1997--2003 Martin Mares + * Copyright (c) 1997--2008 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -25,13 +25,13 @@ static void sysfs_config(struct pci_access *a) { - a->method_params[PCI_ACCESS_SYS_BUS_PCI] = PCI_PATH_SYS_BUS_PCI; + pci_define_param(a, "sysfs.path", PCI_PATH_SYS_BUS_PCI, "Path to the sysfs device tree"); } static inline char * sysfs_name(struct pci_access *a) { - return a->method_params[PCI_ACCESS_SYS_BUS_PCI]; + return pci_get_param(a, "sysfs.path"); } static int @@ -163,18 +163,14 @@ static void sysfs_scan(struct pci_access *a) { sysfs_get_resources(d); d->irq = sysfs_get_value(d, "irq"); - d->known_fields = PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES; -#if 0 /* - * We prefer reading these from the config registers, it's faster. - * However, it would be possible and maybe even useful to hack the kernel - * to believe that some device has a different ID. If you do it, just - * enable this piece of code. --mj + * We could read these faster from the config registers, but we want to give + * the kernel a chance to fix up ID's and especially classes of broken devices. */ d->vendor_id = sysfs_get_value(d, "vendor"); d->device_id = sysfs_get_value(d, "device"); - d->known_fields |= PCI_FILL_IDENT; -#endif + d->device_class = sysfs_get_value(d, "class") >> 8; + d->known_fields = PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE | PCI_FILL_SIZES; } pci_link_dev(a, d); } @@ -254,7 +250,8 @@ static void sysfs_cleanup_dev(struct pci_dev *d) } struct pci_methods pm_linux_sysfs = { - "Linux-sysfs", + "linux-sysfs", + "The sys filesystem on Linux", sysfs_config, sysfs_detect, sysfs_init,