diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:28 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:28 -0400 |
commit | 8185d5aa93e0a5c111adc4952a5b87193a68ae5b (patch) | |
tree | 431aeb09a448b7b07a353e12f4fe931ebb8555cd /drivers/scsi/ide-scsi.c | |
parent | 263138a0ad6e38de7f6526b7de037ed4511308ef (diff) |
ide: /proc/ide/hd*/settings rework
* Add struct ide_devset, S_* flags, *DEVSET() & ide*_devset_*() macros.
* Add 'const struct ide_devset **settings' to ide_driver_t.
* Use 'const struct ide_devset **settings' in ide_drive_t instead of
'struct ide_settings_s *settings'. Then convert core code and device
drivers to use struct ide_devset and co.:
- device settings are no longer allocated dynamically for each device
but instead there is an unique struct ide_devset instance per setting
- device driver keeps the pointer to the table of pointers to its
settings in ide_driver_t.settings
- generic settings are kept in ide_generic_setting[]
- ide_proc_[un]register_driver(), ide_find_setting_by_name(),
ide_{read,write}_setting() and proc_ide_{read,write}_settings()
are updated accordingly
- ide*_add_settings() are removed
* Remove no longer used __ide_add_setting(), ide_add_setting(),
__ide_remove_setting() and auto_remove_settings().
* Remove no longer used TYPE_*, SETTING_*, ide_procset_t
and ide_settings_t.
* ->keep_settings, ->using_dma, ->unmask, ->noflush, ->dsc_overlap,
->nice1, ->addressing, ->wcache and ->nowerr ide_drive_t fields
can now be bitfield flags.
While at it:
* Rename ide_find_setting_by_name() to ide_find_setting().
* Rename write_wcache() to set_wcache().
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/scsi/ide-scsi.c')
-rw-r--r-- | drivers/scsi/ide-scsi.c | 52 |
1 files changed, 36 insertions, 16 deletions
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 02bd5c487d1f..65cf84b222c5 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -429,21 +429,41 @@ static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *r | |||
429 | } | 429 | } |
430 | 430 | ||
431 | #ifdef CONFIG_IDE_PROC_FS | 431 | #ifdef CONFIG_IDE_PROC_FS |
432 | static void idescsi_add_settings(ide_drive_t *drive) | 432 | #define ide_scsi_devset_get(name, field) \ |
433 | { | 433 | static int get_##name(ide_drive_t *drive) \ |
434 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 434 | { \ |
435 | 435 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); \ | |
436 | /* | 436 | return scsi->field; \ |
437 | * drive setting name read/write data type min max mul_factor div_factor data pointer set function | 437 | } |
438 | */ | 438 | |
439 | ide_add_setting(drive, "bios_cyl", SETTING_RW, TYPE_INT, 0, 1023, 1, 1, &drive->bios_cyl, NULL); | 439 | #define ide_scsi_devset_set(name, field) \ |
440 | ide_add_setting(drive, "bios_head", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1, &drive->bios_head, NULL); | 440 | static int set_##name(ide_drive_t *drive, int arg) \ |
441 | ide_add_setting(drive, "bios_sect", SETTING_RW, TYPE_BYTE, 0, 63, 1, 1, &drive->bios_sect, NULL); | 441 | { \ |
442 | ide_add_setting(drive, "transform", SETTING_RW, TYPE_INT, 0, 3, 1, 1, &scsi->transform, NULL); | 442 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); \ |
443 | ide_add_setting(drive, "log", SETTING_RW, TYPE_INT, 0, 1, 1, 1, &scsi->log, NULL); | 443 | scsi->field = arg; \ |
444 | } | 444 | return 0; \ |
445 | #else | 445 | } |
446 | static inline void idescsi_add_settings(ide_drive_t *drive) { ; } | 446 | |
447 | #define ide_scsi_devset_rw(_name, _min, _max, _field) \ | ||
448 | ide_scsi_devset_get(_name, _field); \ | ||
449 | ide_scsi_devset_set(_name, _field); \ | ||
450 | IDE_DEVSET(_name, S_RW, _min, _max, get_##_name, set_##_name) | ||
451 | |||
452 | ide_devset_rw(bios_cyl, 0, 1023, bios_cyl); | ||
453 | ide_devset_rw(bios_head, 0, 255, bios_head); | ||
454 | ide_devset_rw(bios_sect, 0, 63, bios_sect); | ||
455 | |||
456 | ide_scsi_devset_rw(transform, 0, 3, transform); | ||
457 | ide_scsi_devset_rw(log, 0, 1, log); | ||
458 | |||
459 | static const struct ide_devset *idescsi_settings[] = { | ||
460 | &ide_devset_bios_cyl, | ||
461 | &ide_devset_bios_head, | ||
462 | &ide_devset_bios_sect, | ||
463 | &ide_devset_log, | ||
464 | &ide_devset_transform, | ||
465 | NULL | ||
466 | }; | ||
447 | #endif | 467 | #endif |
448 | 468 | ||
449 | /* | 469 | /* |
@@ -461,7 +481,6 @@ static void idescsi_setup (ide_drive_t *drive, idescsi_scsi_t *scsi) | |||
461 | drive->pc_callback = ide_scsi_callback; | 481 | drive->pc_callback = ide_scsi_callback; |
462 | 482 | ||
463 | ide_proc_register_driver(drive, scsi->driver); | 483 | ide_proc_register_driver(drive, scsi->driver); |
464 | idescsi_add_settings(drive); | ||
465 | } | 484 | } |
466 | 485 | ||
467 | static void ide_scsi_remove(ide_drive_t *drive) | 486 | static void ide_scsi_remove(ide_drive_t *drive) |
@@ -509,6 +528,7 @@ static ide_driver_t idescsi_driver = { | |||
509 | .error = idescsi_atapi_error, | 528 | .error = idescsi_atapi_error, |
510 | #ifdef CONFIG_IDE_PROC_FS | 529 | #ifdef CONFIG_IDE_PROC_FS |
511 | .proc = idescsi_proc, | 530 | .proc = idescsi_proc, |
531 | .settings = idescsi_settings, | ||
512 | #endif | 532 | #endif |
513 | }; | 533 | }; |
514 | 534 | ||