aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ide.h
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-05-09 18:01:10 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-05-09 18:01:10 -0400
commit7662d046df09e80680b77b68de896beab45e675e (patch)
treeea2281c59399b3867fb37e1005a0f0e0d2170c5d /include/linux/ide.h
parent1497943ee692aa7519fa972d0e3a339649bf3a96 (diff)
ide: move IDE settings handling to ide-proc.c
* move __ide_add_setting() ide_add_setting() __ide_remove_setting() auto_remove_settings() ide_find_setting_by_name() ide_read_setting() ide_write_setting() set_xfer_rate() ide_add_generic_settings() ide_register_subdriver() ide_unregister_subdriver() from ide.c to ide-proc.c * set_{io_32bit,pio_mode,using_dma}() cannot be marked static now, fix it * rename ide_[un]register_subdriver() to ide_proc_[un]register_driver(), update device drivers to use new names * add CONFIG_IDE_PROC_FS=n versions of ide_proc_[un]register_driver() and ide_add_generic_settings() * make ide_find_setting_by_name(), ide_{read,write}_setting() and ide_{add,remove}_proc_entries() static * cover IDE settings code in device drivers with CONFIG_IDE_PROC_FS #ifdef, also while at it cover with CONFIG_IDE_PROC_FS #ifdef ide_driver_t.proc * remove bogus comment from ide.h * cover with CONFIG_IDE_PROC_FS #ifdef .proc and .settings in ide_drive_t Besides saner code this patch results in the IDE core smaller by ~2 kB (on x86-32) and IDE disk driver by ~1 kB (ditto) when CONFIG_IDE_PROC_FS=n. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'include/linux/ide.h')
-rw-r--r--include/linux/ide.h39
1 files changed, 23 insertions, 16 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 591a0b55e31c..477b8c6be727 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -559,9 +559,10 @@ typedef struct ide_drive_s {
559 struct ide_drive_s *next; /* circular list of hwgroup drives */ 559 struct ide_drive_s *next; /* circular list of hwgroup drives */
560 void *driver_data; /* extra driver data */ 560 void *driver_data; /* extra driver data */
561 struct hd_driveid *id; /* drive model identification info */ 561 struct hd_driveid *id; /* drive model identification info */
562#ifdef CONFIG_IDE_PROC_FS
562 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ 563 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */
563 struct ide_settings_s *settings;/* /proc/ide/ drive settings */ 564 struct ide_settings_s *settings;/* /proc/ide/ drive settings */
564 565#endif
565 struct hwif_s *hwif; /* actually (ide_hwif_t *) */ 566 struct hwif_s *hwif; /* actually (ide_hwif_t *) */
566 567
567 unsigned long sleep; /* sleep until this time */ 568 unsigned long sleep; /* sleep until this time */
@@ -858,8 +859,15 @@ typedef struct hwgroup_s {
858 unsigned char cmd_buf[4]; 859 unsigned char cmd_buf[4];
859} ide_hwgroup_t; 860} ide_hwgroup_t;
860 861
861/* structure attached to the request for IDE_TASK_CMDS */ 862typedef struct ide_driver_s ide_driver_t;
863
864extern struct semaphore ide_setting_sem;
862 865
866int set_io_32bit(ide_drive_t *, int);
867int set_pio_mode(ide_drive_t *, int);
868int set_using_dma(ide_drive_t *, int);
869
870#ifdef CONFIG_IDE_PROC_FS
863/* 871/*
864 * configurable drive settings 872 * configurable drive settings
865 */ 873 */
@@ -887,12 +895,7 @@ typedef struct ide_settings_s {
887 struct ide_settings_s *next; 895 struct ide_settings_s *next;
888} ide_settings_t; 896} ide_settings_t;
889 897
890extern struct semaphore ide_setting_sem;
891int ide_add_setting(ide_drive_t *, const char *, int, int, int, int, int, int, void *, ide_procset_t *set); 898int ide_add_setting(ide_drive_t *, const char *, int, int, int, int, int, int, void *, ide_procset_t *set);
892extern ide_settings_t *ide_find_setting_by_name(ide_drive_t *drive, char *name);
893extern int ide_read_setting(ide_drive_t *t, ide_settings_t *setting);
894extern int ide_write_setting(ide_drive_t *drive, ide_settings_t *setting, int val);
895extern void ide_add_generic_settings(ide_drive_t *drive);
896 899
897/* 900/*
898 * /proc/ide interface 901 * /proc/ide interface
@@ -904,15 +907,17 @@ typedef struct {
904 write_proc_t *write_proc; 907 write_proc_t *write_proc;
905} ide_proc_entry_t; 908} ide_proc_entry_t;
906 909
907#ifdef CONFIG_IDE_PROC_FS
908extern struct proc_dir_entry *proc_ide_root; 910extern struct proc_dir_entry *proc_ide_root;
909 911
910void proc_ide_create(void); 912void proc_ide_create(void);
911void proc_ide_destroy(void); 913void proc_ide_destroy(void);
912void create_proc_ide_interfaces(void); 914void create_proc_ide_interfaces(void);
913void destroy_proc_ide_interface(ide_hwif_t *); 915void destroy_proc_ide_interface(ide_hwif_t *);
914void ide_add_proc_entries(struct proc_dir_entry *, ide_proc_entry_t *, void *); 916void ide_proc_register_driver(ide_drive_t *, ide_driver_t *);
915void ide_remove_proc_entries(struct proc_dir_entry *, ide_proc_entry_t *); 917void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *);
918
919void ide_add_generic_settings(ide_drive_t *);
920
916read_proc_t proc_ide_read_capacity; 921read_proc_t proc_ide_read_capacity;
917read_proc_t proc_ide_read_geometry; 922read_proc_t proc_ide_read_geometry;
918 923
@@ -940,6 +945,9 @@ static inline void proc_ide_create(void) { ; }
940static inline void proc_ide_destroy(void) { ; } 945static inline void proc_ide_destroy(void) { ; }
941static inline void create_proc_ide_interfaces(void) { ; } 946static inline void create_proc_ide_interfaces(void) { ; }
942static inline void destroy_proc_ide_interface(ide_hwif_t *hwif) { ; } 947static inline void destroy_proc_ide_interface(ide_hwif_t *hwif) { ; }
948static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
949static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
950static inline void ide_add_generic_settings(ide_drive_t *drive) { ; }
943#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0; 951#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0;
944#endif 952#endif
945 953
@@ -982,7 +990,7 @@ enum {
982 * The gendriver.owner field should be set to the module owner of this driver. 990 * The gendriver.owner field should be set to the module owner of this driver.
983 * The gendriver.name field should be set to the name of this driver 991 * The gendriver.name field should be set to the name of this driver
984 */ 992 */
985typedef struct ide_driver_s { 993struct ide_driver_s {
986 const char *version; 994 const char *version;
987 u8 media; 995 u8 media;
988 unsigned supports_dsc_overlap : 1; 996 unsigned supports_dsc_overlap : 1;
@@ -990,12 +998,14 @@ typedef struct ide_driver_s {
990 int (*end_request)(ide_drive_t *, int, int); 998 int (*end_request)(ide_drive_t *, int, int);
991 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); 999 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8);
992 ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); 1000 ide_startstop_t (*abort)(ide_drive_t *, struct request *rq);
993 ide_proc_entry_t *proc;
994 struct device_driver gen_driver; 1001 struct device_driver gen_driver;
995 int (*probe)(ide_drive_t *); 1002 int (*probe)(ide_drive_t *);
996 void (*remove)(ide_drive_t *); 1003 void (*remove)(ide_drive_t *);
997 void (*shutdown)(ide_drive_t *); 1004 void (*shutdown)(ide_drive_t *);
998} ide_driver_t; 1005#ifdef CONFIG_IDE_PROC_FS
1006 ide_proc_entry_t *proc;
1007#endif
1008};
999 1009
1000#define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver) 1010#define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver)
1001 1011
@@ -1205,9 +1215,6 @@ extern void default_hwif_iops(ide_hwif_t *);
1205extern void default_hwif_mmiops(ide_hwif_t *); 1215extern void default_hwif_mmiops(ide_hwif_t *);
1206extern void default_hwif_transport(ide_hwif_t *); 1216extern void default_hwif_transport(ide_hwif_t *);
1207 1217
1208void ide_register_subdriver(ide_drive_t *, ide_driver_t *);
1209void ide_unregister_subdriver(ide_drive_t *, ide_driver_t *);
1210
1211#define ON_BOARD 1 1218#define ON_BOARD 1
1212#define NEVER_BOARD 0 1219#define NEVER_BOARD 0
1213 1220