public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Baldyga <r.baldyga@samsung.com>
To: balbi@ti.com
Cc: gregkh@linuxfoundation.org, m.szyprowski@samsung.com,
	andrzej.p@samsung.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/5] usb: gadget: Fix gadget deactivaton feature
Date: Wed, 27 May 2015 08:59:45 +0200	[thread overview]
Message-ID: <55656B61.1000708@samsung.com> (raw)
In-Reply-To: <20150526170810.GR26599@saruman.tx.rr.com>

Hi Felipe,

On 05/26/2015 07:08 PM, Felipe Balbi wrote:
> On Mon, May 04, 2015 at 02:55:10PM +0200, Robert Baldyga wrote:
>> Hi,
>>
>> This patch set introduces two functions usb_gadget_deactivate() and
>> usb_gadget_activate(), designed to prevent udc-core from showing binded
>> gadget to host until it will be ready to work. It also makes
>> usb_function_deactivate()/activate() using these functions.
>>
>> So far gadget deactivation was made by calling usb_gadget_disconnect(),
>> but since we have usb_gadget_connect() called after gadget->bind()
>> (in udc_bind_to_driver()) this method doesn't provide expected result.
>> Calling function usb_gadget_disconnect() before gadget connection doesn't
>> prevent udc-core from connecting gadget to driver - usb_gadget_disconnect()
>> call is ignored and gadget is connected regardless to it. This usually
>> results with errors, for example because we binded gadget with 0
>> configurations.
>>
>> This patch set fixes this problem adding functions allowing to perform
>> effective gadget deactivation from gadget->bind().
>>
>> According to Felipe's suggestion, in v2 there is one new patch adding
>> 'bind_deactivated' flag, which should be used by functions which want
>> to be binded as deactivated (for example because they need to wait for
>> userspace daemon). Functions using this flag have to call
>> usb_function_activate() to tell composite core they are ready to work.
>> I have also converted functions which are using deactivation feature
>> to make them using 'bind_deactivated' flag. Patches are also attached
>> to this patch set.
>>
>> I was considering removing usb_function_deactivate() function since we
>> have this flag, but I see that some of USB functions use it not only
>> in bind() but also e.g. when userspace daemon disconnects. This is also
>> the reason why I haven't named this flag 'controls_pullup', because this
>> name doesn't describe precisely what does it mean.
>>
>> We also need to consider what to do when deactivation fails (which can
>> happen if our UDC driver doesn't support the pullup callback). So far,
>> when usb_function_deactivate() was called in bind(), we have had ability
>> to decide what to do, when it fails. Now we preform function deactivation
>> before its bind(), and when deactivation fails we fail to add the function
>> to gadget. Maybe we should to allow it to continue despite deactivation
>> failure and inform function (somehow) about this situation. If only it
>> makes any sense, because in this form it looks more complicated that
>> it was, and moreover it actually doesn't add any new features.
> 
> I'll defer this series for v4.3 merge window because I'm still not
> entirely convinced we need this new reference counter. Sorry about that.
> 

What reference counter did you mean?

Thanks,
Robert

      reply	other threads:[~2015-05-27  6:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-04 12:55 [PATCH v2 0/5] usb: gadget: Fix gadget deactivaton feature Robert Baldyga
2015-05-04 12:55 ` [PATCH v2 1/5] usb: gadget: add usb_gadget_activate/deactivate functions Robert Baldyga
2015-05-04 12:55 ` [PATCH v2 2/5] usb: composite: fix usb_function_activate/deactivate functions Robert Baldyga
2015-05-04 12:55 ` [PATCH v2 3/5] usb: composite: add bind_deactivated flag to usb_function Robert Baldyga
2015-05-04 12:55 ` [PATCH v2 4/5] usb: gadget: f_uvc: use bind_deactivated flag Robert Baldyga
2015-05-04 12:55 ` [PATCH v2 5/5] usb: gadget: f_obex: " Robert Baldyga
2015-05-26 17:08 ` [PATCH v2 0/5] usb: gadget: Fix gadget deactivaton feature Felipe Balbi
2015-05-27  6:59   ` Robert Baldyga [this message]

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=55656B61.1000708@samsung.com \
    --to=r.baldyga@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=m.szyprowski@samsung.com \
    /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