public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Andrzej Pietrasiewicz <andrzej.p@samsung•com>
To: Christoph Hellwig <hch@lst•de>, Joel Becker <jlbec@evilplan•org>,
	Andrew Morton <akpm@linux-foundation•org>
Cc: Felipe Balbi <balbi@ti•com>, Tejun Heo <tj@kernel•org>,
	Pratyush Anand <pratyush.anand@gmail•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: Re: [PATCH 11/23] usb-gadget/f_mass_storage: use per-attribute show and store methods
Date: Mon, 28 Sep 2015 13:53:20 +0200	[thread overview]
Message-ID: <56092A30.8000800@samsung.com> (raw)
In-Reply-To: <1443189000-13398-12-git-send-email-hch@lst.de>

Hi Christoph,

The same remark as for f_loopback (__CONFIGFS_ATTR location vs
CONFIGFS_ATTR location after applying)

If addressed

Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung•com>

W dniu 25.09.2015 o 15:49, Christoph Hellwig pisze:
> Signed-off-by: Christoph Hellwig <hch@lst•de>
> ---
>   drivers/usb/gadget/function/f_mass_storage.c | 123 ++++++++++-----------------
>   1 file changed, 46 insertions(+), 77 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
> index a6eb537..db71ae9 100644
> --- a/drivers/usb/gadget/function/f_mass_storage.c
> +++ b/drivers/usb/gadget/function/f_mass_storage.c
> @@ -3144,9 +3144,6 @@ static inline struct fsg_opts *to_fsg_opts(struct config_item *item)
>   			    func_inst.group);
>   }
>
> -CONFIGFS_ATTR_STRUCT(fsg_lun_opts);
> -CONFIGFS_ATTR_OPS(fsg_lun_opts);
> -
>   static void fsg_lun_attr_release(struct config_item *item)
>   {
>   	struct fsg_lun_opts *lun_opts;
> @@ -3157,110 +3154,89 @@ static void fsg_lun_attr_release(struct config_item *item)
>
>   static struct configfs_item_operations fsg_lun_item_ops = {
>   	.release		= fsg_lun_attr_release,
> -	.show_attribute		= fsg_lun_opts_attr_show,
> -	.store_attribute	= fsg_lun_opts_attr_store,
>   };
>
> -static ssize_t fsg_lun_opts_file_show(struct fsg_lun_opts *opts, char *page)
> +static ssize_t fsg_lun_opts_file_show(struct config_item *item, char *page)
>   {
> -	struct fsg_opts *fsg_opts;
> -
> -	fsg_opts = to_fsg_opts(opts->group.cg_item.ci_parent);
> +	struct fsg_lun_opts *opts = to_fsg_lun_opts(item);
> +	struct fsg_opts *fsg_opts = to_fsg_opts(opts->group.cg_item.ci_parent);
>
>   	return fsg_show_file(opts->lun, &fsg_opts->common->filesem, page);
>   }
>
> -static ssize_t fsg_lun_opts_file_store(struct fsg_lun_opts *opts,
> +static ssize_t fsg_lun_opts_file_store(struct config_item *item,
>   				       const char *page, size_t len)
>   {
> -	struct fsg_opts *fsg_opts;
> -
> -	fsg_opts = to_fsg_opts(opts->group.cg_item.ci_parent);
> +	struct fsg_lun_opts *opts = to_fsg_lun_opts(item);
> +	struct fsg_opts *fsg_opts = to_fsg_opts(opts->group.cg_item.ci_parent);
>
>   	return fsg_store_file(opts->lun, &fsg_opts->common->filesem, page, len);
>   }
>
> -static struct fsg_lun_opts_attribute fsg_lun_opts_file =
> -	__CONFIGFS_ATTR(file, S_IRUGO | S_IWUSR, fsg_lun_opts_file_show,
> -			fsg_lun_opts_file_store);
> -
> -static ssize_t fsg_lun_opts_ro_show(struct fsg_lun_opts *opts, char *page)
> +static ssize_t fsg_lun_opts_ro_show(struct config_item *item, char *page)
>   {
> -	return fsg_show_ro(opts->lun, page);
> +	return fsg_show_ro(to_fsg_lun_opts(item)->lun, page);
>   }
>
> -static ssize_t fsg_lun_opts_ro_store(struct fsg_lun_opts *opts,
> +static ssize_t fsg_lun_opts_ro_store(struct config_item *item,
>   				       const char *page, size_t len)
>   {
> -	struct fsg_opts *fsg_opts;
> -
> -	fsg_opts = to_fsg_opts(opts->group.cg_item.ci_parent);
> +	struct fsg_lun_opts *opts = to_fsg_lun_opts(item);
> +	struct fsg_opts *fsg_opts = to_fsg_opts(opts->group.cg_item.ci_parent);
>
>   	return fsg_store_ro(opts->lun, &fsg_opts->common->filesem, page, len);
>   }
>
> -static struct fsg_lun_opts_attribute fsg_lun_opts_ro =
> -	__CONFIGFS_ATTR(ro, S_IRUGO | S_IWUSR, fsg_lun_opts_ro_show,
> -			fsg_lun_opts_ro_store);
> -
> -static ssize_t fsg_lun_opts_removable_show(struct fsg_lun_opts *opts,
> +static ssize_t fsg_lun_opts_removable_show(struct config_item *item,
>   					   char *page)
>   {
> -	return fsg_show_removable(opts->lun, page);
> +	return fsg_show_removable(to_fsg_lun_opts(item)->lun, page);
>   }
>
> -static ssize_t fsg_lun_opts_removable_store(struct fsg_lun_opts *opts,
> +static ssize_t fsg_lun_opts_removable_store(struct config_item *item,
>   				       const char *page, size_t len)
>   {
> -	return fsg_store_removable(opts->lun, page, len);
> +	return fsg_store_removable(to_fsg_lun_opts(item)->lun, page, len);
>   }
>
> -static struct fsg_lun_opts_attribute fsg_lun_opts_removable =
> -	__CONFIGFS_ATTR(removable, S_IRUGO | S_IWUSR,
> -			fsg_lun_opts_removable_show,
> -			fsg_lun_opts_removable_store);
> -
> -static ssize_t fsg_lun_opts_cdrom_show(struct fsg_lun_opts *opts, char *page)
> +static ssize_t fsg_lun_opts_cdrom_show(struct config_item *item, char *page)
>   {
> -	return fsg_show_cdrom(opts->lun, page);
> +	return fsg_show_cdrom(to_fsg_lun_opts(item)->lun, page);
>   }
>
> -static ssize_t fsg_lun_opts_cdrom_store(struct fsg_lun_opts *opts,
> +static ssize_t fsg_lun_opts_cdrom_store(struct config_item *item,
>   				       const char *page, size_t len)
>   {
> -	struct fsg_opts *fsg_opts;
> -
> -	fsg_opts = to_fsg_opts(opts->group.cg_item.ci_parent);
> +	struct fsg_lun_opts *opts = to_fsg_lun_opts(item);
> +	struct fsg_opts *fsg_opts = to_fsg_opts(opts->group.cg_item.ci_parent);
>
>   	return fsg_store_cdrom(opts->lun, &fsg_opts->common->filesem, page,
>   			       len);
>   }
>
> -static struct fsg_lun_opts_attribute fsg_lun_opts_cdrom =
> -	__CONFIGFS_ATTR(cdrom, S_IRUGO | S_IWUSR, fsg_lun_opts_cdrom_show,
> -			fsg_lun_opts_cdrom_store);
> -
> -static ssize_t fsg_lun_opts_nofua_show(struct fsg_lun_opts *opts, char *page)
> +static ssize_t fsg_lun_opts_nofua_show(struct config_item *item, char *page)
>   {
> -	return fsg_show_nofua(opts->lun, page);
> +	return fsg_show_nofua(to_fsg_lun_opts(item)->lun, page);
>   }
>
> -static ssize_t fsg_lun_opts_nofua_store(struct fsg_lun_opts *opts,
> +static ssize_t fsg_lun_opts_nofua_store(struct config_item *item,
>   				       const char *page, size_t len)
>   {
> -	return fsg_store_nofua(opts->lun, page, len);
> +	return fsg_store_nofua(to_fsg_lun_opts(item)->lun, page, len);
>   }
>
> -static struct fsg_lun_opts_attribute fsg_lun_opts_nofua =
> -	__CONFIGFS_ATTR(nofua, S_IRUGO | S_IWUSR, fsg_lun_opts_nofua_show,
> -			fsg_lun_opts_nofua_store);
> +CONFIGFS_ATTR(fsg_lun_opts_, file);
> +CONFIGFS_ATTR(fsg_lun_opts_, ro);
> +CONFIGFS_ATTR(fsg_lun_opts_, removable);
> +CONFIGFS_ATTR(fsg_lun_opts_, cdrom);
> +CONFIGFS_ATTR(fsg_lun_opts_, nofua);
>
>   static struct configfs_attribute *fsg_lun_attrs[] = {
> -	&fsg_lun_opts_file.attr,
> -	&fsg_lun_opts_ro.attr,
> -	&fsg_lun_opts_removable.attr,
> -	&fsg_lun_opts_cdrom.attr,
> -	&fsg_lun_opts_nofua.attr,
> +	&fsg_lun_opts_attr_file,
> +	&fsg_lun_opts_attr_ro,
> +	&fsg_lun_opts_attr_removable,
> +	&fsg_lun_opts_attr_cdrom,
> +	&fsg_lun_opts_attr_nofua,
>   	NULL,
>   };
>
> @@ -3352,9 +3328,6 @@ static void fsg_lun_drop(struct config_group *group, struct config_item *item)
>   	config_item_put(item);
>   }
>
> -CONFIGFS_ATTR_STRUCT(fsg_opts);
> -CONFIGFS_ATTR_OPS(fsg_opts);
> -
>   static void fsg_attr_release(struct config_item *item)
>   {
>   	struct fsg_opts *opts = to_fsg_opts(item);
> @@ -3364,12 +3337,11 @@ static void fsg_attr_release(struct config_item *item)
>
>   static struct configfs_item_operations fsg_item_ops = {
>   	.release		= fsg_attr_release,
> -	.show_attribute		= fsg_opts_attr_show,
> -	.store_attribute	= fsg_opts_attr_store,
>   };
>
> -static ssize_t fsg_opts_stall_show(struct fsg_opts *opts, char *page)
> +static ssize_t fsg_opts_stall_show(struct config_item *item, char *page)
>   {
> +	struct fsg_opts *opts = to_fsg_opts(item);
>   	int result;
>
>   	mutex_lock(&opts->lock);
> @@ -3379,9 +3351,10 @@ static ssize_t fsg_opts_stall_show(struct fsg_opts *opts, char *page)
>   	return result;
>   }
>
> -static ssize_t fsg_opts_stall_store(struct fsg_opts *opts, const char *page,
> +static ssize_t fsg_opts_stall_store(struct config_item *item, const char *page,
>   				    size_t len)
>   {
> +	struct fsg_opts *opts = to_fsg_opts(item);
>   	int ret;
>   	bool stall;
>
> @@ -3403,13 +3376,12 @@ static ssize_t fsg_opts_stall_store(struct fsg_opts *opts, const char *page,
>   	return ret;
>   }
>
> -static struct fsg_opts_attribute fsg_opts_stall =
> -	__CONFIGFS_ATTR(stall, S_IRUGO | S_IWUSR, fsg_opts_stall_show,
> -			fsg_opts_stall_store);
> +CONFIGFS_ATTR(fsg_opts_, stall);
>
>   #ifdef CONFIG_USB_GADGET_DEBUG_FILES
> -static ssize_t fsg_opts_num_buffers_show(struct fsg_opts *opts, char *page)
> +static ssize_t fsg_opts_num_buffers_show(struct config_item *item, char *page)
>   {
> +	struct fsg_opts *opts = to_fsg_opts(item);
>   	int result;
>
>   	mutex_lock(&opts->lock);
> @@ -3419,9 +3391,10 @@ static ssize_t fsg_opts_num_buffers_show(struct fsg_opts *opts, char *page)
>   	return result;
>   }
>
> -static ssize_t fsg_opts_num_buffers_store(struct fsg_opts *opts,
> +static ssize_t fsg_opts_num_buffers_store(struct config_item *item,
>   					  const char *page, size_t len)
>   {
> +	struct fsg_opts *opts = to_fsg_opts(item);
>   	int ret;
>   	u8 num;
>
> @@ -3446,17 +3419,13 @@ end:
>   	return ret;
>   }
>
> -static struct fsg_opts_attribute fsg_opts_num_buffers =
> -	__CONFIGFS_ATTR(num_buffers, S_IRUGO | S_IWUSR,
> -			fsg_opts_num_buffers_show,
> -			fsg_opts_num_buffers_store);
> -
> +CONFIGFS_ATTR(fsg_opts_, num_buffers);
>   #endif
>
>   static struct configfs_attribute *fsg_attrs[] = {
> -	&fsg_opts_stall.attr,
> +	&fsg_opts_attr_stall,
>   #ifdef CONFIG_USB_GADGET_DEBUG_FILES
> -	&fsg_opts_num_buffers.attr,
> +	&fsg_opts_attr_num_buffers,
>   #endif
>   	NULL,
>   };
>

  reply	other threads:[~2015-09-28 11:53 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
     [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: " 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-25 13:49 ` [PATCH 08/23] usb-gadget/f_midi: use per-attribute show and store methods 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 ` [PATCH 10/23] usb-gadget/f_sourcesink: " Christoph Hellwig
2015-09-28 11:51   ` Andrzej Pietrasiewicz
2015-09-25 13:49 ` [PATCH 11/23] usb-gadget/f_mass_storage: " Christoph Hellwig
2015-09-28 11:53   ` Andrzej Pietrasiewicz [this message]
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
2015-09-26 23:49 ` simplify configfs attributes 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 11/23] usb-gadget/f_mass_storage: 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=56092A30.8000800@samsung.com \
    --to=andrzej.p@samsung$(echo .)com \
    --cc=akpm@linux-foundation$(echo .)org \
    --cc=balbi@ti$(echo .)com \
    --cc=cluster-devel@redhat$(echo .)com \
    --cc=hch@lst$(echo .)de \
    --cc=jlbec@evilplan$(echo .)org \
    --cc=linux-usb@vger$(echo .)kernel.org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=ocfs2-devel@oss$(echo .)oracle.com \
    --cc=pratyush.anand@gmail$(echo .)com \
    --cc=target-devel@vger$(echo .)kernel.org \
    --cc=tj@kernel$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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