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-ioctls.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-ioctls.c')
-rw-r--r-- | drivers/ide/ide-ioctls.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c index cf01564901af..a90945f49792 100644 --- a/drivers/ide/ide-ioctls.c +++ b/drivers/ide/ide-ioctls.c | |||
@@ -62,7 +62,7 @@ static int ide_get_identity_ioctl(ide_drive_t *drive, unsigned int cmd, | |||
62 | int size = (cmd == HDIO_GET_IDENTITY) ? (ATA_ID_WORDS * 2) : 142; | 62 | int size = (cmd == HDIO_GET_IDENTITY) ? (ATA_ID_WORDS * 2) : 142; |
63 | int rc = 0; | 63 | int rc = 0; |
64 | 64 | ||
65 | if (drive->id_read == 0) { | 65 | if ((drive->dev_flags & IDE_DFLAG_ID_READ) == 0) { |
66 | rc = -ENOMSG; | 66 | rc = -ENOMSG; |
67 | goto out; | 67 | goto out; |
68 | } | 68 | } |
@@ -86,8 +86,10 @@ out: | |||
86 | 86 | ||
87 | static int ide_get_nice_ioctl(ide_drive_t *drive, unsigned long arg) | 87 | static int ide_get_nice_ioctl(ide_drive_t *drive, unsigned long arg) |
88 | { | 88 | { |
89 | return put_user((drive->dsc_overlap << IDE_NICE_DSC_OVERLAP) | | 89 | return put_user((!!(drive->dev_flags & IDE_DFLAG_DSC_OVERLAP) |
90 | (drive->nice1 << IDE_NICE_1), (long __user *)arg); | 90 | << IDE_NICE_DSC_OVERLAP) | |
91 | (!!(drive->dev_flags & IDE_DFLAG_NICE1) | ||
92 | << IDE_NICE_1), (long __user *)arg); | ||
91 | } | 93 | } |
92 | 94 | ||
93 | static int ide_set_nice_ioctl(ide_drive_t *drive, unsigned long arg) | 95 | static int ide_set_nice_ioctl(ide_drive_t *drive, unsigned long arg) |
@@ -97,11 +99,18 @@ static int ide_set_nice_ioctl(ide_drive_t *drive, unsigned long arg) | |||
97 | 99 | ||
98 | if (((arg >> IDE_NICE_DSC_OVERLAP) & 1) && | 100 | if (((arg >> IDE_NICE_DSC_OVERLAP) & 1) && |
99 | (drive->media == ide_disk || drive->media == ide_floppy || | 101 | (drive->media == ide_disk || drive->media == ide_floppy || |
100 | drive->scsi)) | 102 | (drive->dev_flags & IDE_DFLAG_SCSI))) |
101 | return -EPERM; | 103 | return -EPERM; |
102 | 104 | ||
103 | drive->dsc_overlap = (arg >> IDE_NICE_DSC_OVERLAP) & 1; | 105 | if ((arg >> IDE_NICE_DSC_OVERLAP) & 1) |
104 | drive->nice1 = (arg >> IDE_NICE_1) & 1; | 106 | drive->dev_flags |= IDE_DFLAG_DSC_OVERLAP; |
107 | else | ||
108 | drive->dev_flags &= ~IDE_DFLAG_DSC_OVERLAP; | ||
109 | |||
110 | if ((arg >> IDE_NICE_1) & 1) | ||
111 | drive->dev_flags |= IDE_DFLAG_NICE1; | ||
112 | else | ||
113 | drive->dev_flags &= ~IDE_DFLAG_NICE1; | ||
105 | 114 | ||
106 | return 0; | 115 | return 0; |
107 | } | 116 | } |