Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1225403

Re: [PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct usb_ep

From Felipe Balbi <balbi@ti.com>
Newsgroups linux.kernel
Subject Re: [PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct usb_ep
Date 2015-09-15 18:40 +0200
Message-ID <q91qX-1Tn-47@gated-at.bofh.it> (permalink)
References <q8Zp8-7qt-7@gated-at.bofh.it> <q8ZIu-7Nu-1@gated-at.bofh.it> <q90uR-xv-9@gated-at.bofh.it> <q90Ex-Jd-7@gated-at.bofh.it> <q917A-1wr-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/26] usb: gadget: encapsulate ep enable/disable Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:30 +0200
  [PATCH 20/26] usb: gadget: f_uac1: eliminate abuse of ep->driver data Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:40 +0200
  [PATCH 21/26] usb: gadget: f_uac2: eliminate abuse of ep->driver data Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:40 +0200
  [PATCH 13/26] usb: gadget: f_obex: eliminate abuse of ep->driver data Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:40 +0200
  [PATCH 23/26] usb: gadget: u_ether: eliminate abuse of ep->driver data Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:40 +0200
  [PATCH 25/26] usb: gadget: legacy: dbgp: eliminate abuse of ep->driver  data Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:40 +0200
  [PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct usb_ep Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:50 +0200
    Re: [PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct  usb_ep Krzysztof Opasiak <k.opasiak@samsung.com> - 2015-09-15 17:40 +0200
      Re: [PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct  usb_ep Felipe Balbi <balbi@ti.com> - 2015-09-15 17:50 +0200
        Re: [PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct  usb_ep Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 18:00 +0200
          Re: [PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct  usb_ep Felipe Balbi <balbi@ti.com> - 2015-09-15 18:10 +0200
        Re: [PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct  usb_ep Krzysztof Opasiak <k.opasiak@samsung.com> - 2015-09-15 18:20 +0200
          Re: [PATCH 04/26] usb: gadget: introduce 'enabled' flag in struct  usb_ep Felipe Balbi <balbi@ti.com> - 2015-09-15 18:40 +0200
  [PATCH 02/26] usb: gadget: f_ncm: obtain cdev from function instead of  driver_data Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:50 +0200
  [PATCH 01/26] usb: gadget: fix few outdated comments Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:50 +0200
  [PATCH 07/26] usb: gadget: f_eem: eliminate abuse of ep->driver data Robert Baldyga <r.baldyga@samsung.com> - 2015-09-15 16:50 +0200

csiph-web