diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-10-18 18:30:09 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-10-18 18:30:09 -0400 |
commit | 7ed5829758d8d6c5486ec54fb4414b7683541fad (patch) | |
tree | 48024a11dbdf78251b22238a39bac46044faa5e9 /drivers/ide/pci | |
parent | aaf707f061d5d87c9f671caa2904cd41c1c1a99e (diff) |
serverworks: remove ->init_setup
Merge init_setup_{svwks,csb6}() into svwks_init_one().
While at it:
* Remove redundant dev->device checks.
* Operate on a local copy of serverworks_chipsets[] entry.
* Use pci_resource_start().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci')
-rw-r--r-- | drivers/ide/pci/serverworks.c | 45 |
1 files changed, 14 insertions, 31 deletions
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index 760e0e3e118e..c506b8bc4bcd 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c | |||
@@ -379,34 +379,9 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif) | |||
379 | } | 379 | } |
380 | } | 380 | } |
381 | 381 | ||
382 | static int __devinit init_setup_svwks (struct pci_dev *dev, ide_pci_device_t *d) | ||
383 | { | ||
384 | return ide_setup_pci_device(dev, d); | ||
385 | } | ||
386 | |||
387 | static int __devinit init_setup_csb6 (struct pci_dev *dev, ide_pci_device_t *d) | ||
388 | { | ||
389 | if (!(PCI_FUNC(dev->devfn) & 1)) { | ||
390 | if (dev->resource[0].start == 0x01f1) | ||
391 | d->host_flags |= IDE_HFLAG_BOOTABLE; | ||
392 | else | ||
393 | d->host_flags &= ~IDE_HFLAG_BOOTABLE; | ||
394 | } | ||
395 | |||
396 | if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE || | ||
397 | dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) && | ||
398 | (!(PCI_FUNC(dev->devfn) & 1))) | ||
399 | d->host_flags |= IDE_HFLAG_SINGLE; | ||
400 | else | ||
401 | d->host_flags &= ~IDE_HFLAG_SINGLE; | ||
402 | |||
403 | return ide_setup_pci_device(dev, d); | ||
404 | } | ||
405 | |||
406 | static ide_pci_device_t serverworks_chipsets[] __devinitdata = { | 382 | static ide_pci_device_t serverworks_chipsets[] __devinitdata = { |
407 | { /* 0 */ | 383 | { /* 0 */ |
408 | .name = "SvrWks OSB4", | 384 | .name = "SvrWks OSB4", |
409 | .init_setup = init_setup_svwks, | ||
410 | .init_chipset = init_chipset_svwks, | 385 | .init_chipset = init_chipset_svwks, |
411 | .init_hwif = init_hwif_svwks, | 386 | .init_hwif = init_hwif_svwks, |
412 | .host_flags = IDE_HFLAG_BOOTABLE, | 387 | .host_flags = IDE_HFLAG_BOOTABLE, |
@@ -415,7 +390,6 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = { | |||
415 | .udma_mask = 0x00, /* UDMA is problematic on OSB4 */ | 390 | .udma_mask = 0x00, /* UDMA is problematic on OSB4 */ |
416 | },{ /* 1 */ | 391 | },{ /* 1 */ |
417 | .name = "SvrWks CSB5", | 392 | .name = "SvrWks CSB5", |
418 | .init_setup = init_setup_svwks, | ||
419 | .init_chipset = init_chipset_svwks, | 393 | .init_chipset = init_chipset_svwks, |
420 | .init_hwif = init_hwif_svwks, | 394 | .init_hwif = init_hwif_svwks, |
421 | .host_flags = IDE_HFLAG_BOOTABLE, | 395 | .host_flags = IDE_HFLAG_BOOTABLE, |
@@ -424,7 +398,6 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = { | |||
424 | .udma_mask = ATA_UDMA5, | 398 | .udma_mask = ATA_UDMA5, |
425 | },{ /* 2 */ | 399 | },{ /* 2 */ |
426 | .name = "SvrWks CSB6", | 400 | .name = "SvrWks CSB6", |
427 | .init_setup = init_setup_csb6, | ||
428 | .init_chipset = init_chipset_svwks, | 401 | .init_chipset = init_chipset_svwks, |
429 | .init_hwif = init_hwif_svwks, | 402 | .init_hwif = init_hwif_svwks, |
430 | .host_flags = IDE_HFLAG_BOOTABLE, | 403 | .host_flags = IDE_HFLAG_BOOTABLE, |
@@ -433,7 +406,6 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = { | |||
433 | .udma_mask = ATA_UDMA5, | 406 | .udma_mask = ATA_UDMA5, |
434 | },{ /* 3 */ | 407 | },{ /* 3 */ |
435 | .name = "SvrWks CSB6", | 408 | .name = "SvrWks CSB6", |
436 | .init_setup = init_setup_csb6, | ||
437 | .init_chipset = init_chipset_svwks, | 409 | .init_chipset = init_chipset_svwks, |
438 | .init_hwif = init_hwif_svwks, | 410 | .init_hwif = init_hwif_svwks, |
439 | .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_BOOTABLE, | 411 | .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_BOOTABLE, |
@@ -442,7 +414,6 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = { | |||
442 | .udma_mask = ATA_UDMA5, | 414 | .udma_mask = ATA_UDMA5, |
443 | },{ /* 4 */ | 415 | },{ /* 4 */ |
444 | .name = "SvrWks HT1000", | 416 | .name = "SvrWks HT1000", |
445 | .init_setup = init_setup_svwks, | ||
446 | .init_chipset = init_chipset_svwks, | 417 | .init_chipset = init_chipset_svwks, |
447 | .init_hwif = init_hwif_svwks, | 418 | .init_hwif = init_hwif_svwks, |
448 | .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_BOOTABLE, | 419 | .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_BOOTABLE, |
@@ -463,9 +434,21 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = { | |||
463 | 434 | ||
464 | static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 435 | static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
465 | { | 436 | { |
466 | ide_pci_device_t *d = &serverworks_chipsets[id->driver_data]; | 437 | ide_pci_device_t d; |
438 | u8 idx = id->driver_data; | ||
439 | |||
440 | d = serverworks_chipsets[idx]; | ||
441 | |||
442 | if (idx == 2 || idx == 3) { | ||
443 | if ((PCI_FUNC(dev->devfn) & 1) == 0) { | ||
444 | if (pci_resource_start(dev, 0) != 0x01f1) | ||
445 | d.host_flags &= ~IDE_HFLAG_BOOTABLE; | ||
446 | d.host_flags |= IDE_HFLAG_SINGLE; | ||
447 | } else | ||
448 | d.host_flags &= ~IDE_HFLAG_SINGLE; | ||
449 | } | ||
467 | 450 | ||
468 | return d->init_setup(dev, d); | 451 | return ide_setup_pci_device(dev, &d); |
469 | } | 452 | } |
470 | 453 | ||
471 | static const struct pci_device_id svwks_pci_tbl[] = { | 454 | static const struct pci_device_id svwks_pci_tbl[] = { |