All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Joel Becker <jlbec@evilplan.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Felipe Balbi <balbi@ti.com>,
	Andrzej Pietrasiewicz <andrzej.p@samsung.com>,
	Tejun Heo <tj@kernel.org>,
	Pratyush Anand <pratyush.anand@gmail.com>,
	Pantelis Antoniou <pantelis.antoniou@konsulko.com>,
	target-devel@vger.kernel.org, cluster-devel@redhat.com,
	ocfs2-devel@oss.oracle.com, linux-usb@vger.kernel.org,
	netdev@vger.kernel.org
Subject: [PATCH 16/23] usb-gadget/f_serial: use per-attribute show and store methods
Date: Sat,  3 Oct 2015 15:32:52 +0200	[thread overview]
Message-ID: <1443879179-22280-17-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1443879179-22280-1-git-send-email-hch@lst.de>

To simplify the configfs interface and remove boilerplate code that also
causes binary bloat.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
---
 drivers/usb/gadget/function/f_serial.c | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/drivers/usb/gadget/function/f_serial.c b/drivers/usb/gadget/function/f_serial.c
index 1d162e2..ec837f4 100644
--- a/drivers/usb/gadget/function/f_serial.c
+++ b/drivers/usb/gadget/function/f_serial.c
@@ -266,22 +266,6 @@ static inline struct f_serial_opts *to_f_serial_opts(struct config_item *item)
 			    func_inst.group);
 }
 
-CONFIGFS_ATTR_STRUCT(f_serial_opts);
-static ssize_t f_serial_attr_show(struct config_item *item,
-				  struct configfs_attribute *attr,
-				  char *page)
-{
-	struct f_serial_opts *opts = to_f_serial_opts(item);
-	struct f_serial_opts_attribute *f_serial_opts_attr =
-		container_of(attr, struct f_serial_opts_attribute, attr);
-	ssize_t ret = 0;
-
-	if (f_serial_opts_attr->show)
-		ret = f_serial_opts_attr->show(opts, page);
-
-	return ret;
-}
-
 static void serial_attr_release(struct config_item *item)
 {
 	struct f_serial_opts *opts = to_f_serial_opts(item);
@@ -291,19 +275,17 @@ static void serial_attr_release(struct config_item *item)
 
 static struct configfs_item_operations serial_item_ops = {
 	.release	= serial_attr_release,
-	.show_attribute = f_serial_attr_show,
 };
 
-static ssize_t f_serial_port_num_show(struct f_serial_opts *opts, char *page)
+static ssize_t f_serial_port_num_show(struct config_item *item, char *page)
 {
-	return sprintf(page, "%u\n", opts->port_num);
+	return sprintf(page, "%u\n", to_f_serial_opts(item)->port_num);
 }
 
-static struct f_serial_opts_attribute f_serial_port_num =
-	__CONFIGFS_ATTR_RO(port_num, f_serial_port_num_show);
+CONFIGFS_ATTR_RO(f_serial_, port_num);
 
 static struct configfs_attribute *acm_attrs[] = {
-	&f_serial_port_num.attr,
+	&f_serial_attr_port_num,
 	NULL,
 };
 
-- 
1.9.1

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Joel Becker <jlbec@evilplan.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Felipe Balbi <balbi@ti.com>,
	Andrzej Pietrasiewicz <andrzej.p@samsung.com>,
	Tejun Heo <tj@kernel.org>,
	Pratyush Anand <pratyush.anand@gmail.com>,
	Pantelis Antoniou <pantelis.antoniou@konsulko.com>,
	target-devel@vger.kernel.org, cluster-devel@redhat.com,
	ocfs2-devel@oss.oracle.com, linux-usb@vger.kernel.org,
	netdev@vger.kernel.org
Subject: [Ocfs2-devel] [PATCH 16/23] usb-gadget/f_serial: use per-attribute show and store methods
Date: Sat,  3 Oct 2015 15:32:52 +0200	[thread overview]
Message-ID: <1443879179-22280-17-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1443879179-22280-1-git-send-email-hch@lst.de>

To simplify the configfs interface and remove boilerplate code that also
causes binary bloat.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
---
 drivers/usb/gadget/function/f_serial.c | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/drivers/usb/gadget/function/f_serial.c b/drivers/usb/gadget/function/f_serial.c
index 1d162e2..ec837f4 100644
--- a/drivers/usb/gadget/function/f_serial.c
+++ b/drivers/usb/gadget/function/f_serial.c
@@ -266,22 +266,6 @@ static inline struct f_serial_opts *to_f_serial_opts(struct config_item *item)
 			    func_inst.group);
 }
 
