diff options
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 | } |