linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/bluetooth: Change to use DEFINE_SHOW_ATTRIBUTE macro
@ 2018-11-05 14:56 Yangtao Li
  2018-12-10 16:35 ` Frank Lee
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yangtao Li @ 2018-11-05 14:56 UTC (permalink / raw)
  To: marcel, johan.hedberg, davem, keescook, gustavo, dvlasenk
  Cc: linux-bluetooth, netdev, linux-kernel, Yangtao Li

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 net/bluetooth/l2cap_core.c  | 12 +-----------
 net/bluetooth/rfcomm/core.c | 12 +-----------
 net/bluetooth/rfcomm/sock.c | 12 +-----------
 net/bluetooth/sco.c         | 12 +-----------
 4 files changed, 4 insertions(+), 44 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index d17a4736e47c..38d92ced5fb5 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -7615,17 +7615,7 @@ static int l2cap_debugfs_show(struct seq_file *f, void *p)
 	return 0;
 }
 
-static int l2cap_debugfs_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, l2cap_debugfs_show, inode->i_private);
-}
-
-static const struct file_operations l2cap_debugfs_fops = {
-	.open		= l2cap_debugfs_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(l2cap_debugfs);
 
 static struct dentry *l2cap_debugfs;
 
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index b98225d65e87..1a635df80643 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -2166,17 +2166,7 @@ static int rfcomm_dlc_debugfs_show(struct seq_file *f, void *x)
 	return 0;
 }
 
-static int rfcomm_dlc_debugfs_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, rfcomm_dlc_debugfs_show, inode->i_private);
-}
-
-static const struct file_operations rfcomm_dlc_debugfs_fops = {
-	.open		= rfcomm_dlc_debugfs_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(rfcomm_dlc_debugfs);
 
 static struct dentry *rfcomm_dlc_debugfs;
 
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index d606e9212291..aa0db1d1bd9b 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -1020,17 +1020,7 @@ static int rfcomm_sock_debugfs_show(struct seq_file *f, void *p)
 	return 0;
 }
 
-static int rfcomm_sock_debugfs_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, rfcomm_sock_debugfs_show, inode->i_private);
-}
-
-static const struct file_operations rfcomm_sock_debugfs_fops = {
-	.open		= rfcomm_sock_debugfs_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(rfcomm_sock_debugfs);
 
 static struct dentry *rfcomm_sock_debugfs;
 
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 8f0f9279eac9..529b38996d8b 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -1173,17 +1173,7 @@ static int sco_debugfs_show(struct seq_file *f, void *p)
 	return 0;
 }
 
-static int sco_debugfs_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, sco_debugfs_show, inode->i_private);
-}
-
-static const struct file_operations sco_debugfs_fops = {
-	.open		= sco_debugfs_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(sco_debugfs);
 
 static struct dentry *sco_debugfs;
 
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net/bluetooth: Change to use DEFINE_SHOW_ATTRIBUTE macro
  2018-11-05 14:56 [PATCH] net/bluetooth: Change to use DEFINE_SHOW_ATTRIBUTE macro Yangtao Li
@ 2018-12-10 16:35 ` Frank Lee
  2018-12-10 17:42 ` Kees Cook
  2018-12-18 23:49 ` Marcel Holtmann
  2 siblings, 0 replies; 4+ messages in thread
From: Frank Lee @ 2018-12-10 16:35 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, davem, Kees Cook, gustavo, dvlasenk
  Cc: linux-bluetooth, netdev, linux-kernel

