PATCH: Add fixup functionality to the PCI drivers
Using the ->fixup field that was added we propogate the fixup functionality into PCI interfaces. The fixup needs to be in the data structure really as interfaces may be hotplugged/unplugged [plugged only in base kernel].
The PCI interfaces stay the same so no driver changes are needed except to use the fixup hook.
drivers/ide/setup-pci.c +18 -6
@@ -729,14 +729,26 @@return index; } +/** +* probe_pci_hwif_init - probe the hwif then allow fixups +* @hwif: interface to probe +* @d: PCI device +* +* Perform the generic probe and if it is successful invoke any +* remaining post probe fixup logic in the driver itself. +*/ +static void probe_pci_hwif_init (ide_hwif_t *hwif,ide_pci_device_t *d) { +probe_hwif_init_with_fixup (hwif, d->fixup); +} +void ide_setup_pci_device (struct pci_dev *dev,ide_pci_device_t *d) {ata_index_t index_list =do_ide_setup_pci_device (dev, d,1 );if ((index_list.b.low &0xf0 ) !=0xf0 ) -probe_hwif_init (&ide_hwifs[index_list.b.low]); +probe_pci_hwif_init (&ide_hwifs[index_list.b.low], d);if ((index_list.b.high &0xf0 ) !=0xf0 ) -probe_hwif_init (&ide_hwifs[index_list.b.high]); +probe_pci_hwif_init (&ide_hwifs[index_list.b.high], d);create_proc_ide_interfaces (); }
@@ -749,13 +761,13 @@ata_index_t index_list2 =do_ide_setup_pci_device (dev2, d,0 );if ((index_list.b.low &0xf0 ) !=0xf0 ) -probe_hwif_init (&ide_hwifs[index_list.b.low]); +probe_pci_hwif_init (&ide_hwifs[index_list.b.low], d);if ((index_list.b.high &0xf0 ) !=0xf0 ) -probe_hwif_init (&ide_hwifs[index_list.b.high]); +probe_pci_hwif_init (&ide_hwifs[index_list.b.high], d);if ((index_list2.b.low &0xf0 ) !=0xf0 ) -probe_hwif_init (&ide_hwifs[index_list2.b.low]); +probe_pci_hwif_init (&ide_hwifs[index_list2.b.low], d);if ((index_list2.b.high &0xf0 ) !=0xf0 ) -probe_hwif_init (&ide_hwifs[index_list2.b.high]); +probe_pci_hwif_init (&ide_hwifs[index_list2.b.high], d);create_proc_ide_interfaces (); }
Quoted 15 lines · Alan Cox
Using the ->fixup field that was added we propogate the fixup functionality into PCI interfaces. The fixup needs to be in the data structure really as interfaces may be hotplugged/unplugged [plugged only in base kernel].
The PCI interfaces stay the same so no driver changes are needed except to use the fixup hook.diff --exclude-from
/usr/src/exclude-u --new-file --recursivelinux.vanilla-2.6.10rc1/drivers/ide/setup-pci.clinux-2.6.10rc1/drivers/ide/setup-pci.cdrivers/ide/setup-pci.c +1
-0@@ -729,14 +729,26 @@return index; } +/**
drivers/ide/setup-pci.c line 742
Quoted 10 lines
drivers/ide/setup-pci.c +10
-0+* probe_pci_hwif_init - probe the hwif then allow fixups +* @hwif: interface to probe +* @d: PCI device +* +* Perform the generic probe and if it is successful invoke any +* remaining post probe fixup logic in the driver itself. +*/ +static void probe_pci_hwif_init (ide_hwif_t *hwif,ide_pci_device_t *d) { +probe_hwif_init_with_fixup (hwif, d->fixup); +}
this wrapper is not needed
Quoted 8 lines
drivers/ide/setup-pci.c +1
-2@@ -749,13 +761,13 @@ata_index_t index_list2 =do_ide_setup_pci_device (dev2, d,0 );if ((index_list.b.low &0xf0 ) !=0xf0 ) -probe_hwif_init (&ide_hwifs[index_list.b.low]); +probe_pci_hwif_init (&ide_hwifs[index_list.b.low], d);if ((index_list.b.high &0xf0 ) !=0xf0 ) -probe_hwif_init (&ide_hwifs[index_list.b.high]);
drivers/ide/setup-pci.c line 773
Quoted 10 lines
drivers/ide/setup-pci.c +3
-2+probe_pci_hwif_init (&ide_hwifs[index_list.b.high], d);if ((index_list2.b.low &0xf0 ) !=0xf0 ) -probe_hwif_init (&ide_hwifs[index_list2.b.low]); +probe_pci_hwif_init (&ide_hwifs[index_list2.b.low], d);if ((index_list2.b.high &0xf0 ) !=0xf0 ) -probe_hwif_init (&ide_hwifs[index_list2.b.high]); +probe_pci_hwif_init (&ide_hwifs[index_list2.b.high], d);create_proc_ide_interfaces (); }
this chunk is not needed
Quoted 8 lines · Bartlomiej Zolnierkiewicz
drivers/ide/setup-pci.c line 742
Quoted 6 lines
+ * Perform the generic probe and if it is successful invoke any
+ * remaining post probe fixup logic in the driver itself.
+ */drivers/ide/setup-pci.c +3
-0+static void probe_pci_hwif_init (ide_hwif_t *hwif,ide_pci_device_t *d) { +probe_hwif_init_with_fixup (hwif, d->fixup); +}this wrapper is not needed
True
Quoted 16 lines
Quoted 16 lines
drivers/ide/setup-pci.c +4
-4@@ -749,13 +761,13 @@ata_index_t index_list2 =do_ide_setup_pci_device (dev2, d,0 );if ((index_list.b.low &0xf0 ) !=0xf0 ) -probe_hwif_init (&ide_hwifs[index_list.b.low]); +probe_pci_hwif_init (&ide_hwifs[index_list.b.low], d);if ((index_list.b.high &0xf0 ) !=0xf0 ) -probe_hwif_init (&ide_hwifs[index_list.b.high]); +probe_pci_hwif_init (&ide_hwifs[index_list.b.high], d);if ((index_list2.b.low &0xf0 ) !=0xf0 ) -probe_hwif_init (&ide_hwifs[index_list2.b.low]); +probe_pci_hwif_init (&ide_hwifs[index_list2.b.low], d);if ((index_list2.b.high &0xf0 ) !=0xf0 ) -probe_hwif_init (&ide_hwifs[index_list2.b.high]); +probe_pci_hwif_init (&ide_hwifs[index_list2.b.high], d);
Quoted 4 lines
Review line 773
Quoted 2 lines
(quoted diff) +0
-0create_proc_ide_interfaces(); }this chunk is not needed
Disagree. Look more carefully - we always need to pass d so we can pass d->fixup
Quoted 28 lines · Alan Cox
Quoted 8 lines · Bartlomiej Zolnierkiewicz
drivers/ide/setup-pci.c line 742
Quoted 6 lines
+ * Perform the generic probe and if it is successful invoke any
+ * remaining post probe fixup logic in the driver itself.
+ */drivers/ide/setup-pci.c +3
-0+static void probe_pci_hwif_init (ide_hwif_t *hwif,ide_pci_device_t *d) { +probe_hwif_init_with_fixup (hwif, d->fixup); +}this wrapper is not needed
True
Quoted 16 lines
Quoted 16 lines
drivers/ide/setup-pci.c +4
-4@@ -749,13 +761,13 @@ata_index_t index_list2 =do_ide_setup_pci_device (dev2, d,0 );if ((index_list.b.low &0xf0 ) !=0xf0 ) -probe_hwif_init (&ide_hwifs[index_list.b.low]); +probe_pci_hwif_init (&ide_hwifs[index_list.b.low], d);if ((index_list.b.high &0xf0 ) !=0xf0 ) -probe_hwif_init (&ide_hwifs[index_list.b.high]); +probe_pci_hwif_init (&ide_hwifs[index_list.b.high], d);if ((index_list2.b.low &0xf0 ) !=0xf0 ) -probe_hwif_init (&ide_hwifs[index_list2.b.low]); +probe_pci_hwif_init (&ide_hwifs[index_list2.b.low], d);if ((index_list2.b.high &0xf0 ) !=0xf0 ) -probe_hwif_init (&ide_hwifs[index_list2.b.high]); +probe_pci_hwif_init (&ide_hwifs[index_list2.b.high], d);
Quoted 7 lines
Quoted 4 lines
Review line 773
Quoted 2 lines
(quoted diff) +0
-0create_proc_ide_interfaces(); }this chunk is not needed
Disagree. Look more carefully - we always need to pass d so we can pass
d->fixup
siimage is the only user of d->fixup right now,
it doesn't use ide_setup_pci_devices()
Quoted 7 lines · Bartlomiej Zolnierkiewicz
Quoted 4 lines
Quoted 1 line
this chunk is not needed
Disagree. Look more carefully - we always need to pass d so we can pass
d->fixupsiimage is the only user of
d->fixupright now,
it doesn't useide_setup_pci_devices()
If you think having the two API's differ in whether d->fixup is honoured is good then I must disagree strongly with your taste in API's - you are asking for the first person expecting it to work to get burned
Quoted 6 lines · Alan Cox
Quoted 5 lines · Bartlomiej Zolnierkiewicz
Quoted 4 lines
Quoted 1 line
this chunk is not needed
Disagree. Look more carefully - we always need to pass d so we can pass
d->fixup
Quoted 6 lines
Quoted 2 lines
siimage is the only user of
d->fixupright now,
it doesn't useide_setup_pci_devices()If you think having the two API's differ in whether
d->fixupis honoured is good then I must disagree strongly with your taste in API's - you are asking for the first person expecting it to work to get burned
OK, I agree and I will fix that.