aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-floppy.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-10 16:39:28 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-10 16:39:28 -0400
commit8185d5aa93e0a5c111adc4952a5b87193a68ae5b (patch)
tree431aeb09a448b7b07a353e12f4fe931ebb8555cd /drivers/ide/ide-floppy.c
parent263138a0ad6e38de7f6526b7de037ed4511308ef (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/ide/ide-floppy.c')
-rw-r--r--drivers/ide/ide-floppy.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 597459c81d5f..673644fdb6f2 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -1007,21 +1007,32 @@ static int idefloppy_identify_device(ide_drive_t *drive, u16 *id)
1007} 1007}
1008 1008
1009#ifdef CONFIG_IDE_PROC_FS 1009#ifdef CONFIG_IDE_PROC_FS
1010static void idefloppy_add_settings(ide_drive_t *drive) 1010ide_devset_rw(bios_cyl, 0, 1023, bios_cyl);
1011ide_devset_rw(bios_head, 0, 255, bios_head);
1012ide_devset_rw(bios_sect, 0, 63, bios_sect);
1013
1014static int get_ticks(ide_drive_t *drive)
1011{ 1015{
1012 idefloppy_floppy_t *floppy = drive->driver_data; 1016 idefloppy_floppy_t *floppy = drive->driver_data;
1017 return floppy->ticks;
1018}
1013 1019
1014 ide_add_setting(drive, "bios_cyl", SETTING_RW, TYPE_INT, 0, 1023, 1, 1, 1020static int set_ticks(ide_drive_t *drive, int arg)
1015 &drive->bios_cyl, NULL); 1021{
1016 ide_add_setting(drive, "bios_head", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1, 1022 idefloppy_floppy_t *floppy = drive->driver_data;
1017 &drive->bios_head, NULL); 1023 floppy->ticks = arg;
1018 ide_add_setting(drive, "bios_sect", SETTING_RW, TYPE_BYTE, 0, 63, 1, 1, 1024 return 0;
1019 &drive->bios_sect, NULL);
1020 ide_add_setting(drive, "ticks", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1,
1021 &floppy->ticks, NULL);
1022} 1025}
1023#else 1026
1024static inline void idefloppy_add_settings(ide_drive_t *drive) { ; } 1027IDE_DEVSET(ticks, S_RW, 0, 255, get_ticks, set_ticks);
1028
1029static const struct ide_devset *idefloppy_settings[] = {
1030 &ide_devset_bios_cyl,
1031 &ide_devset_bios_head,
1032 &ide_devset_bios_sect,
1033 &ide_devset_ticks,
1034 NULL
1035};
1025#endif 1036#endif
1026 1037
1027static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy) 1038static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy)
@@ -1063,7 +1074,6 @@ static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy)
1063 (void) ide_floppy_get_capacity(drive); 1074 (void) ide_floppy_get_capacity(drive);
1064 1075
1065 ide_proc_register_driver(drive, floppy->driver); 1076 ide_proc_register_driver(drive, floppy->driver);
1066 idefloppy_add_settings(drive);
1067} 1077}
1068 1078
1069static void ide_floppy_remove(ide_drive_t *drive) 1079static void ide_floppy_remove(ide_drive_t *drive)
@@ -1126,6 +1136,7 @@ static ide_driver_t idefloppy_driver = {
1126 .error = __ide_error, 1136 .error = __ide_error,
1127#ifdef CONFIG_IDE_PROC_FS 1137#ifdef CONFIG_IDE_PROC_FS
1128 .proc = idefloppy_proc, 1138 .proc = idefloppy_proc,
1139 .settings = idefloppy_settings,
1129#endif 1140#endif
1130}; 1141};
1131 1142