[PATCH] Fix the case of multiple HPT3xx chips present

Sergei Shtylyov
2006-05-02T22:27:43Z

[-- Attachment #1: Type: text/plain, Size: 335 bytes --]

Hello.

init_chipset_hpt366() modifies some fields of the ide_pci_device_t
structure depending on the chip's revision, so pass it a copy of the structure
to avoid issues when multiple different chips are present.
Should apply on top of the hotswap fix.

MBR, Sergei

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

[-- Attachment #2: HPT3xx-fix-case-of-multiple-chips.patch --]
[-- Type: text/plain, Size: 1291 bytes --]

Index: linus/drivers/ide/pci/hpt366.c
===================================================================
--- linus.orig/drivers/ide/pci/hpt366.c
+++ linus/drivers/ide/pci/hpt366.c
@@ -73,6 +73,8 @@
* really for 50 MHz; switch to using HPT372 tables for HPT374...
* - fix the hotswap code: it caused RESET- to glitch when tristating the bus,
* and for HPT36x the obsolete HDIO_TRISTATE_HWIF handler was called instead
+ * - pass to init_chipset() handlers a copy of the IDE PCI device structure as
+ * they tamper with its fields
* <source@mvista.com>
*
*/
@@ -1621,13 +1623,16 @@ static ide_pci_device_t hpt366_chipsets[
*
* Called when the PCI registration layer (or the IDE initialization)
* finds a device matching our IDE device tables.
+ *
+ * NOTE: since we'll have to modify some fields of the ide_pci_device_t
+ * structure depending on the chip's revision, we'd better pass a local
+ * copy down the call chain...
*/
-
static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
- ide_pci_device_t *d = &hpt366_chipsets[id->driver_data];
+ ide_pci_device_t d = hpt366_chipsets[id->driver_data];

- return d->init_setup(dev, d);
+ return d.init_setup(dev, &d);
}

static struct pci_device_id hpt366_pci_tbl[] = {