-CONFIGFS_ATTR_STRUCT(f_serial_opts);
-static ssize_t f_serial_attr_show(struct config_item *item,
-				  struct configfs_attribute *attr,
-				  char *page)
-{
-	struct f_serial_opts *opts = to_f_serial_opts(item);
-	struct f_serial_opts_attribute *f_serial_opts_attr =
-		container_of(attr, struct f_serial_opts_attribute, attr);
-	ssize_t ret = 0;
-
-	if (f_serial_opts_attr->show)
-		ret = f_serial_opts_attr->show(opts, page);
-
-	return ret;
-}
-
 static void serial_attr_release(struct config_item *item)
 {
 	struct f_serial_opts *opts = to_f_serial_opts(item);
@@ -291,19 +275,17 @@ static void serial_attr_release(struct config_item *item)
 
 static struct configfs_item_operations serial_item_ops = {
 	.release	= serial_attr_release,
-	.show_attribute = f_serial_attr_show,
 };
 
-static ssize_t f_serial_port_num_show(struct f_serial_opts *opts, char *page)
+static ssize_t f_serial_port_num_show(struct config_item *item, char *page)
 {
-	return sprintf(page, "%u\n", opts->port_num);
+	return sprintf(page, "%u\n", to_f_serial_opts(item)->port_num);
 }
 
-static struct f_serial_opts_attribute f_serial_port_num =
-	__CONFIGFS_ATTR_RO(port_num, f_serial_port_num_show);
+CONFIGFS_ATTR_RO(f_serial_, port_num);
 
 static struct configfs_attribute *acm_attrs[] = {
-	&f_serial_port_num.attr,
+	&f_serial_attr_port_num,
 	NULL,
 };
 
-- 
1.9.1

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 16/23] usb-gadget/f_serial: use per-attribute show and store methods
Date: Sat,  3 Oct 2015 15:32:52 +0200	[thread overview]
Message-ID: <1443879179-22280-17-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1443879179-22280-1-git-send-email-hch@lst.de>

To simplify the configfs interface and remove boilerplate code that also
causes binary bloat.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
---
 drivers/usb/gadget/function/f_serial.c | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/drivers/usb/gadget/function/f_serial.c b/drivers/usb/gadget/function/f_serial.c
index 1d162e2..ec837f4 100644
--- a/drivers/usb/gadget/function/f_serial.c
+++ b/drivers/usb/gadget/function/f_serial.c
@@ -266,22 +266,6 @@ static inline struct f_serial_opts *to_f_serial_opts(struct config_item *item)
 			    func_inst.group);
 }
 
