Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1548545 > unrolled thread

[PATCH 0/5] Staging: comedi: Proc FS related cleanup

Started byCheah Kok Cheong <thrust73@gmail.com>
First post2016-12-30 12:30 +0100
Last post2017-01-03 11:50 +0100
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/5] Staging: comedi: Proc FS related cleanup Cheah Kok Cheong <thrust73@gmail.com> - 2016-12-30 12:30 +0100
    [PATCH 5/5] Staging: comedi: proc: Warn if unable to create proc entry Cheah Kok Cheong <thrust73@gmail.com> - 2016-12-30 12:30 +0100
    [PATCH 4/5] Staging: comedi: proc: Add module owner Cheah Kok Cheong <thrust73@gmail.com> - 2016-12-30 12:30 +0100
    [PATCH 3/5] Staging: comedi: proc: Add __init prefix Cheah Kok Cheong <thrust73@gmail.com> - 2016-12-30 12:30 +0100
    Re: [PATCH 0/5] Staging: comedi: Proc FS related cleanup Ian Abbott <abbotti@mev.co.uk> - 2017-01-03 11:50 +0100

#1548545 — [PATCH 0/5] Staging: comedi: Proc FS related cleanup

FromCheah Kok Cheong <thrust73@gmail.com>
Date2016-12-30 12:30 +0100
Subject[PATCH 0/5] Staging: comedi: Proc FS related cleanup
Message-ID<sU3xM-3H7-3@gated-at.bofh.it>
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(-)

-- 
2.7.4

[toc] | [next] | [standalone]


#1548546 — [PATCH 5/5] Staging: comedi: proc: Warn if unable to create proc entry

FromCheah Kok Cheong <thrust73@gmail.com>
Date2016-12-30 12:30 +0100
Subject[PATCH 5/5] Staging: comedi: proc: Warn if unable to create proc entry
Message-ID<sU3xM-3H7-7@gated-at.bofh.it>
In reply to#1548545
The 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.

Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
---
 drivers/staging/comedi/proc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/proc.c b/drivers/staging/comedi/proc.c
index 99b23b2e..2644dd4 100644
--- a/drivers/staging/comedi/proc.c
+++ b/drivers/staging/comedi/proc.c
@@ -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)
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1548547 — [PATCH 4/5] Staging: comedi: proc: Add module owner

FromCheah Kok Cheong <thrust73@gmail.com>
Date2016-12-30 12:30 +0100
Subject[PATCH 4/5] Staging: comedi: proc: Add module owner
Message-ID<sU3xM-3H7-11@gated-at.bofh.it>
In reply to#1548545
Since this is a loadable kernel module, add module ownership
to follow LKM semantics.

Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
---
 drivers/staging/comedi/proc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/comedi/proc.c b/drivers/staging/comedi/proc.c
index 6d13b51..99b23b2e 100644
--- a/drivers/staging/comedi/proc.c
+++ b/drivers/staging/comedi/proc.c
@@ -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,
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1548548 — [PATCH 3/5] Staging: comedi: proc: Add __init prefix

FromCheah Kok Cheong <thrust73@gmail.com>
Date2016-12-30 12:30 +0100
Subject[PATCH 3/5] Staging: comedi: proc: Add __init prefix
Message-ID<sU3xM-3H7-13@gated-at.bofh.it>
In reply to#1548545
Add __init prefix so that symbol will be discarded after
module loading.

Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
---
 drivers/staging/comedi/proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/proc.c b/drivers/staging/comedi/proc.c
index 3513f4c..6d13b51 100644
--- a/drivers/staging/comedi/proc.c
+++ b/drivers/staging/comedi/proc.c
@@ -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);
 }
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1549686

FromIan Abbott <abbotti@mev.co.uk>
Date2017-01-03 11:50 +0100
Message-ID<sVuPf-4XV-9@gated-at.bofh.it>
In reply to#1548545
On 30/12/16 11:24, Cheah Kok Cheong wrote:
> 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(-)
>

Looks good, thanks!

Reviewed-by: Ian Abbott <abbotti@mev.co.uk>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web