public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Opasiak <k.opasiak@samsung.com>
To: Ruslan Bilovol <ruslan.bilovol@gmail.com>, balbi@ti.com
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	stern@rowland.harvard.edu, peter.chen@freescale.com,
	gregkh@linuxfoundation.org, andrzej.p@samsung.com,
	maxime.ripard@free-electrons.com
Subject: Re: [PATCH v5 2/5] usb: gadget: configfs: pass UDC name via usb_gadget_driver struct
Date: Tue, 23 Jun 2015 08:54:09 +0200	[thread overview]
Message-ID: <55890291.4010301@samsung.com> (raw)
In-Reply-To: <1435010474-13419-3-git-send-email-ruslan.bilovol@gmail.com>

Hello,

On 06/23/2015 12:01 AM, Ruslan Bilovol wrote:
> Now when udc-core supports binding to specific UDC by passing
> its name via 'udc_name' member of usb_gadget_driver struct,
> switch to this generic approach.
>
> Tested-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
> ---
>   drivers/usb/gadget/configfs.c | 27 ++++++++++++++-------------
>   1 file changed, 14 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
> index c42765b..efad021 100644
> --- a/drivers/usb/gadget/configfs.c
> +++ b/drivers/usb/gadget/configfs.c
> @@ -54,7 +54,6 @@ struct gadget_info {
>   	struct list_head string_list;
>   	struct list_head available_func;
>
> -	const char *udc_name;
>   #ifdef CONFIG_USB_OTG
>   	struct usb_otg_descriptor otg;
>   #endif
> @@ -230,21 +229,21 @@ static ssize_t gadget_dev_desc_bcdUSB_store(struct gadget_info *gi,
>
>   static ssize_t gadget_dev_desc_UDC_show(struct gadget_info *gi, char *page)
>   {
> -	return sprintf(page, "%s\n", gi->udc_name ?: "");
> +	return sprintf(page, "%s\n", gi->composite.gadget_driver.udc_name ?: "");
>   }
>
>   static int unregister_gadget(struct gadget_info *gi)
>   {
>   	int ret;
>
> -	if (!gi->udc_name)
> +	if (!gi->composite.gadget_driver.udc_name)
>   		return -ENODEV;
>
>   	ret = usb_gadget_unregister_driver(&gi->composite.gadget_driver);
>   	if (ret)
>   		return ret;
> -	kfree(gi->udc_name);
> -	gi->udc_name = NULL;
> +	kfree(gi->composite.gadget_driver.udc_name);
> +	gi->composite.gadget_driver.udc_name = NULL;
>   	return 0;
>   }
>
> @@ -267,14 +266,16 @@ static ssize_t gadget_dev_desc_UDC_store(struct gadget_info *gi,
>   		if (ret)
>   			goto err;
>   	} else {
> -		if (gi->udc_name) {
> +		if (gi->composite.gadget_driver.udc_name) {

You are using this very long if condition in a few places, maybe it 
would be more suitable to define a macro or inline function for this? 
Something like gadget_dev_bound() or gadget_dev_is_active() or some 
other more suitable name.

Best regards,
-- 
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2015-06-23  6:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-22 22:01 [PATCH v5 0/5] usb/gadget: independent registration of gadgets and gadget drivers Ruslan Bilovol
2015-06-22 22:01 ` [PATCH v5 1/5] usb: gadget: bind UDC by name passed via usb_gadget_driver structure Ruslan Bilovol
2015-06-22 22:01 ` [PATCH v5 2/5] usb: gadget: configfs: pass UDC name via usb_gadget_driver struct Ruslan Bilovol
2015-06-23  6:54   ` Krzysztof Opasiak [this message]
2015-06-27 14:33     ` Ruslan Bilovol
2015-06-22 22:01 ` [PATCH v5 3/5] usb: gadget: udc-core: remove unused usb_udc_attach_driver() Ruslan Bilovol
2015-06-22 22:01 ` [PATCH v5 4/5] usb: gadget: legacy: don't use __init/__exit attributes for bind/unbind path Ruslan Bilovol
2015-06-22 22:01 ` [PATCH v5 5/5] usb: gadget: udc-core: independent registration of gadgets and gadget drivers Ruslan Bilovol
2015-06-23 14:08   ` Alan Stern
2015-06-27 22:37     ` Ruslan Bilovol
2015-06-27 23:47       ` Alan Stern
2015-07-06 17:38         ` Felipe Balbi
2015-10-19  8:11 ` [PATCH v5 0/5] usb/gadget: " Maxime Ripard
2015-11-02 16:44   ` Ruslan Bilovol
2015-11-09  0:07     ` Maxime Ripard

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=55890291.4010301@samsung.com \
    --to=k.opasiak@samsung.com \
    --cc=andrzej.p@samsung.com \
    --cc=balbi@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=peter.chen@freescale.com \
    --cc=ruslan.bilovol@gmail.com \
    --cc=stern@rowland.harvard.edu \
    /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