diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-12-29 14:27:33 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-12-29 14:27:33 -0500 |
commit | 7f1ac8c4b9dadc55ec656b368f5f470f2cbe3083 (patch) | |
tree | 75878c029a629bd938b3744dc2505b1ac78516ea /drivers/ide/rz1000.c | |
parent | f58c1ab8deebc2360cef998f169a6727c288210f (diff) |
rz1000: apply chipset quirks early (v2)
* Use pci_name(dev) instead of hwif->name in init_hwif_rz1000().
* init_hwif_rz1000() -> rz1000_init_chipset(). Update rz1000_init_one()
to use rz1000_init_chipset() and add now required rz1000_remove().
* Remove superfluous ide_rz1000 chipset type.
v2:
* unsigned int rz1000_init_chipset() -> int rz1000_disable_readahead()
per Sergei's suggestion.
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/rz1000.c')
-rw-r--r-- | drivers/ide/rz1000.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/drivers/ide/rz1000.c b/drivers/ide/rz1000.c index 7daf0135cbac..a6414a884eb1 100644 --- a/drivers/ide/rz1000.c +++ b/drivers/ide/rz1000.c | |||
@@ -22,34 +22,48 @@ | |||
22 | 22 | ||
23 | #define DRV_NAME "rz1000" | 23 | #define DRV_NAME "rz1000" |
24 | 24 | ||
25 | static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) | 25 | static int __devinit rz1000_disable_readahead(struct pci_dev *dev) |
26 | { | 26 | { |
27 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
28 | u16 reg; | 27 | u16 reg; |
29 | 28 | ||
30 | if (!pci_read_config_word (dev, 0x40, ®) && | 29 | if (!pci_read_config_word (dev, 0x40, ®) && |
31 | !pci_write_config_word(dev, 0x40, reg & 0xdfff)) { | 30 | !pci_write_config_word(dev, 0x40, reg & 0xdfff)) { |
32 | printk(KERN_INFO "%s: disabled chipset read-ahead " | 31 | printk(KERN_INFO "%s: disabled chipset read-ahead " |
33 | "(buggy RZ1000/RZ1001)\n", hwif->name); | 32 | "(buggy RZ1000/RZ1001)\n", pci_name(dev)); |
33 | return 0; | ||
34 | } else { | 34 | } else { |
35 | if (hwif->mate) | ||
36 | hwif->mate->serialized = hwif->serialized = 1; | ||
37 | hwif->host_flags |= IDE_HFLAG_NO_UNMASK_IRQS; | ||
38 | printk(KERN_INFO "%s: serialized, disabled unmasking " | 35 | printk(KERN_INFO "%s: serialized, disabled unmasking " |
39 | "(buggy RZ1000/RZ1001)\n", hwif->name); | 36 | "(buggy RZ1000/RZ1001)\n", pci_name(dev)); |
37 | return 1; | ||
40 | } | 38 | } |
41 | } | 39 | } |
42 | 40 | ||
43 | static const struct ide_port_info rz1000_chipset __devinitdata = { | 41 | static const struct ide_port_info rz1000_chipset __devinitdata = { |
44 | .name = DRV_NAME, | 42 | .name = DRV_NAME, |
45 | .init_hwif = init_hwif_rz1000, | ||
46 | .chipset = ide_rz1000, | ||
47 | .host_flags = IDE_HFLAG_NO_DMA, | 43 | .host_flags = IDE_HFLAG_NO_DMA, |
48 | }; | 44 | }; |
49 | 45 | ||
50 | static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 46 | static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
51 | { | 47 | { |
52 | return ide_pci_init_one(dev, &rz1000_chipset, NULL); | 48 | struct ide_port_info d = rz1000_chipset; |
49 | int rc; | ||
50 | |||
51 | rc = pci_enable_device(dev); | ||
52 | if (rc) | ||
53 | return rc; | ||
54 | |||
55 | if (rz1000_disable_readahead(dev)) { | ||
56 | d.host_flags |= IDE_HFLAG_SERIALIZE; | ||
57 | d.host_flags |= IDE_HFLAG_NO_UNMASK_IRQS; | ||
58 | } | ||
59 | |||
60 | return ide_pci_init_one(dev, &d, NULL); | ||
61 | } | ||
62 | |||
63 | static void rz1000_remove(struct pci_dev *dev) | ||
64 | { | ||
65 | ide_pci_remove(dev); | ||
66 | pci_disable_device(dev); | ||
53 | } | 67 | } |
54 | 68 | ||
55 | static const struct pci_device_id rz1000_pci_tbl[] = { | 69 | static const struct pci_device_id rz1000_pci_tbl[] = { |
@@ -63,7 +77,7 @@ static struct pci_driver rz1000_pci_driver = { | |||
63 | .name = "RZ1000_IDE", | 77 | .name = "RZ1000_IDE", |
64 | .id_table = rz1000_pci_tbl, | 78 | .id_table = rz1000_pci_tbl, |
65 | .probe = rz1000_init_one, | 79 | .probe = rz1000_init_one, |
66 | .remove = ide_pci_remove, | 80 | .remove = rz1000_remove, |
67 | }; | 81 | }; |
68 | 82 | ||
69 | static int __init rz1000_ide_init(void) | 83 | static int __init rz1000_ide_init(void) |