ide: preparations for /proc/ide/hd*/settings rework
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 10 Oct 2008 20:39:27 +0000 (22:39 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 10 Oct 2008 20:39:27 +0000 (22:39 +0200)
After rework settings will be no longer created dynamically
for each device so we need to make some fixups first.

* Use set_[ksettings,unmaskirq]() as a set function for
  ["keepsettings","unmaskirq"] setting.

* Allow writes to ["io_32bit","unmaskirq"] settings also when
  drive->no_[io_32bit,unmask] is set (this is checked later inside
  set_[io_32bit,unmaskirq]() anywyay and keeps consistency with
  the corresponding HDIO_SET_[32BIT,UNMASKINTR] ioctls).

* Use max possible multi sectors value (16) as an allowed max for
  "multcount" setting.  set_multcount() set function checks against
  device's max possbile value anyway and it makes the proc setting
  consistent with the corresponding HDIO_SET_MULTCOUNT ioctl.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-disk.c
drivers/ide/ide-proc.c
drivers/ide/ide.c
include/linux/ide.h

index 5fc4213437a5f42330635316de0f2a70308341d1..7a15907dce1d2b8b904b679ca075a458f7675a1b 100644 (file)
@@ -760,8 +760,7 @@ static void idedisk_add_settings(ide_drive_t *drive)
                        &drive->bios_sect, NULL);
        ide_add_setting(drive, "address", SETTING_RW, TYPE_BYTE, 0, 2, 1, 1,
                        &drive->addressing, set_lba_addressing);
-       ide_add_setting(drive, "multcount", SETTING_RW, TYPE_BYTE, 0,
-                       drive->id[ATA_ID_MAX_MULTSECT] & 0xff, 1, 1,
+       ide_add_setting(drive, "multcount", SETTING_RW, TYPE_BYTE, 0, 16, 1, 1,
                        &drive->mult_count, set_multcount);
        ide_add_setting(drive, "nowerr", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1,
                        &drive->nowerr, set_nowerr);
index cbe5a7efbbadd561e648efc85fb9fe7d3c16ad21..7a64aedfa64845e2e8ce9f2df8d5580dc3d6b012 100644 (file)
@@ -368,11 +368,11 @@ void ide_add_generic_settings (ide_drive_t *drive)
 /*
  *                       drive         setting name            read/write access                               data type       min     max                             mul_factor      div_factor      data pointer                    set function
  */
-       __ide_add_setting(drive,        "io_32bit",             drive->no_io_32bit ? SETTING_READ : SETTING_RW, TYPE_BYTE,      0,      1 + (SUPPORT_VLB_SYNC << 1),    1,              1,              &drive->io_32bit,               set_io_32bit,   0);
-       __ide_add_setting(drive,        "keepsettings",         SETTING_RW,                                     TYPE_BYTE,      0,      1,                              1,              1,              &drive->keep_settings,          NULL,           0);
+       __ide_add_setting(drive,        "io_32bit",             SETTING_RW,                                     TYPE_BYTE,      0,      1 + (SUPPORT_VLB_SYNC << 1),    1,              1,              &drive->io_32bit,               set_io_32bit,   0);
+       __ide_add_setting(drive,        "keepsettings",         SETTING_RW,                                     TYPE_BYTE,      0,      1,                              1,              1,              &drive->keep_settings,          set_ksettings,  0);
        __ide_add_setting(drive,        "nice1",                SETTING_RW,                                     TYPE_BYTE,      0,      1,                              1,              1,              &drive->nice1,                  NULL,           0);
        __ide_add_setting(drive,        "pio_mode",             SETTING_WRITE,                                  TYPE_BYTE,      0,      255,                            1,              1,              NULL,                           set_pio_mode,   0);
-       __ide_add_setting(drive,        "unmaskirq",            drive->no_unmask ? SETTING_READ : SETTING_RW,   TYPE_BYTE,      0,      1,                              1,              1,              &drive->unmask,                 NULL,           0);
+       __ide_add_setting(drive,        "unmaskirq",            SETTING_RW,                                     TYPE_BYTE,      0,      1,                              1,              1,              &drive->unmask,                 set_unmaskirq,  0);
        __ide_add_setting(drive,        "using_dma",            SETTING_RW,                                     TYPE_BYTE,      0,      1,                              1,              1,              &drive->using_dma,              set_using_dma,  0);
        __ide_add_setting(drive,        "init_speed",           SETTING_RW,                                     TYPE_BYTE,      0,      70,                             1,              1,              &drive->init_speed,             NULL,           0);
        __ide_add_setting(drive,        "current_speed",        SETTING_RW,                                     TYPE_BYTE,      0,      70,                             1,              1,              &drive->current_speed,          set_xfer_rate,  0);
index 080314e3d6b7d20b76d031e50208f1a20477b202..8e0c9f27ae4a4ca4ae5ebd1118d6119e3f1cf3a8 100644 (file)
@@ -305,7 +305,7 @@ int set_io_32bit(ide_drive_t *drive, int arg)
        return 0;
 }
 
-static int set_ksettings(ide_drive_t *drive, int arg)
+int set_ksettings(ide_drive_t *drive, int arg)
 {
        if (arg < 0 || arg > 1)
                return -EINVAL;
@@ -394,7 +394,7 @@ int set_pio_mode(ide_drive_t *drive, int arg)
        return 0;
 }
 
-static int set_unmaskirq(ide_drive_t *drive, int arg)
+int set_unmaskirq(ide_drive_t *drive, int arg)
 {
        if (drive->no_unmask)
                return -EPERM;
index a7f980d2fe5b3b312515f8397107aad3b6369e71..ad09e7c81ae97feb7304589436ce94cc47cc7ff9 100644 (file)
@@ -688,7 +688,9 @@ typedef struct ide_driver_s ide_driver_t;
 extern struct mutex ide_setting_mtx;
 
 int set_io_32bit(ide_drive_t *, int);
+int set_ksettings(ide_drive_t *, int);
 int set_pio_mode(ide_drive_t *, int);
+int set_unmaskirq(ide_drive_t *, int);
 int set_using_dma(ide_drive_t *, int);
 
 /* ATAPI packet command flags */