analogy: Update procfs usage to latest kernel API
PATCH 1/1 analogy: Update procfs usage to latest kernel API
This makes the Analogy layer compatible with kernel 3.10. We simply switch all procfs nodes to seq_file.
Signed-off-by Jan Kiszka <[email protected]>
---
For review. Only build-tested.
include/analogy/device.h | 4 +-- include/analogy/driver.h | 4 +-- include/analogy/transfer.h | 4 +-- ksrc/drivers/analogy/device.c | 51 ++++++++++++-------------------- ksrc/drivers/analogy/driver.c | 32 ++++----------------- ksrc/drivers/analogy/rtdm_interface.c | 42 ++++++++++++++++++-------- ksrc/drivers/analogy/transfer.c | 32 ++++----------------- 7 files changed, 63 insertions(+), 106 deletions(-)
include/analogy/device.h +1 -3
@@ -83,9 +83,7 @@ typedef struct a4l_dev_info a4l_dvinfo_t;/* --- Devices tab related functions --- */ void a4l_init_devs (void );int a4l_check_cleanup_devs (void ); -int a4l_rdproc_devs (char *page, -char **start, -off_t off,int count,int *eof,void *data); +int a4l_rdproc_devs (struct seq_file *p,void *data);/* --- Context related function / macro --- */ void a4l_set_dev (a4l_cxt_t *cxt);
include/analogy/driver.h +1 -3
@@ -68,9 +68,7 @@ int a4l_register_drv(a4l_drv_t * drv);int a4l_unregister_drv (a4l_drv_t * drv);int a4l_lct_drv (char *pin,a4l_drv_t ** pio);#ifdef CONFIG_PROC_FS -int a4l_rdproc_drvs (char *page, -char **start, -off_t off,int count,int *eof,void *data); +int a4l_rdproc_drvs (struct seq_file *p,void *data);#endif /* CONFIG_PROC_FS */ #endif /* !DOXYGEN_CPP */
include/analogy/transfer.h +1 -3
@@ -68,9 +68,7 @@ typedef struct a4l_transfer a4l_trf_t;/* --- Proc function --- */ -int a4l_rdproc_transfer (char *page, -char **start, -off_t off,int count,int *eof,void *data); +int a4l_rdproc_transfer (struct seq_file *p,void *data);/* --- Upper layer functions --- */
ksrc/drivers/analogy/device.c +19 -32
81 lines not on this page · raw message
ksrc/drivers/analogy/driver.c +6 -26
@@ -89,40 +89,20 @@ int a4l_unregister_drv(a4l_drv_t * drv)/* --- Driver list proc section --- */ -int a4l_rdproc_drvs (char *page, -char **start,off_t off,int count,int *eof,void *data) +int a4l_rdproc_drvs (struct seq_file *p,void *data) { -int i =0 , len =0 ; -char *p = page; +int i =0 ;struct list_head *this; - p +=sprintf (p,"-- Analogy drivers --\n\n" ); - p +=sprintf (p,"| idx | driver name\n" ); +seq_printf (p,"-- Analogy drivers --\n\n" ); +seq_printf (p,"| idx | driver name\n" );list_for_each (this, &a4l_drvs) {a4l_drv_t *drv =list_entry (this, a4l_drv_t, list); - p +=sprintf (p,"| %02d | %s\n" , i++, drv->board_name); +seq_printf (p,"| %02d | %s\n" , i++, drv->board_name); } - -/* Handles any proc-file reading way */ - len = p - page - off; -/* If the requested size is greater than we provide, -the read operation is over */ -if (len <= off + count) - *eof =1 ; -/* In case the read operation is performed in many steps, -the start pointer must be redefined */ - *start = page + off; -/* If the requested size is lower than we provide, -the read operation will be done in more than one step */ -if (len > count) - len = count; -/* In case the offset is not correct (too high) */ -if (len <0 ) - len =0 ; - -return len; +return 0 ; }#endif /* CONFIG_PROC_FS */
ksrc/drivers/analogy/rtdm_interface.c +29 -13
75 lines not on this page · raw message
ksrc/drivers/analogy/transfer.c +6 -26
@@ -213,16 +213,13 @@ unsigned int a4l_get_irq(a4l_dev_t * dev)#ifdef CONFIG_PROC_FS -int a4l_rdproc_transfer (char *page, -char **start, -off_t off,int count,int *eof,void *data) +int a4l_rdproc_transfer (struct seq_file *p,void *data) { -int i, len =0 ; -char *p = page; +int i;a4l_trf_t *transfer = (a4l_trf_t *) data; - p +=sprintf (p,"-- Subdevices --\n\n" ); - p +=sprintf (p,"| idx | type\n" ); +seq_printf (p,"-- Subdevices --\n\n" ); +seq_printf (p,"| idx | type\n" );/* Gives the subdevice type's name */ for (i =0 ; i < transfer->nb_subd; i++) {
@@ -268,27 +265,10 @@ int a4l_rdproc_transfer(char *page, type = "Unknown subdevice"; } - p +=sprintf (p,"| %02d | %s\n" , i, type); +seq_printf (p,"| %02d | %s\n" , i, type); } -/* Handles any proc-file reading way */ - len = p - page - off; -/* If the requested size is greater than we provide, -the read operation is over */ -if (len <= off + count) - *eof =1 ; -/* In case the read operation is performed in many steps, -the start pointer must be redefined */ - *start = page + off; -/* If the requested size is lower than we provide, -the read operation will be done in more than one step */ -if (len > count) - len = count; -/* In case the offset is not correct (too high) */ -if (len <0 ) - len =0 ; - -return len; +return 0 ; }#endif /* CONFIG_PROC_FS */
Signature · 1 line
1.7.3.4