Staging: comedi: Proc FS related cleanup
cover Staging: comedi: Proc FS related cleanup
This series does trivial cleanup for COMEDI proc fs related stuff.
Cheah Kok Cheong (5):
Staging: comedi: comedi_fops: Avoid orphaned proc entry
Staging: comedi: proc: Change file permission to read only
Staging: comedi: proc: Add __init prefix
Staging: comedi: proc: Add module owner
Staging: comedi: proc: Warn if unable to create proc entry
drivers/staging/comedi/comedi_fops.c | 6 +++--- drivers/staging/comedi/proc.c | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/5 Staging: comedi: comedi_fops: Avoid orphaned proc entry
Move comedi_proc_init to the end to avoid orphaned proc entry if module loading failed.
--- drivers/staging/comedi/comedi_fops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/comedi/comedi_fops.c +3 -3
@@ -2898,9 +2898,6 @@ static int __init comedi_init(void) comedi_class->dev_groups = comedi_dev_groups; -/* XXX requires /proc interface */ -comedi_proc_init (); -/* create devices files for legacy/manual use */ for (i =0 ; i < comedi_num_legacy_minors; i++) {struct comedi_device *dev;
@@ -2917,6 +2914,9 @@ static int __init comedi_init(void)mutex_unlock (&dev->mutex); } +/* XXX requires /proc interface */ +comedi_proc_init (); +return 0 ; }module_init (comedi_init);
Signature · 1 line
2.7.4
PATCH 2/5 Staging: comedi: proc: Change file permission to read only
In reply to Cheah Kok CheongAs there's no write operation, change to read only. Was inadvertantly switched to 0644 in commit 1f817b86d5e6 ("comedi: Don't use create_proc_read_entry()").
--- drivers/staging/comedi/proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/proc.c +1 -1
@@ -88,7 +88,7 @@ static const struct file_operations comedi_proc_fops = {void comedi_proc_init (void ) { -proc_create ("comedi" ,0644 ,NULL , &comedi_proc_fops); +proc_create ("comedi" ,0444 ,NULL , &comedi_proc_fops); }void comedi_proc_cleanup (void )
Signature · 1 line
2.7.4
PATCH 3/5 Staging: comedi: proc: Add __init prefix
In reply to Cheah Kok CheongAdd __init prefix so that symbol will be discarded after module loading.
--- drivers/staging/comedi/proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/proc.c +1 -1
@@ -86,7 +86,7 @@ static const struct file_operations comedi_proc_fops = { .release = single_release, }; -void comedi_proc_init (void ) +void __init comedi_proc_init (void ) {proc_create ("comedi" ,0444 ,NULL , &comedi_proc_fops); }
Signature · 1 line
2.7.4
PATCH 4/5 Staging: comedi: proc: Add module owner
In reply to Cheah Kok CheongSince this is a loadable kernel module, add module ownership to follow LKM semantics.
--- drivers/staging/comedi/proc.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/comedi/proc.c +1 -0
@@ -80,6 +80,7 @@ static int comedi_proc_open(struct inode *inode, struct file *file) }static const struct file_operations comedi_proc_fops = { + .owner =THIS_MODULE , .open = comedi_proc_open, .read = seq_read, .llseek = seq_lseek,
Signature · 1 line
2.7.4
PATCH 5/5 Staging: comedi: proc: Warn if unable to create proc entry
In reply to Cheah Kok CheongThe proc entry is not essential for the comedi system as evident by the support for !CONFIG_PROC_FS. So for failure to create, just warn and continue loading.
--- drivers/staging/comedi/proc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/comedi/proc.c +2 -1
@@ -89,7 +89,8 @@ static const struct file_operations comedi_proc_fops = {void __init comedi_proc_init (void ) { -proc_create ("comedi" ,0444 ,NULL , &comedi_proc_fops); +if (!proc_create ("comedi" ,0444 ,NULL , &comedi_proc_fops)) +pr_warn ("comedi: unable to create proc entry\n" ); }void comedi_proc_cleanup (void )
Signature · 1 line
2.7.4
Quoted 9 lines · Cheah Kok Cheong
This series does trivial cleanup for COMEDI proc fs related stuff.
Cheah Kok Cheong (5):
Staging: comedi:comedi_fops: Avoid orphaned proc entry
Staging: comedi: proc: Change file permission to read only
Staging: comedi: proc: Add__initprefix
Staging: comedi: proc: Add module owner
Staging: comedi: proc: Warn if unable to create proc entry
Quoted 4 lines
drivers/staging/comedi/comedi_fops.c | 6 +++--- drivers/staging/comedi/proc.c | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-)
Looks good, thanks!
Signature · 2 lines
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=- -=( Web: http://www.mev.co.uk/ )=-