ping......

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net/bluetooth: Change to use DEFINE_SHOW_ATTRIBUTE macro
  2018-11-05 14:56 [PATCH] net/bluetooth: Change to use DEFINE_SHOW_ATTRIBUTE macro Yangtao Li
  2018-12-10 16:35 ` Frank Lee
@ 2018-12-10 17:42 ` Kees Cook
  2018-12-18 23:49 ` Marcel Holtmann
  2 siblings, 0 replies; 4+ messages in thread
From: Kees Cook @ 2018-12-10 17:42 UTC (permalink / raw)
  To: Yangtao Li
  Cc: Marcel Holtmann, Johan Hedberg, David S. Miller,
	Gustavo A. R. Silva, Denys Vlasenko, linux-bluetooth,
	Network Development, LKML

On Mon, Nov 5, 2018 at 6:56 AM Yangtao Li <tiny.windzz@gmail.com> wrote:
>
> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
>
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  net/bluetooth/l2cap_core.c  | 12 +-----------
>  net/bluetooth/rfcomm/core.c | 12 +-----------
>  net/bluetooth/rfcomm/sock.c | 12 +-----------
>  net/bluetooth/sco.c         | 12 +-----------
>  4 files changed, 4 insertions(+), 44 deletions(-)
>
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index d17a4736e47c..38d92ced5fb5 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -7615,17 +7615,7 @@ static int l2cap_debugfs_show(struct seq_file *f, void *p)
>         return 0;
>  }
>
> -static int l2cap_debugfs_open(struct inode *inode, struct file *file)
> -{
> -       return single_open(file, l2cap_debugfs_show, inode->i_private);
> -}
> -
> -static const struct file_operations l2cap_debugfs_fops = {
> -       .open           = l2cap_debugfs_open,
> -       .read           = seq_read,
> -       .llseek         = seq_lseek,
> -       .release        = single_release,
> -};
> +DEFINE_SHOW_ATTRIBUTE(l2cap_debugfs);
>
>  static struct dentry *l2cap_debugfs;
>
> diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
> index b98225d65e87..1a635df80643 100644
> --- a/net/bluetooth/rfcomm/core.c
> +++ b/net/bluetooth/rfcomm/core.c
> @@ -2166,17 +2166,7 @@ static int rfcomm_dlc_debugfs_show(struct seq_file *f, void *x)
>         return 0;
>  }
>
> -static int rfcomm_dlc_debugfs_open(struct inode *inode, struct file *file)
> -{
> -       return single_open(file, rfcomm_dlc_debugfs_show, inode->i_private);
> -}
> -
> -static const struct file_operations rfcomm_dlc_debugfs_fops = {
> -       .open           = rfcomm_dlc_debugfs_open,
> -       .read           = seq_read,
> -       .llseek         = seq_lseek,
> -       .release        = single_release,
> -};
> +DEFINE_SHOW_ATTRIBUTE(rfcomm_dlc_debugfs);
>
>  static struct dentry *rfcomm_dlc_debugfs;
>
> diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
> index d606e9212291..aa0db1d1bd9b 100644
> --- a/net/bluetooth/rfcomm/sock.c
> +++ b/net/bluetooth/rfcomm/sock.c
> @@ -1020,17 +1020,7 @@ static int rfcomm_sock_debugfs_show(struct seq_file *f, void *p)
>         return 0;
>  }
>
> -static int rfcomm_sock_debugfs_open(struct inode *inode, struct file *file)
> -{
> -       return single_open(file, rfcomm_sock_debugfs_show, inode->i_private);
> -}
> -
> -static const struct file_operations rfcomm_sock_debugfs_fops = {
> -       .open           = rfcomm_sock_debugfs_open,
> -       .read           = seq_read,
> -       .llseek         = seq_lseek,
> -       .release        = single_release,
> -};
> +DEFINE_SHOW_ATTRIBUTE(rfcomm_sock_debugfs);
>
>  static struct dentry *rfcomm_sock_debugfs;
>
> diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
> index 8f0f9279eac9..529b38996d8b 100644
> --- a/net/bluetooth/sco.c
> +++ b/net/bluetooth/sco.c
> @@ -1173,17 +1173,7 @@ static int sco_debugfs_show(struct seq_file *f, void *p)
>         return 0;
>  }
>
> -static int sco_debugfs_open(struct inode *inode, struct file *file)
> -{
> -       return single_open(file, sco_debugfs_show, inode->i_private);
> -}
> -
> -static const struct file_operations sco_debugfs_fops = {
> -       .open           = sco_debugfs_open,
> -       .read           = seq_read,
> -       .llseek         = seq_lseek,
> -       .release        = single_release,
> -};
> +DEFINE_SHOW_ATTRIBUTE(sco_debugfs);
>
>  static struct dentry *sco_debugfs;
>
> --
> 2.17.0
>


-- 
Kees Cook

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net/bluetooth: Change to use DEFINE_SHOW_ATTRIBUTE macro
  2018-11-05 14:56 [PATCH] net/bluetooth: Change to use DEFINE_SHOW_ATTRIBUTE macro Yangtao Li
  2018-12-10 16:35 ` Frank Lee
  2018-12-10 17:42 ` Kees Cook
@ 2018-12-18 23:49 ` Marcel Holtmann
  2 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2018-12-18 23:49 UTC (permalink / raw)
  To: Yangtao Li
  Cc: Johan Hedberg, David S. Miller, keescook, gustavo, dvlasenk,
	linux-bluetooth, netdev, linux-kernel

Hi Yangtao,

> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> ---
> net/bluetooth/l2cap_core.c  | 12 +-----------
> net/bluetooth/rfcomm/core.c | 12 +-----------
> net/bluetooth/rfcomm/sock.c | 12 +-----------
> net/bluetooth/sco.c         | 12 +-----------
> 4 files changed, 4 insertions(+), 44 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-12-18 23:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-05 14:56 [PATCH] net/bluetooth: Change to use DEFINE_SHOW_ATTRIBUTE macro Yangtao Li
2018-12-10 16:35 ` Frank Lee
2018-12-10 17:42 ` Kees Cook
2018-12-18 23:49 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).