[PATCH] ide: fix the case of multiple HPT3xx chips present

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.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Sergei Shtylyov and committed by
Linus Torvalds
73d1dd93 33b18a60

+8 -3
+8 -3
drivers/ide/pci/hpt366.c
··· 72 72 * table in which the mode lookup is done 73 73 * - fix the hotswap code: it caused RESET- to glitch when tristating the bus, 74 74 * and for HPT36x the obsolete HDIO_TRISTATE_HWIF handler was called instead 75 + * - pass to init_chipset() handlers a copy of the IDE PCI device structure as 76 + * they tamper with its fields 75 77 * <source@mvista.com> 76 78 * 77 79 */ ··· 1566 1564 * 1567 1565 * Called when the PCI registration layer (or the IDE initialization) 1568 1566 * finds a device matching our IDE device tables. 1567 + * 1568 + * NOTE: since we'll have to modify some fields of the ide_pci_device_t 1569 + * structure depending on the chip's revision, we'd better pass a local 1570 + * copy down the call chain... 1569 1571 */ 1570 - 1571 1572 static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_device_id *id) 1572 1573 { 1573 - ide_pci_device_t *d = &hpt366_chipsets[id->driver_data]; 1574 + ide_pci_device_t d = hpt366_chipsets[id->driver_data]; 1574 1575 1575 - return d->init_setup(dev, d); 1576 + return d.init_setup(dev, &d); 1576 1577 } 1577 1578 1578 1579 static struct pci_device_id hpt366_pci_tbl[] = {