diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-24 18:22:41 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-24 18:22:41 -0400 |
commit | 7ed5b157d9dff55bf477b4c8b4708d5d45476677 (patch) | |
tree | cbfd113108efd3b4d0b634f02ca8f09e99b7fdc7 /drivers/ide/ide-probe.c | |
parent | 8cd3c605624035b7f57deb8894e17c5ba6d05b2e (diff) |
ide: add ide_for_each_present_dev() iterator
* Add ide_for_each_present_dev() iterator and convert IDE code to use it.
* Do some drive-by CodingStyle fixups in ide-acpi.c while at it.
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-probe.c')
-rw-r--r-- | drivers/ide/ide-probe.c | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 5deb7e717333..eb0a38cd83ce 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -825,22 +825,18 @@ static void ide_port_tune_devices(ide_hwif_t *hwif) | |||
825 | ide_drive_t *drive; | 825 | ide_drive_t *drive; |
826 | int i; | 826 | int i; |
827 | 827 | ||
828 | ide_port_for_each_dev(i, drive, hwif) { | 828 | ide_port_for_each_present_dev(i, drive, hwif) { |
829 | if (drive->dev_flags & IDE_DFLAG_PRESENT) { | 829 | if (port_ops && port_ops->quirkproc) |
830 | if (port_ops && port_ops->quirkproc) | 830 | port_ops->quirkproc(drive); |
831 | port_ops->quirkproc(drive); | ||
832 | } | ||
833 | } | 831 | } |
834 | 832 | ||
835 | ide_port_for_each_dev(i, drive, hwif) { | 833 | ide_port_for_each_present_dev(i, drive, hwif) { |
836 | if (drive->dev_flags & IDE_DFLAG_PRESENT) { | 834 | ide_set_max_pio(drive); |
837 | ide_set_max_pio(drive); | ||
838 | 835 | ||
839 | drive->dev_flags |= IDE_DFLAG_NICE1; | 836 | drive->dev_flags |= IDE_DFLAG_NICE1; |
840 | 837 | ||
841 | if (hwif->dma_ops) | 838 | if (hwif->dma_ops) |
842 | ide_set_dma(drive); | 839 | ide_set_dma(drive); |
843 | } | ||
844 | } | 840 | } |
845 | } | 841 | } |
846 | 842 | ||
@@ -911,10 +907,7 @@ static int ide_port_setup_devices(ide_hwif_t *hwif) | |||
911 | int i, j = 0; | 907 | int i, j = 0; |
912 | 908 | ||
913 | mutex_lock(&ide_cfg_mtx); | 909 | mutex_lock(&ide_cfg_mtx); |
914 | ide_port_for_each_dev(i, drive, hwif) { | 910 | ide_port_for_each_present_dev(i, drive, hwif) { |
915 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) | ||
916 | continue; | ||
917 | |||
918 | if (ide_init_queue(drive)) { | 911 | if (ide_init_queue(drive)) { |
919 | printk(KERN_ERR "ide: failed to init %s\n", | 912 | printk(KERN_ERR "ide: failed to init %s\n", |
920 | drive->name); | 913 | drive->name); |
@@ -1139,13 +1132,10 @@ static void hwif_register_devices(ide_hwif_t *hwif) | |||
1139 | ide_drive_t *drive; | 1132 | ide_drive_t *drive; |
1140 | unsigned int i; | 1133 | unsigned int i; |
1141 | 1134 | ||
1142 | ide_port_for_each_dev(i, drive, hwif) { | 1135 | ide_port_for_each_present_dev(i, drive, hwif) { |
1143 | struct device *dev = &drive->gendev; | 1136 | struct device *dev = &drive->gendev; |
1144 | int ret; | 1137 | int ret; |
1145 | 1138 | ||
1146 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) | ||
1147 | continue; | ||
1148 | |||
1149 | dev_set_name(dev, "%u.%u", hwif->index, i); | 1139 | dev_set_name(dev, "%u.%u", hwif->index, i); |
1150 | dev->parent = &hwif->gendev; | 1140 | dev->parent = &hwif->gendev; |
1151 | dev->bus = &ide_bus_type; | 1141 | dev->bus = &ide_bus_type; |
@@ -1610,11 +1600,9 @@ static void __ide_port_unregister_devices(ide_hwif_t *hwif) | |||
1610 | ide_drive_t *drive; | 1600 | ide_drive_t *drive; |
1611 | int i; | 1601 | int i; |
1612 | 1602 | ||
1613 | ide_port_for_each_dev(i, drive, hwif) { | 1603 | ide_port_for_each_present_dev(i, drive, hwif) { |
1614 | if (drive->dev_flags & IDE_DFLAG_PRESENT) { | 1604 | device_unregister(&drive->gendev); |
1615 | device_unregister(&drive->gendev); | 1605 | wait_for_completion(&drive->gendev_rel_comp); |
1616 | wait_for_completion(&drive->gendev_rel_comp); | ||
1617 | } | ||
1618 | } | 1606 | } |
1619 | } | 1607 | } |
1620 | 1608 | ||