netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Joel Becker <jlbec@evilplan.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org,
	Pratyush Anand <pratyush.anand@gmail.com>,
	Felipe Balbi <balbi@ti.com>,
	cluster-devel@redhat.com, target-devel@vger.kernel.org,
	Tejun Heo <tj@kernel.org>,
	ocfs2-devel@oss.oracle.com
Subject: [PATCH 10/23] usb-gadget/f_sourcesink: use per-attribute show and store methods
Date: Fri, 25 Sep 2015 06:49:47 -0700	[thread overview]
Message-ID: <1443189000-13398-11-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1443189000-13398-1-git-send-email-hch@lst.de>

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/usb/gadget/function/f_sourcesink.c | 88 ++++++++++++------------------
 1 file changed, 36 insertions(+), 52 deletions(-)

diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c
index cbfaf86..e5288c7 100644
--- a/drivers/usb/gadget/function/f_sourcesink.c
+++ b/drivers/usb/gadget/function/f_sourcesink.c
@@ -898,9 +898,6 @@ static inline struct f_ss_opts *to_f_ss_opts(struct config_item *item)
 			    func_inst.group);
 }
 
-CONFIGFS_ATTR_STRUCT(f_ss_opts);
-CONFIGFS_ATTR_OPS(f_ss_opts);
-
 static void ss_attr_release(struct config_item *item)
 {
 	struct f_ss_opts *ss_opts = to_f_ss_opts(item);
@@ -910,12 +907,11 @@ static void ss_attr_release(struct config_item *item)
 
 static struct configfs_item_operations ss_item_ops = {
 	.release		= ss_attr_release,
-	.show_attribute		= f_ss_opts_attr_show,
-	.store_attribute	= f_ss_opts_attr_store,
 };
 
-static ssize_t f_ss_opts_pattern_show(struct f_ss_opts *opts, char *page)
+static ssize_t f_ss_opts_pattern_show(struct config_item *item, char *page)
 {
+	struct f_ss_opts *opts = to_f_ss_opts(item);
 	int result;
 
 	mutex_lock(&opts->lock);
@@ -925,9 +921,10 @@ static ssize_t f_ss_opts_pattern_show(struct f_ss_opts *opts, char *page)
 	return result;
 }
 
-static ssize_t f_ss_opts_pattern_store(struct f_ss_opts *opts,
+static ssize_t f_ss_opts_pattern_store(struct config_item *item,
 				       const char *page, size_t len)
 {
+	struct f_ss_opts *opts = to_f_ss_opts(item);
 	int ret;
 	u8 num;
 
@@ -953,13 +950,9 @@ end:
 	return ret;
 }
 
-static struct f_ss_opts_attribute f_ss_opts_pattern =
-	__CONFIGFS_ATTR(pattern, S_IRUGO | S_IWUSR,
-			f_ss_opts_pattern_show,
-			f_ss_opts_pattern_store);
-
-static ssize_t f_ss_opts_isoc_interval_show(struct f_ss_opts *opts, char *page)
+static ssize_t f_ss_opts_isoc_interval_show(struct config_item *item, char *page)
 {
+	struct f_ss_opts *opts = to_f_ss_opts(item);
 	int result;
 
 	mutex_lock(&opts->lock);
@@ -969,9 +962,10 @@ static ssize_t f_ss_opts_isoc_interval_show(struct f_ss_opts *opts, char *page)
 	return result;
 }
 
-static ssize_t f_ss_opts_isoc_interval_store(struct f_ss_opts *opts,
+static ssize_t f_ss_opts_isoc_interval_store(struct config_item *item,
 				       const char *page, size_t len)
 {
+	struct f_ss_opts *opts = to_f_ss_opts(item);
 	int ret;
 	u8 num;
 
@@ -997,13 +991,9 @@ end:
 	return ret;
 }
 
-static struct f_ss_opts_attribute f_ss_opts_isoc_interval =
-	__CONFIGFS_ATTR(isoc_interval, S_IRUGO | S_IWUSR,
-			f_ss_opts_isoc_interval_show,
-			f_ss_opts_isoc_interval_store);
-
-static ssize_t f_ss_opts_isoc_maxpacket_show(struct f_ss_opts *opts, char *page)
+static ssize_t f_ss_opts_isoc_maxpacket_show(struct config_item *item, char *page)
 {
+	struct f_ss_opts *opts = to_f_ss_opts(item);
 	int result;
 
 	mutex_lock(&opts->lock);
@@ -1013,9 +1003,10 @@ static ssize_t f_ss_opts_isoc_maxpacket_show(struct f_ss_opts *opts, char *page)
 	return result;
 }
 
-static ssize_t f_ss_opts_isoc_maxpacket_store(struct f_ss_opts *opts,
+static ssize_t f_ss_opts_isoc_maxpacket_store(struct config_item *item,
 				       const char *page, size_t len)
 {
+	struct f_ss_opts *opts = to_f_ss_opts(item);
 	int ret;
 	u16 num;
 
@@ -1041,13 +1032,9 @@ end:
 	return ret;
 }
 
-static struct f_ss_opts_attribute f_ss_opts_isoc_maxpacket =
-	__CONFIGFS_ATTR(isoc_maxpacket, S_IRUGO | S_IWUSR,
-			f_ss_opts_isoc_maxpacket_show,
-			f_ss_opts_isoc_maxpacket_store);
-
-static ssize_t f_ss_opts_isoc_mult_show(struct f_ss_opts *opts, char *page)
+static ssize_t f_ss_opts_isoc_mult_show(struct config_item *item, char *page)
 {
+	struct f_ss_opts *opts = to_f_ss_opts(item);
 	int result;
 
 	mutex_lock(&opts->lock);
@@ -1057,9 +1044,10 @@ static ssize_t f_ss_opts_isoc_mult_show(struct f_ss_opts *opts, char *page)
 	return result;
 }
 
-static ssize_t f_ss_opts_isoc_mult_store(struct f_ss_opts *opts,
+static ssize_t f_ss_opts_isoc_mult_store(struct config_item *item,
 				       const char *page, size_t len)
 {
+	struct f_ss_opts *opts = to_f_ss_opts(item);
 	int ret;
 	u8 num;
 
@@ -1085,13 +1073,9 @@ end:
 	return ret;
 }
 
-static struct f_ss_opts_attribute f_ss_opts_isoc_mult =
-	__CONFIGFS_ATTR(isoc_mult, S_IRUGO | S_IWUSR,
-			f_ss_opts_isoc_mult_show,
-			f_ss_opts_isoc_mult_store);
-
-static ssize_t f_ss_opts_isoc_maxburst_show(struct f_ss_opts *opts, char *page)
+static ssize_t f_ss_opts_isoc_maxburst_show(struct config_item *item, char *page)
 {
+	struct f_ss_opts *opts = to_f_ss_opts(item);
 	int result;
 
 	mutex_lock(&opts->lock);
@@ -1101,9 +1085,10 @@ static ssize_t f_ss_opts_isoc_maxburst_show(struct f_ss_opts *opts, char *page)
 	return result;
 }
 
-static ssize_t f_ss_opts_isoc_maxburst_store(struct f_ss_opts *opts,
+static ssize_t f_ss_opts_isoc_maxburst_store(struct config_item *item,
 				       const char *page, size_t len)
 {
+	struct f_ss_opts *opts = to_f_ss_opts(item);
 	int ret;
 	u8 num;
 
@@ -1129,13 +1114,9 @@ end:
 	return ret;
 }
 
-static struct f_ss_opts_attribute f_ss_opts_isoc_maxburst =
-	__CONFIGFS_ATTR(isoc_maxburst, S_IRUGO | S_IWUSR,
-			f_ss_opts_isoc_maxburst_show,
-			f_ss_opts_isoc_maxburst_store);
-
-static ssize_t f_ss_opts_bulk_buflen_show(struct f_ss_opts *opts, char *page)
+static ssize_t f_ss_opts_bulk_buflen_show(struct config_item *item, char *page)
 {
+	struct f_ss_opts *opts = to_f_ss_opts(item);
 	int result;
 
 	mutex_lock(&opts->lock);
@@ -1145,9 +1126,10 @@ static ssize_t f_ss_opts_bulk_buflen_show(struct f_ss_opts *opts, char *page)
 	return result;
 }
 
-static ssize_t f_ss_opts_bulk_buflen_store(struct f_ss_opts *opts,
+static ssize_t f_ss_opts_bulk_buflen_store(struct config_item *item,
 					   const char *page, size_t len)
 {
+	struct f_ss_opts *opts = to_f_ss_opts(item);
 	int ret;
 	u32 num;
 
@@ -1168,18 +1150,20 @@ end:
 	return ret;
 }
 
-static struct f_ss_opts_attribute f_ss_opts_bulk_buflen =
-	__CONFIGFS_ATTR(buflen, S_IRUGO | S_IWUSR,
-			f_ss_opts_bulk_buflen_show,
-			f_ss_opts_bulk_buflen_store);
+CONFIGFS_ATTR(f_ss_opts_, pattern);
+CONFIGFS_ATTR(f_ss_opts_, isoc_interval);
+CONFIGFS_ATTR(f_ss_opts_, isoc_maxpacket);
+CONFIGFS_ATTR(f_ss_opts_, isoc_mult);
+CONFIGFS_ATTR(f_ss_opts_, isoc_maxburst);
+CONFIGFS_ATTR(f_ss_opts_, bulk_buflen);
 
 static struct configfs_attribute *ss_attrs[] = {
-	&f_ss_opts_pattern.attr,
-	&f_ss_opts_isoc_interval.attr,
-	&f_ss_opts_isoc_maxpacket.attr,
-	&f_ss_opts_isoc_mult.attr,
-	&f_ss_opts_isoc_maxburst.attr,
-	&f_ss_opts_bulk_buflen.attr,
+	&f_ss_opts_attr_pattern,
+	&f_ss_opts_attr_isoc_interval,
+	&f_ss_opts_attr_isoc_maxpacket,
+	&f_ss_opts_attr_isoc_mult,
+	&f_ss_opts_attr_isoc_maxburst,
+	&f_ss_opts_attr_bulk_buflen,
 	NULL,
 };
 
-- 
1.9.1

  parent reply	other threads:[~2015-09-25 13:49 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-25 13:49 simplify configfs attributes Christoph Hellwig
2015-09-25 13:49 ` [PATCH 01/23] configfs: add show and store methods to struct configfs_attribute Christoph Hellwig
2015-09-25 14:28   ` Tejun Heo
2015-09-25 17:41     ` Greg KH
2015-09-26 23:38   ` Nicholas A. Bellinger
2015-09-25 13:49 ` [PATCH 02/23] usb-gadget: use per-attribute show and store methods Christoph Hellwig
2015-09-27 15:47   ` Felipe Balbi
     [not found]     ` <20150927154752.GC16364-HgARHv6XitJaoMGHk7MhZQC/G2K4zDHf@public.gmane.org>
2015-09-28 13:33       ` Christoph Hellwig
     [not found]         ` <20150928133328.GA30453-jcswGhMUV9g@public.gmane.org>
2015-10-01 17:23           ` Felipe Balbi
2015-09-27 15:50   ` Felipe Balbi
2015-09-28 13:35     ` Christoph Hellwig
2015-09-30 16:19       ` Felipe Balbi
2015-09-30 16:20         ` Tejun Heo
2015-09-30 16:32           ` Felipe Balbi
2015-09-30 16:35             ` Tejun Heo
2015-09-30 16:43               ` Felipe Balbi
2015-09-30 16:59                 ` Tejun Heo
     [not found]   ` <1443189000-13398-3-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-09-28 10:54     ` Andrzej Pietrasiewicz
2015-09-25 13:49 ` [PATCH 03/23] usb-gadget/uvc: " Christoph Hellwig
     [not found]   ` <1443189000-13398-4-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-09-28 11:35     ` Andrzej Pietrasiewicz
2015-09-28 13:39       ` Christoph Hellwig
2015-09-25 13:49 ` [PATCH 04/23] usb-gadget/f_hid: " Christoph Hellwig
2015-09-28 11:37   ` Andrzej Pietrasiewicz
2015-09-25 13:49 ` [PATCH 05/23] usb-gadget/f_acm: " Christoph Hellwig
2015-09-28 11:39   ` Andrzej Pietrasiewicz
2015-09-25 13:49 ` [PATCH 06/23] usb-gadget/ether: " Christoph Hellwig
     [not found]   ` <1443189000-13398-7-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-09-28 11:40     ` Andrzej Pietrasiewicz
2015-09-25 13:49 ` [PATCH 08/23] usb-gadget/f_midi: " Christoph Hellwig
     [not found]   ` <1443189000-13398-9-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-09-28 11:47     ` Andrzej Pietrasiewicz
2015-09-25 13:49 ` [PATCH 09/23] usb-gadget/f_printer: " Christoph Hellwig
2015-09-28 11:50   ` Andrzej Pietrasiewicz
2015-09-25 13:49 ` Christoph Hellwig [this message]
2015-09-28 11:51   ` [PATCH 10/23] usb-gadget/f_sourcesink: " Andrzej Pietrasiewicz
2015-09-25 13:49 ` [PATCH 11/23] usb-gadget/f_mass_storage: " Christoph Hellwig
2015-09-28 11:53   ` Andrzej Pietrasiewicz
2015-09-25 13:49 ` [PATCH 12/23] usb-gadget/f_ac1: " Christoph Hellwig
2015-09-28 11:56   ` Andrzej Pietrasiewicz
2015-09-25 13:49 ` [PATCH 13/23] usb-gadget/f_uac2: " Christoph Hellwig
2015-09-28 11:56   ` Andrzej Pietrasiewicz
2015-09-25 13:49 ` [PATCH 14/23] usb-gadget/f_obex: " Christoph Hellwig
2015-09-28 11:57   ` Andrzej Pietrasiewicz
2015-09-25 13:49 ` [PATCH 15/23] usb-gadget/f_phonet: " Christoph Hellwig
2015-09-28 11:59   ` Andrzej Pietrasiewicz
2015-09-25 13:49 ` [PATCH 16/23] usb-gadget/f_serial: " Christoph Hellwig
2015-09-28 11:59   ` Andrzej Pietrasiewicz
2015-09-25 13:49 ` [PATCH 17/23] dlm: " Christoph Hellwig
2015-09-28 14:49   ` David Teigland
2015-09-25 13:49 ` [PATCH 18/23] spear13xx_pcie_gadget: " Christoph Hellwig
2015-09-25 13:49 ` [PATCH 19/23] target: " Christoph Hellwig
2015-09-26 23:35   ` Nicholas A. Bellinger
2015-09-25 13:49 ` [PATCH 22/23] ocfs2/cluster: " Christoph Hellwig
2015-09-25 13:50 ` [PATCH 23/23] configfs: remove old API Christoph Hellwig
2015-09-28 12:06   ` Andrzej Pietrasiewicz
2015-09-28 13:42     ` Christoph Hellwig
     [not found] ` <1443189000-13398-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-09-25 13:49   ` [PATCH 07/23] usb-gadget/f_loopback: use per-attribute show and store methods Christoph Hellwig
2015-09-28 11:46     ` Andrzej Pietrasiewicz
2015-09-28 13:41       ` Christoph Hellwig
2015-09-28 13:52         ` Andrzej Pietrasiewicz
2015-09-25 13:49   ` [PATCH 20/23] netconsole: " Christoph Hellwig
2015-09-25 13:49   ` [PATCH 21/23] ocfs2/cluster: move locking into attribute " Christoph Hellwig
2015-09-25 13:57   ` simplify configfs attributes Christoph Hellwig
2015-09-26 23:49 ` Nicholas A. Bellinger
2015-09-27  6:30   ` Christoph Hellwig
2015-09-28 12:12 ` Andrzej Pietrasiewicz
  -- strict thread matches above, loose matches on Subject: below --
2015-10-03 13:32 simplify configfs attributes V2 Christoph Hellwig
2015-10-03 13:32 ` [PATCH 10/23] usb-gadget/f_sourcesink: use per-attribute show and store methods Christoph Hellwig

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=1443189000-13398-11-git-send-email-hch@lst.de \
    --to=hch@lst.de \
    --cc=akpm@linux-foundation.org \
    --cc=balbi@ti.com \
    --cc=cluster-devel@redhat.com \
    --cc=jlbec@evilplan.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ocfs2-devel@oss.oracle.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 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).