diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:36 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:36 -0400 |
commit | 97100fc816badbbc162644cfde7ad39ae9211fb4 (patch) | |
tree | 904faf5453c2dea32fa3fde5fda230118f3effda /drivers/ide/ide.c | |
parent | be3c096ebdbe3c828aacb5473751a22840753eff (diff) |
ide: add device flags
Add 'unsigned long dev_flags' to ide_drive_t and convert bitfields
to IDE_DFLAG_* flags.
While at it:
- IDE_DFLAG_ADDRESSING -> IDE_DFLAG_LBA48
- fixup some comments
- remove needless g->flags zeroing from ide*_probe()
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide.c')
-rw-r--r-- | drivers/ide/ide.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 64997873b6d7..78776bbb537e 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -138,7 +138,7 @@ static void __ide_port_unregister_devices(ide_hwif_t *hwif) | |||
138 | for (i = 0; i < MAX_DRIVES; i++) { | 138 | for (i = 0; i < MAX_DRIVES; i++) { |
139 | ide_drive_t *drive = &hwif->drives[i]; | 139 | ide_drive_t *drive = &hwif->drives[i]; |
140 | 140 | ||
141 | if (drive->present) { | 141 | if (drive->dev_flags & IDE_DFLAG_PRESENT) { |
142 | spin_unlock_irq(&ide_lock); | 142 | spin_unlock_irq(&ide_lock); |
143 | device_unregister(&drive->gendev); | 143 | device_unregister(&drive->gendev); |
144 | wait_for_completion(&drive->gendev_rel_comp); | 144 | wait_for_completion(&drive->gendev_rel_comp); |
@@ -254,7 +254,7 @@ ide_devset_get(io_32bit, io_32bit); | |||
254 | 254 | ||
255 | static int set_io_32bit(ide_drive_t *drive, int arg) | 255 | static int set_io_32bit(ide_drive_t *drive, int arg) |
256 | { | 256 | { |
257 | if (drive->no_io_32bit) | 257 | if (drive->dev_flags & IDE_DFLAG_NO_IO_32BIT) |
258 | return -EPERM; | 258 | return -EPERM; |
259 | 259 | ||
260 | if (arg < 0 || arg > 1 + (SUPPORT_VLB_SYNC << 1)) | 260 | if (arg < 0 || arg > 1 + (SUPPORT_VLB_SYNC << 1)) |
@@ -265,19 +265,22 @@ static int set_io_32bit(ide_drive_t *drive, int arg) | |||
265 | return 0; | 265 | return 0; |
266 | } | 266 | } |
267 | 267 | ||
268 | ide_devset_get(ksettings, keep_settings); | 268 | ide_devset_get_flag(ksettings, IDE_DFLAG_KEEP_SETTINGS); |
269 | 269 | ||
270 | static int set_ksettings(ide_drive_t *drive, int arg) | 270 | static int set_ksettings(ide_drive_t *drive, int arg) |
271 | { | 271 | { |
272 | if (arg < 0 || arg > 1) | 272 | if (arg < 0 || arg > 1) |
273 | return -EINVAL; | 273 | return -EINVAL; |
274 | 274 | ||
275 | drive->keep_settings = arg; | 275 | if (arg) |
276 | drive->dev_flags |= IDE_DFLAG_KEEP_SETTINGS; | ||
277 | else | ||
278 | drive->dev_flags &= ~IDE_DFLAG_KEEP_SETTINGS; | ||
276 | 279 | ||
277 | return 0; | 280 | return 0; |
278 | } | 281 | } |
279 | 282 | ||
280 | ide_devset_get(using_dma, using_dma); | 283 | ide_devset_get_flag(using_dma, IDE_DFLAG_USING_DMA); |
281 | 284 | ||
282 | static int set_using_dma(ide_drive_t *drive, int arg) | 285 | static int set_using_dma(ide_drive_t *drive, int arg) |
283 | { | 286 | { |
@@ -339,17 +342,20 @@ static int set_pio_mode(ide_drive_t *drive, int arg) | |||
339 | return 0; | 342 | return 0; |
340 | } | 343 | } |
341 | 344 | ||
342 | ide_devset_get(unmaskirq, unmask); | 345 | ide_devset_get_flag(unmaskirq, IDE_DFLAG_UNMASK); |
343 | 346 | ||
344 | static int set_unmaskirq(ide_drive_t *drive, int arg) | 347 | static int set_unmaskirq(ide_drive_t *drive, int arg) |
345 | { | 348 | { |
346 | if (drive->no_unmask) | 349 | if (drive->dev_flags & IDE_DFLAG_NO_UNMASK) |
347 | return -EPERM; | 350 | return -EPERM; |
348 | 351 | ||
349 | if (arg < 0 || arg > 1) | 352 | if (arg < 0 || arg > 1) |
350 | return -EINVAL; | 353 | return -EINVAL; |
351 | 354 | ||
352 | drive->unmask = arg; | 355 | if (arg) |
356 | drive->dev_flags |= IDE_DFLAG_UNMASK; | ||
357 | else | ||
358 | drive->dev_flags &= ~IDE_DFLAG_UNMASK; | ||
353 | 359 | ||
354 | return 0; | 360 | return 0; |
355 | } | 361 | } |
@@ -713,16 +719,16 @@ static void ide_dev_apply_params(ide_drive_t *drive) | |||
713 | 719 | ||
714 | if (ide_nodma & (1 << i)) { | 720 | if (ide_nodma & (1 << i)) { |
715 | printk(KERN_INFO "ide: disallowing DMA for %s\n", drive->name); | 721 | printk(KERN_INFO "ide: disallowing DMA for %s\n", drive->name); |
716 | drive->nodma = 1; | 722 | drive->dev_flags |= IDE_DFLAG_NODMA; |
717 | } | 723 | } |
718 | if (ide_noflush & (1 << i)) { | 724 | if (ide_noflush & (1 << i)) { |
719 | printk(KERN_INFO "ide: disabling flush requests for %s\n", | 725 | printk(KERN_INFO "ide: disabling flush requests for %s\n", |
720 | drive->name); | 726 | drive->name); |
721 | drive->noflush = 1; | 727 | drive->dev_flags |= IDE_DFLAG_NOFLUSH; |
722 | } | 728 | } |
723 | if (ide_noprobe & (1 << i)) { | 729 | if (ide_noprobe & (1 << i)) { |
724 | printk(KERN_INFO "ide: skipping probe for %s\n", drive->name); | 730 | printk(KERN_INFO "ide: skipping probe for %s\n", drive->name); |
725 | drive->noprobe = 1; | 731 | drive->dev_flags |= IDE_DFLAG_NOPROBE; |
726 | } | 732 | } |
727 | if (ide_nowerr & (1 << i)) { | 733 | if (ide_nowerr & (1 << i)) { |
728 | printk(KERN_INFO "ide: ignoring the ATA_DF bit for %s\n", | 734 | printk(KERN_INFO "ide: ignoring the ATA_DF bit for %s\n", |
@@ -731,7 +737,7 @@ static void ide_dev_apply_params(ide_drive_t *drive) | |||
731 | } | 737 | } |
732 | if (ide_cdroms & (1 << i)) { | 738 | if (ide_cdroms & (1 << i)) { |
733 | printk(KERN_INFO "ide: forcing %s as a CD-ROM\n", drive->name); | 739 | printk(KERN_INFO "ide: forcing %s as a CD-ROM\n", drive->name); |
734 | drive->present = 1; | 740 | drive->dev_flags |= IDE_DFLAG_PRESENT; |
735 | drive->media = ide_cdrom; | 741 | drive->media = ide_cdrom; |
736 | /* an ATAPI device ignores DRDY */ | 742 | /* an ATAPI device ignores DRDY */ |
737 | drive->ready_stat = 0; | 743 | drive->ready_stat = 0; |
@@ -740,11 +746,12 @@ static void ide_dev_apply_params(ide_drive_t *drive) | |||
740 | drive->cyl = drive->bios_cyl = ide_disks_chs[i].cyl; | 746 | drive->cyl = drive->bios_cyl = ide_disks_chs[i].cyl; |
741 | drive->head = drive->bios_head = ide_disks_chs[i].head; | 747 | drive->head = drive->bios_head = ide_disks_chs[i].head; |
742 | drive->sect = drive->bios_sect = ide_disks_chs[i].sect; | 748 | drive->sect = drive->bios_sect = ide_disks_chs[i].sect; |
743 | drive->forced_geom = 1; | 749 | |
744 | printk(KERN_INFO "ide: forcing %s as a disk (%d/%d/%d)\n", | 750 | printk(KERN_INFO "ide: forcing %s as a disk (%d/%d/%d)\n", |
745 | drive->name, | 751 | drive->name, |
746 | drive->cyl, drive->head, drive->sect); | 752 | drive->cyl, drive->head, drive->sect); |
747 | drive->present = 1; | 753 | |
754 | drive->dev_flags |= IDE_DFLAG_FORCED_GEOM | IDE_DFLAG_PRESENT; | ||
748 | drive->media = ide_disk; | 755 | drive->media = ide_disk; |
749 | drive->ready_stat = ATA_DRDY; | 756 | drive->ready_stat = ATA_DRDY; |
750 | } | 757 | } |