diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ide/pci/via82cxxx.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index 2f22abfe003b..a8c050b462bc 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c | |||
@@ -113,7 +113,8 @@ struct via82cxxx_dev | |||
113 | static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing) | 113 | static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing) |
114 | { | 114 | { |
115 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 115 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
116 | struct via82cxxx_dev *vdev = pci_get_drvdata(dev); | 116 | struct ide_host *host = pci_get_drvdata(dev); |
117 | struct via82cxxx_dev *vdev = host->host_priv; | ||
117 | u8 t; | 118 | u8 t; |
118 | 119 | ||
119 | if (~vdev->via_config->flags & VIA_BAD_AST) { | 120 | if (~vdev->via_config->flags & VIA_BAD_AST) { |
@@ -153,7 +154,8 @@ static void via_set_drive(ide_drive_t *drive, const u8 speed) | |||
153 | ide_hwif_t *hwif = drive->hwif; | 154 | ide_hwif_t *hwif = drive->hwif; |
154 | ide_drive_t *peer = hwif->drives + (~drive->dn & 1); | 155 | ide_drive_t *peer = hwif->drives + (~drive->dn & 1); |
155 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 156 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
156 | struct via82cxxx_dev *vdev = pci_get_drvdata(dev); | 157 | struct ide_host *host = pci_get_drvdata(dev); |
158 | struct via82cxxx_dev *vdev = host->host_priv; | ||
157 | struct ide_timing t, p; | 159 | struct ide_timing t, p; |
158 | unsigned int T, UT; | 160 | unsigned int T, UT; |
159 | 161 | ||
@@ -266,19 +268,13 @@ static void __devinit via_cable_detect(struct via82cxxx_dev *vdev, u32 u) | |||
266 | 268 | ||
267 | static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const char *name) | 269 | static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const char *name) |
268 | { | 270 | { |
271 | struct ide_host *host = pci_get_drvdata(dev); | ||
272 | struct via82cxxx_dev *vdev = host->host_priv; | ||
269 | struct pci_dev *isa = NULL; | 273 | struct pci_dev *isa = NULL; |
270 | struct via82cxxx_dev *vdev; | ||
271 | struct via_isa_bridge *via_config; | 274 | struct via_isa_bridge *via_config; |
272 | u8 t, v; | 275 | u8 t, v; |
273 | u32 u; | 276 | u32 u; |
274 | 277 | ||
275 | vdev = kzalloc(sizeof(*vdev), GFP_KERNEL); | ||
276 | if (!vdev) { | ||
277 | printk(KERN_ERR "VP_IDE: out of memory :(\n"); | ||
278 | return -ENOMEM; | ||
279 | } | ||
280 | pci_set_drvdata(dev, vdev); | ||
281 | |||
282 | /* | 278 | /* |
283 | * Find the ISA bridge to see how good the IDE is. | 279 | * Find the ISA bridge to see how good the IDE is. |
284 | */ | 280 | */ |
@@ -402,7 +398,8 @@ static int via_cable_override(struct pci_dev *pdev) | |||
402 | static u8 __devinit via82cxxx_cable_detect(ide_hwif_t *hwif) | 398 | static u8 __devinit via82cxxx_cable_detect(ide_hwif_t *hwif) |
403 | { | 399 | { |
404 | struct pci_dev *pdev = to_pci_dev(hwif->dev); | 400 | struct pci_dev *pdev = to_pci_dev(hwif->dev); |
405 | struct via82cxxx_dev *vdev = pci_get_drvdata(pdev); | 401 | struct ide_host *host = pci_get_drvdata(pdev); |
402 | struct via82cxxx_dev *vdev = host->host_priv; | ||
406 | 403 | ||
407 | if (via_cable_override(pdev)) | 404 | if (via_cable_override(pdev)) |
408 | return ATA_CBL_PATA40_SHORT; | 405 | return ATA_CBL_PATA40_SHORT; |
@@ -436,6 +433,8 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i | |||
436 | { | 433 | { |
437 | struct pci_dev *isa = NULL; | 434 | struct pci_dev *isa = NULL; |
438 | struct via_isa_bridge *via_config; | 435 | struct via_isa_bridge *via_config; |
436 | struct via82cxxx_dev *vdev; | ||
437 | int rc; | ||
439 | u8 idx = id->driver_data; | 438 | u8 idx = id->driver_data; |
440 | struct ide_port_info d; | 439 | struct ide_port_info d; |
441 | 440 | ||
@@ -466,7 +465,17 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i | |||
466 | 465 | ||
467 | d.udma_mask = via_config->udma_mask; | 466 | d.udma_mask = via_config->udma_mask; |
468 | 467 | ||
469 | return ide_pci_init_one(dev, &d, NULL); | 468 | vdev = kzalloc(sizeof(*vdev), GFP_KERNEL); |
469 | if (!vdev) { | ||
470 | printk(KERN_ERR "VP_IDE: out of memory :(\n"); | ||
471 | return -ENOMEM; | ||
472 | } | ||
473 | |||
474 | rc = ide_pci_init_one(dev, &d, vdev); | ||
475 | if (rc) | ||
476 | kfree(vdev); | ||
477 | |||
478 | return rc; | ||
470 | } | 479 | } |
471 | 480 | ||
472 | static const struct pci_device_id via_pci_tbl[] = { | 481 | static const struct pci_device_id via_pci_tbl[] = { |