aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide.c')
-rw-r--r--drivers/ide/ide.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 8e0c9f27ae4a..eb64e942f58b 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -287,6 +287,8 @@ int ide_spin_wait_hwgroup (ide_drive_t *drive)
287 287
288EXPORT_SYMBOL(ide_spin_wait_hwgroup); 288EXPORT_SYMBOL(ide_spin_wait_hwgroup);
289 289
290ide_devset_get(io_32bit, io_32bit);
291
290int set_io_32bit(ide_drive_t *drive, int arg) 292int set_io_32bit(ide_drive_t *drive, int arg)
291{ 293{
292 if (drive->no_io_32bit) 294 if (drive->no_io_32bit)
@@ -305,6 +307,8 @@ int set_io_32bit(ide_drive_t *drive, int arg)
305 return 0; 307 return 0;
306} 308}
307 309
310ide_devset_get(ksettings, keep_settings);
311
308int set_ksettings(ide_drive_t *drive, int arg) 312int set_ksettings(ide_drive_t *drive, int arg)
309{ 313{
310 if (arg < 0 || arg > 1) 314 if (arg < 0 || arg > 1)
@@ -318,6 +322,8 @@ int set_ksettings(ide_drive_t *drive, int arg)
318 return 0; 322 return 0;
319} 323}
320 324
325ide_devset_get(using_dma, using_dma);
326
321int set_using_dma(ide_drive_t *drive, int arg) 327int set_using_dma(ide_drive_t *drive, int arg)
322{ 328{
323#ifdef CONFIG_BLK_DEV_IDEDMA 329#ifdef CONFIG_BLK_DEV_IDEDMA
@@ -394,6 +400,8 @@ int set_pio_mode(ide_drive_t *drive, int arg)
394 return 0; 400 return 0;
395} 401}
396 402
403ide_devset_get(unmaskirq, unmask);
404
397int set_unmaskirq(ide_drive_t *drive, int arg) 405int set_unmaskirq(ide_drive_t *drive, int arg)
398{ 406{
399 if (drive->no_unmask) 407 if (drive->no_unmask)
@@ -555,14 +563,13 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device
555{ 563{
556 unsigned long flags; 564 unsigned long flags;
557 ide_driver_t *drv; 565 ide_driver_t *drv;
558 int err = 0, (*setfunc)(ide_drive_t *, int); 566 int err = 0, (*getfunc)(ide_drive_t *), (*setfunc)(ide_drive_t *, int);
559 u8 *val;
560 567
561 switch (cmd) { 568 switch (cmd) {
562 case HDIO_GET_32BIT: val = &drive->io_32bit; goto read_val; 569 case HDIO_GET_32BIT: getfunc = get_io_32bit; goto read_val;
563 case HDIO_GET_KEEPSETTINGS: val = &drive->keep_settings; goto read_val; 570 case HDIO_GET_KEEPSETTINGS: getfunc = get_ksettings; goto read_val;
564 case HDIO_GET_UNMASKINTR: val = &drive->unmask; goto read_val; 571 case HDIO_GET_UNMASKINTR: getfunc = get_unmaskirq; goto read_val;
565 case HDIO_GET_DMA: val = &drive->using_dma; goto read_val; 572 case HDIO_GET_DMA: getfunc = get_using_dma; goto read_val;
566 case HDIO_SET_32BIT: setfunc = set_io_32bit; goto set_val; 573 case HDIO_SET_32BIT: setfunc = set_io_32bit; goto set_val;
567 case HDIO_SET_KEEPSETTINGS: setfunc = set_ksettings; goto set_val; 574 case HDIO_SET_KEEPSETTINGS: setfunc = set_ksettings; goto set_val;
568 case HDIO_SET_PIO_MODE: setfunc = set_pio_mode; goto set_val; 575 case HDIO_SET_PIO_MODE: setfunc = set_pio_mode; goto set_val;
@@ -638,7 +645,7 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device
638read_val: 645read_val:
639 mutex_lock(&ide_setting_mtx); 646 mutex_lock(&ide_setting_mtx);
640 spin_lock_irqsave(&ide_lock, flags); 647 spin_lock_irqsave(&ide_lock, flags);
641 err = *val; 648 err = getfunc(drive);
642 spin_unlock_irqrestore(&ide_lock, flags); 649 spin_unlock_irqrestore(&ide_lock, flags);
643 mutex_unlock(&ide_setting_mtx); 650 mutex_unlock(&ide_setting_mtx);
644 return err >= 0 ? put_user(err, (long __user *)arg) : err; 651 return err >= 0 ? put_user(err, (long __user *)arg) : err;