-CONFIGFS_ATTR_STRUCT(f_serial_opts);
-static ssize_t f_serial_attr_show(struct config_item *item,
-				  struct configfs_attribute *attr,
-				  char *page)
-{
-	struct f_serial_opts *opts = to_f_serial_opts(item);
-	struct f_serial_opts_attribute *f_serial_opts_attr =
-		container_of(attr, struct f_serial_opts_attribute, attr);
-	ssize_t ret = 0;
-
-	if (f_serial_opts_attr->show)
-		ret = f_serial_opts_attr->show(opts, page);
-
-	return ret;
-}
-
 static void serial_attr_release(struct config_item *item)
 {
 	struct f_serial_opts *opts = to_f_serial_opts(item);
@@ -291,19 +275,17 @@ static void serial_attr_release(struct config_item *item)
 
 static struct configfs_item_operations serial_item_ops = {
 	.release	= serial_attr_release,
-	.show_attribute = f_serial_attr_show,
 };
 
-static ssize_t f_serial_port_num_show(struct f_serial_opts *opts, char *page)
+static ssize_t f_serial_port_num_show(struct config_item *item, char *page)
 {
-	return sprintf(page, "%u\n", opts->port_num);
+	return sprintf(page, "%u\n", to_f_serial_opts(item)->port_num);
 }
 
-static struct f_serial_opts_attribute f_serial_port_num =
-	__CONFIGFS_ATTR_RO(port_num, f_serial_port_num_show);
+CONFIGFS_ATTR_RO(f_serial_, port_num);
 
 static struct configfs_attribute *acm_attrs[] = {
-	&f_serial_port_num.attr,
+	&f_serial_attr_port_num,
 	NULL,
 };
 
-- 
1.9.1



  parent reply	other threads:[~2015-10-03 13:37 UTC|newest]

Thread overview: 92+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-03 13:32 simplify configfs attributes V2 Christoph Hellwig
2015-10-03 13:32 ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32 ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 01/23] configfs: add show and store methods to struct configfs_attribute Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 02/23] usb-gadget: use per-attribute show and store methods Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-09 21:19   ` Felipe Balbi
2015-10-09 21:19     ` [Cluster-devel] " Felipe Balbi
2015-10-11 13:10     ` Christoph Hellwig
2015-10-11 13:10       ` [Cluster-devel] " Christoph Hellwig
2015-10-11 13:10       ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 03/23] usb-gadget/uvc: " Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 04/23] usb-gadget/f_hid: " Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 05/23] usb-gadget/f_acm: " Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 06/23] usb-gadget/ether: " Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 07/23] usb-gadget/f_loopback: " Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 08/23] usb-gadget/f_midi: " Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 09/23] usb-gadget/f_printer: " Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 10/23] usb-gadget/f_sourcesink: " Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 11/23] usb-gadget/f_mass_storage: " Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 12/23] usb-gadget/f_uac1: " Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 13/23] usb-gadget/f_uac2: " Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 14/23] usb-gadget/f_obex: " Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 15/23] usb-gadget/f_phonet: " Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` Christoph Hellwig [this message]
2015-10-03 13:32   ` [Cluster-devel] [PATCH 16/23] usb-gadget/f_serial: " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 17/23] dlm: " Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 18/23] spear13xx_pcie_gadget: " Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 20/23] netconsole: " Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 21/23] ocfs2/cluster: move locking into attribute " Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
     [not found] ` <1443879179-22280-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-10-03 13:32   ` [PATCH 19/23] target: use per-attribute show and " Christoph Hellwig
2015-10-03 13:32     ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32     ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32   ` [PATCH 22/23] ocfs2/cluster: " Christoph Hellwig
2015-10-03 13:32     ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32     ` [Ocfs2-devel] " Christoph Hellwig
2015-10-09 21:37   ` simplify configfs attributes V2 Felipe Balbi
2015-10-09 21:37     ` [Cluster-devel] " Felipe Balbi
2015-10-11 13:10     ` Christoph Hellwig
2015-10-11 13:10       ` [Cluster-devel] " Christoph Hellwig
2015-10-11 13:10       ` [Ocfs2-devel] " Christoph Hellwig
2015-10-03 13:32 ` [PATCH 23/23] configfs: remove old API Christoph Hellwig
2015-10-03 13:32   ` [Cluster-devel] " Christoph Hellwig
2015-10-03 13:32   ` [Ocfs2-devel] " Christoph Hellwig
2015-10-05 21:37 ` simplify configfs attributes V2 Andrew Morton
2015-10-05 21:37   ` [Cluster-devel] " Andrew Morton
2015-10-05 21:37   ` [Ocfs2-devel] " Andrew Morton
     [not found]   ` <20151005143705.bdcfa7d7b8211506c5dbc12e-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2015-10-13 12:54     ` Christoph Hellwig
2015-10-13 12:54       ` [Cluster-devel] " Christoph Hellwig
2015-10-13 12:54       ` [Ocfs2-devel] " Christoph Hellwig
2015-10-14  5:23 ` Nicholas A. Bellinger
2015-10-14  5:23   ` [Cluster-devel] " Nicholas A. Bellinger
  -- strict thread matches above, loose matches on Subject: below --
2015-09-25 13:49 simplify configfs attributes Christoph Hellwig
2015-09-25 13:49 ` [PATCH 16/23] usb-gadget/f_serial: use per-attribute show and store methods Christoph Hellwig
2015-09-28 11:59   ` Andrzej Pietrasiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1443879179-22280-17-git-send-email-hch@lst.de \
    --to=hch@lst.de \
    --cc=akpm@linux-foundation.org \
    --cc=andrzej.p@samsung.com \
    --cc=balbi@ti.com \
    --cc=cluster-devel@redhat.com \
    --cc=jlbec@evilplan.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    --cc=netdev@vger.kernel.org \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=pantelis.antoniou@konsulko.com \
    --cc=pratyush.anand@gmail.com \
    --cc=target-devel@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.