All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Krzysztof Opasiak <k.opasiak@samsung.com>
Cc: <balbi@ti.com>, Robert Baldyga <r.baldyga@samsung.com>,
	<gregkh@linuxfoundation.org>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <b.zolnierkie@samsung.com>,
	<m.szyprowski@samsung.com>, <andrzej.p@samsung.com>
Subject: Re: [PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct usb_ep
Date: Tue, 15 Sep 2015 11:30:48 -0500	[thread overview]
Message-ID: <20150915163048.GL19948@saruman.tx.rr.com> (raw)
In-Reply-To: <55F8441D.5080301@samsung.com>

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

Hi,

On Tue, Sep 15, 2015 at 06:15:25PM +0200, Krzysztof Opasiak wrote:
> >>>+	}
> >>>+
> >>>+	return ret;
> >>>  }
> >>>
> >>
> >>Personally I don't like this convention. In my opinion usb_ep_disable() &
> >>usb_ep_enable() should fail if ep is already disabled/enabled. Then in
> >>function code we should check if endpoint is enabled (maybe even we should
> >>have usb_ep_is_enabled()) and call disable only when it is really enabled.
> >
> >usb_ep_is_enabled() should be a good addition but I don't see an issue
> >ignoring usb_ep_enabled() for something that's already enabled.
> >
> >Imagine if you got an error when you tried to push the light switch to
> >the 'on' position while the light was already on :-p
> >
> 
> Hmmm not sure right now, didn't test this recently :D as usually I check if
> light isn't already "on" before I touch the switch to turn it on:P

not my best analogy :)

> Just joking. Personally I just prefer to don't touch things which are
> already in desired condition. Let's take close() as example which
> could be a little bit equivalent of our usb_ep_disable(). It is not
> legal to call it twice on some fd and second call ends up with error.

I understand that, it's just the difference between adding
usb_ep_is_enabled() to every single gadget/function driver or adding it
to usb_ep_enable() itself to keep gadget/function drivers cleaner.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-09-15 16:30 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-15 14:26 [PATCH 00/26] usb: gadget: encapsulate ep enable/disable Robert Baldyga
2015-09-15 14:26 ` [PATCH 01/26] usb: gadget: fix few outdated comments Robert Baldyga
2015-09-15 14:26 ` [PATCH 02/26] usb: gadget: f_ncm: obtain cdev from function instead of driver_data Robert Baldyga
2015-09-15 14:26 ` [PATCH 03/26] usb: gadget: epautoconf: add usb_ep_autoconfig_release() function Robert Baldyga
2015-09-15 14:26 ` [PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct usb_ep Robert Baldyga
2015-09-15 15:37   ` Krzysztof Opasiak
2015-09-15 15:43     ` Felipe Balbi
2015-09-15 15:57       ` Robert Baldyga
2015-09-15 16:01         ` Felipe Balbi
2015-09-15 16:15       ` Krzysztof Opasiak
2015-09-15 16:30         ` Felipe Balbi [this message]
2015-09-15 14:26 ` [PATCH 05/26] usb: gadget: f_ecm: eliminate abuse of ep->driver data Robert Baldyga
2015-09-15 15:45   ` Krzysztof Opasiak
2015-09-16  9:49     ` Robert Baldyga
2015-09-15 14:26 ` [PATCH 06/26] usb: gadget: f_acm: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 07/26] usb: gadget: f_eem: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 08/26] usb: gadget: f_hid: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 09/26] usb: gadget: f_loopback: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 10/26] usb: gadget: f_mass_storage: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 11/26] usb: gadget: f_midi: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 12/26] usb: gadget: f_ncm: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 13/26] usb: gadget: f_obex: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 14/26] usb: gadget: f_phonet: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 15/26] usb: gadget: f_printer: " Robert Baldyga
2015-09-15 14:26 ` [PATCH 16/26] usb: gadget: f_rndis: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 17/26] usb: gadget: f_serial: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 18/26] usb: gadget: f_sourcesink: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 19/26] usb: gadget: f_subset: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 20/26] usb: gadget: f_uac1: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 21/26] usb: gadget: f_uac2: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 22/26] usb: gadget: f_uvc: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 23/26] usb: gadget: u_ether: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 24/26] usb: gadget: u_serial: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 25/26] usb: gadget: legacy: dbgp: " Robert Baldyga
2015-09-15 14:27 ` [PATCH 26/26] usb: gadget: legacy: tcm: " Robert Baldyga

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=20150915163048.GL19948@saruman.tx.rr.com \
    --to=balbi@ti.com \
    --cc=andrzej.p@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=k.opasiak@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=r.baldyga@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 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.