diff mbox series

[U-Boot,6/8] usb: add usb_submit_int_msg_nonblock

Message ID 28844f682ed31648b5f0d812aeff18b2458baa6c.1561996556.git.msuchanek@suse.de
State Superseded
Delegated to: Marek Vasut
Headers show
Series [U-Boot,1/8] usb: r8a66597: return -ENOTSUPP from unimplemented submit_int_msg | expand

Commit Message

Michal Suchánek July 1, 2019, 3:56 p.m. UTC
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
 common/usb.c  | 9 +++++++++
 include/usb.h | 2 ++
 2 files changed, 11 insertions(+)

Comments

Marek Vasut July 2, 2019, 11:59 a.m. UTC | #1
On 7/1/19 5:56 PM, Michal Suchanek wrote:
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> ---
>  common/usb.c  | 9 +++++++++
>  include/usb.h | 2 ++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/common/usb.c b/common/usb.c
> index 3ae71c98aaf4..d8302d39a91a 100644
> --- a/common/usb.c
> +++ b/common/usb.c
> @@ -200,6 +200,15 @@ int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
>  	return submit_int_msg(dev, pipe, buffer, transfer_len, interval, false);
>  }
>  
> +/*
> + * submits an Interrupt Message without retry
> + */
> +int usb_submit_int_msg_nonblock(struct usb_device *dev, unsigned long pipe,
> +			void *buffer, int transfer_len, int interval)
> +{
> +	return submit_int_msg(dev, pipe, buffer, transfer_len, interval, true);
> +}

Is this wrapper really necessary ?

>  /*
>   * submits a control message and waits for comletion (at least timeout * 1ms)
>   * If timeout is 0, we don't wait for completion (used as example to set and
> diff --git a/include/usb.h b/include/usb.h
> index dde3e601da45..d1e7112f4c4e 100644
> --- a/include/usb.h
> +++ b/include/usb.h
> @@ -263,6 +263,8 @@ int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
>  			void *data, int len, int *actual_length, int timeout);
>  int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
>  			void *buffer, int transfer_len, int interval);
> +int usb_submit_int_msg_nonblock(struct usb_device *dev, unsigned long pipe,
> +			void *buffer, int transfer_len, int interval);
>  int usb_disable_asynch(int disable);
>  int usb_maxpacket(struct usb_device *dev, unsigned long pipe);
>  int usb_get_configuration_no(struct usb_device *dev, int cfgno,
>
Michal Suchánek July 2, 2019, 2:14 p.m. UTC | #2
On Tue, 2 Jul 2019 13:59:49 +0200
Marek Vasut <marex@denx.de> wrote:

> On 7/1/19 5:56 PM, Michal Suchanek wrote:
> > Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> > ---
> >  common/usb.c  | 9 +++++++++
> >  include/usb.h | 2 ++
> >  2 files changed, 11 insertions(+)
> > 
> > diff --git a/common/usb.c b/common/usb.c
> > index 3ae71c98aaf4..d8302d39a91a 100644
> > --- a/common/usb.c
> > +++ b/common/usb.c
> > @@ -200,6 +200,15 @@ int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
> >  	return submit_int_msg(dev, pipe, buffer, transfer_len, interval, false);
> >  }
> >  
> > +/*
> > + * submits an Interrupt Message without retry
> > + */
> > +int usb_submit_int_msg_nonblock(struct usb_device *dev, unsigned long pipe,
> > +			void *buffer, int transfer_len, int interval)
> > +{
> > +	return submit_int_msg(dev, pipe, buffer, transfer_len, interval, true);
> > +}  
> 
> Is this wrapper really necessary ?
> 

Avoids changing other users of the code. Not that there are that many,
anyway.

Thanks

Michal
Bin Meng July 2, 2019, 2:16 p.m. UTC | #3
Hi Michal,

On Tue, Jul 2, 2019 at 10:14 PM Michal Suchánek <msuchanek@suse.de> wrote:
>
> On Tue, 2 Jul 2019 13:59:49 +0200
> Marek Vasut <marex@denx.de> wrote:
>
> > On 7/1/19 5:56 PM, Michal Suchanek wrote:
> > > Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> > > ---
> > >  common/usb.c  | 9 +++++++++
> > >  include/usb.h | 2 ++
> > >  2 files changed, 11 insertions(+)
> > >
> > > diff --git a/common/usb.c b/common/usb.c
> > > index 3ae71c98aaf4..d8302d39a91a 100644
> > > --- a/common/usb.c
> > > +++ b/common/usb.c
> > > @@ -200,6 +200,15 @@ int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
> > >     return submit_int_msg(dev, pipe, buffer, transfer_len, interval, false);
> > >  }
> > >
> > > +/*
> > > + * submits an Interrupt Message without retry
> > > + */
> > > +int usb_submit_int_msg_nonblock(struct usb_device *dev, unsigned long pipe,
> > > +                   void *buffer, int transfer_len, int interval)
> > > +{
> > > +   return submit_int_msg(dev, pipe, buffer, transfer_len, interval, true);
> > > +}
> >
> > Is this wrapper really necessary ?
> >
>
> Avoids changing other users of the code. Not that there are that many,
> anyway.

Then I wonder why not change your codes to call submit_int_msg() instead?

Regards,
Bin
Michal Suchánek July 2, 2019, 2:25 p.m. UTC | #4
On Tue, 2 Jul 2019 22:16:02 +0800
Bin Meng <bmeng.cn@gmail.com> wrote:

> Hi Michal,
> 
> On Tue, Jul 2, 2019 at 10:14 PM Michal Suchánek <msuchanek@suse.de> wrote:
> >
> > On Tue, 2 Jul 2019 13:59:49 +0200
> > Marek Vasut <marex@denx.de> wrote:
> >  
> > > On 7/1/19 5:56 PM, Michal Suchanek wrote:  
> > > > Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> > > > ---
> > > >  common/usb.c  | 9 +++++++++
> > > >  include/usb.h | 2 ++
> > > >  2 files changed, 11 insertions(+)
> > > >
> > > > diff --git a/common/usb.c b/common/usb.c
> > > > index 3ae71c98aaf4..d8302d39a91a 100644
> > > > --- a/common/usb.c
> > > > +++ b/common/usb.c
> > > > @@ -200,6 +200,15 @@ int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
> > > >     return submit_int_msg(dev, pipe, buffer, transfer_len, interval, false);
> > > >  }
> > > >
> > > > +/*
> > > > + * submits an Interrupt Message without retry
> > > > + */
> > > > +int usb_submit_int_msg_nonblock(struct usb_device *dev, unsigned long pipe,
> > > > +                   void *buffer, int transfer_len, int interval)
> > > > +{
> > > > +   return submit_int_msg(dev, pipe, buffer, transfer_len, interval, true);
> > > > +}  
> > >
> > > Is this wrapper really necessary ?
> > >  
> >
> > Avoids changing other users of the code. Not that there are that many,
> > anyway.  
> 
> Then I wonder why not change your codes to call submit_int_msg() instead?
> 
Why do we have usb_submit_int_msg in the first place?

Thanks

Michal
Bin Meng July 2, 2019, 2:29 p.m. UTC | #5
Hi Michal,

On Tue, Jul 2, 2019 at 10:25 PM Michal Suchánek <msuchanek@suse.de> wrote:
>
> On Tue, 2 Jul 2019 22:16:02 +0800
> Bin Meng <bmeng.cn@gmail.com> wrote:
>
> > Hi Michal,
> >
> > On Tue, Jul 2, 2019 at 10:14 PM Michal Suchánek <msuchanek@suse.de> wrote:
> > >
> > > On Tue, 2 Jul 2019 13:59:49 +0200
> > > Marek Vasut <marex@denx.de> wrote:
> > >
> > > > On 7/1/19 5:56 PM, Michal Suchanek wrote:
> > > > > Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> > > > > ---
> > > > >  common/usb.c  | 9 +++++++++
> > > > >  include/usb.h | 2 ++
> > > > >  2 files changed, 11 insertions(+)
> > > > >
> > > > > diff --git a/common/usb.c b/common/usb.c
> > > > > index 3ae71c98aaf4..d8302d39a91a 100644
> > > > > --- a/common/usb.c
> > > > > +++ b/common/usb.c
> > > > > @@ -200,6 +200,15 @@ int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
> > > > >     return submit_int_msg(dev, pipe, buffer, transfer_len, interval, false);
> > > > >  }
> > > > >
> > > > > +/*
> > > > > + * submits an Interrupt Message without retry
> > > > > + */
> > > > > +int usb_submit_int_msg_nonblock(struct usb_device *dev, unsigned long pipe,
> > > > > +                   void *buffer, int transfer_len, int interval)
> > > > > +{
> > > > > +   return submit_int_msg(dev, pipe, buffer, transfer_len, interval, true);
> > > > > +}
> > > >
> > > > Is this wrapper really necessary ?
> > > >
> > >
> > > Avoids changing other users of the code. Not that there are that many,
> > > anyway.
> >
> > Then I wonder why not change your codes to call submit_int_msg() instead?
> >
> Why do we have usb_submit_int_msg in the first place?

I am happy to remove that. A patch is welcome. :)

Regards,
Bin
Michal Suchánek July 2, 2019, 2:58 p.m. UTC | #6
On Tue, 2 Jul 2019 22:29:42 +0800
Bin Meng <bmeng.cn@gmail.com> wrote:

> Hi Michal,
> 
> On Tue, Jul 2, 2019 at 10:25 PM Michal Suchánek <msuchanek@suse.de> wrote:
> >
> > On Tue, 2 Jul 2019 22:16:02 +0800
> > Bin Meng <bmeng.cn@gmail.com> wrote:
> >  
> > > Hi Michal,
> > >
> > > On Tue, Jul 2, 2019 at 10:14 PM Michal Suchánek <msuchanek@suse.de> wrote:  
> > > >
> > > > On Tue, 2 Jul 2019 13:59:49 +0200
> > > > Marek Vasut <marex@denx.de> wrote:
> > > >  
> > > > > On 7/1/19 5:56 PM, Michal Suchanek wrote:  
> > > > > > Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> > > > > > ---
> > > > > >  common/usb.c  | 9 +++++++++
> > > > > >  include/usb.h | 2 ++
> > > > > >  2 files changed, 11 insertions(+)
> > > > > >
> > > > > > diff --git a/common/usb.c b/common/usb.c
> > > > > > index 3ae71c98aaf4..d8302d39a91a 100644
> > > > > > --- a/common/usb.c
> > > > > > +++ b/common/usb.c
> > > > > > @@ -200,6 +200,15 @@ int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
> > > > > >     return submit_int_msg(dev, pipe, buffer, transfer_len, interval, false);
> > > > > >  }
> > > > > >
> > > > > > +/*
> > > > > > + * submits an Interrupt Message without retry
> > > > > > + */
> > > > > > +int usb_submit_int_msg_nonblock(struct usb_device *dev, unsigned long pipe,
> > > > > > +                   void *buffer, int transfer_len, int interval)
> > > > > > +{
> > > > > > +   return submit_int_msg(dev, pipe, buffer, transfer_len, interval, true);
> > > > > > +}  
> > > > >
> > > > > Is this wrapper really necessary ?
> > > > >  
> > > >
> > > > Avoids changing other users of the code. Not that there are that many,
> > > > anyway.  
> > >
> > > Then I wonder why not change your codes to call submit_int_msg() instead?
> > >  
> > Why do we have usb_submit_int_msg in the first place?  
> 
> I am happy to remove that. A patch is welcome. :)
> 

So the answer is we have wrappers for USB messages, and while
submit_int_msg is trivial others are not. To keep reasonable interface
all messages should be wrapped.

Thanks

Michal
Bin Meng July 2, 2019, 3:11 p.m. UTC | #7
Hi Michal,

On Tue, Jul 2, 2019 at 10:58 PM Michal Suchánek <msuchanek@suse.de> wrote:
>
> On Tue, 2 Jul 2019 22:29:42 +0800
> Bin Meng <bmeng.cn@gmail.com> wrote:
>
> > Hi Michal,
> >
> > On Tue, Jul 2, 2019 at 10:25 PM Michal Suchánek <msuchanek@suse.de> wrote:
> > >
> > > On Tue, 2 Jul 2019 22:16:02 +0800
> > > Bin Meng <bmeng.cn@gmail.com> wrote:
> > >
> > > > Hi Michal,
> > > >
> > > > On Tue, Jul 2, 2019 at 10:14 PM Michal Suchánek <msuchanek@suse.de> wrote:
> > > > >
> > > > > On Tue, 2 Jul 2019 13:59:49 +0200
> > > > > Marek Vasut <marex@denx.de> wrote:
> > > > >
> > > > > > On 7/1/19 5:56 PM, Michal Suchanek wrote:
> > > > > > > Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> > > > > > > ---
> > > > > > >  common/usb.c  | 9 +++++++++
> > > > > > >  include/usb.h | 2 ++
> > > > > > >  2 files changed, 11 insertions(+)
> > > > > > >
> > > > > > > diff --git a/common/usb.c b/common/usb.c
> > > > > > > index 3ae71c98aaf4..d8302d39a91a 100644
> > > > > > > --- a/common/usb.c
> > > > > > > +++ b/common/usb.c
> > > > > > > @@ -200,6 +200,15 @@ int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
> > > > > > >     return submit_int_msg(dev, pipe, buffer, transfer_len, interval, false);
> > > > > > >  }
> > > > > > >
> > > > > > > +/*
> > > > > > > + * submits an Interrupt Message without retry
> > > > > > > + */
> > > > > > > +int usb_submit_int_msg_nonblock(struct usb_device *dev, unsigned long pipe,
> > > > > > > +                   void *buffer, int transfer_len, int interval)
> > > > > > > +{
> > > > > > > +   return submit_int_msg(dev, pipe, buffer, transfer_len, interval, true);
> > > > > > > +}
> > > > > >
> > > > > > Is this wrapper really necessary ?
> > > > > >
> > > > >
> > > > > Avoids changing other users of the code. Not that there are that many,
> > > > > anyway.
> > > >
> > > > Then I wonder why not change your codes to call submit_int_msg() instead?
> > > >
> > > Why do we have usb_submit_int_msg in the first place?
> >
> > I am happy to remove that. A patch is welcome. :)
> >
>
> So the answer is we have wrappers for USB messages, and while
> submit_int_msg is trivial others are not. To keep reasonable interface
> all messages should be wrapped.

I don't see usb_submit_control_msg() or usb_submit_bulk_msg(), so I
think we should remove usb_submit_int_msg() and just leave
submit_int_msg() for drivers to call.

Regards,
Bin
Michal Suchánek July 2, 2019, 3:30 p.m. UTC | #8
On Tue, 2 Jul 2019 23:11:01 +0800
Bin Meng <bmeng.cn@gmail.com> wrote:

> Hi Michal,
> 
> On Tue, Jul 2, 2019 at 10:58 PM Michal Suchánek <msuchanek@suse.de> wrote:
> >
> > On Tue, 2 Jul 2019 22:29:42 +0800
> > Bin Meng <bmeng.cn@gmail.com> wrote:
> >  
> > > Hi Michal,
> > >
> > > On Tue, Jul 2, 2019 at 10:25 PM Michal Suchánek <msuchanek@suse.de> wrote:  
> > > >
> > > > On Tue, 2 Jul 2019 22:16:02 +0800
> > > > Bin Meng <bmeng.cn@gmail.com> wrote:
> > > >  
> > > > > Hi Michal,
> > > > >
> > > > > On Tue, Jul 2, 2019 at 10:14 PM Michal Suchánek <msuchanek@suse.de> wrote:  
> > > > > >
> > > > > > On Tue, 2 Jul 2019 13:59:49 +0200
> > > > > > Marek Vasut <marex@denx.de> wrote:
> > > > > >  
> > > > > > > On 7/1/19 5:56 PM, Michal Suchanek wrote:  
> > > > > > > > Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> > > > > > > > ---
> > > > > > > >  common/usb.c  | 9 +++++++++
> > > > > > > >  include/usb.h | 2 ++
> > > > > > > >  2 files changed, 11 insertions(+)
> > > > > > > >
> > > > > > > > diff --git a/common/usb.c b/common/usb.c
> > > > > > > > index 3ae71c98aaf4..d8302d39a91a 100644
> > > > > > > > --- a/common/usb.c
> > > > > > > > +++ b/common/usb.c
> > > > > > > > @@ -200,6 +200,15 @@ int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
> > > > > > > >     return submit_int_msg(dev, pipe, buffer, transfer_len, interval, false);
> > > > > > > >  }
> > > > > > > >
> > > > > > > > +/*
> > > > > > > > + * submits an Interrupt Message without retry
> > > > > > > > + */
> > > > > > > > +int usb_submit_int_msg_nonblock(struct usb_device *dev, unsigned long pipe,
> > > > > > > > +                   void *buffer, int transfer_len, int interval)
> > > > > > > > +{
> > > > > > > > +   return submit_int_msg(dev, pipe, buffer, transfer_len, interval, true);
> > > > > > > > +}  
> > > > > > >
> > > > > > > Is this wrapper really necessary ?
> > > > > > >  
> > > > > >
> > > > > > Avoids changing other users of the code. Not that there are that many,
> > > > > > anyway.  
> > > > >
> > > > > Then I wonder why not change your codes to call submit_int_msg() instead?
> > > > >  
> > > > Why do we have usb_submit_int_msg in the first place?  
> > >
> > > I am happy to remove that. A patch is welcome. :)
> > >  
> >
> > So the answer is we have wrappers for USB messages, and while
> > submit_int_msg is trivial others are not. To keep reasonable interface
> > all messages should be wrapped.  
> 
> I don't see usb_submit_control_msg() or usb_submit_bulk_msg(), so I
> think we should remove usb_submit_int_msg() and just leave
> submit_int_msg() for drivers to call.

There is no _submit_ in those. See include/usb.h

Thanks

Michal
Bin Meng July 2, 2019, 3:39 p.m. UTC | #9
On Tue, Jul 2, 2019 at 11:30 PM Michal Suchánek <msuchanek@suse.de> wrote:
>
> On Tue, 2 Jul 2019 23:11:01 +0800
> Bin Meng <bmeng.cn@gmail.com> wrote:
>
> > Hi Michal,
> >
> > On Tue, Jul 2, 2019 at 10:58 PM Michal Suchánek <msuchanek@suse.de> wrote:
> > >
> > > On Tue, 2 Jul 2019 22:29:42 +0800
> > > Bin Meng <bmeng.cn@gmail.com> wrote:
> > >
> > > > Hi Michal,
> > > >
> > > > On Tue, Jul 2, 2019 at 10:25 PM Michal Suchánek <msuchanek@suse.de> wrote:
> > > > >
> > > > > On Tue, 2 Jul 2019 22:16:02 +0800
> > > > > Bin Meng <bmeng.cn@gmail.com> wrote:
> > > > >
> > > > > > Hi Michal,
> > > > > >
> > > > > > On Tue, Jul 2, 2019 at 10:14 PM Michal Suchánek <msuchanek@suse.de> wrote:
> > > > > > >
> > > > > > > On Tue, 2 Jul 2019 13:59:49 +0200
> > > > > > > Marek Vasut <marex@denx.de> wrote:
> > > > > > >
> > > > > > > > On 7/1/19 5:56 PM, Michal Suchanek wrote:
> > > > > > > > > Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> > > > > > > > > ---
> > > > > > > > >  common/usb.c  | 9 +++++++++
> > > > > > > > >  include/usb.h | 2 ++
> > > > > > > > >  2 files changed, 11 insertions(+)
> > > > > > > > >
> > > > > > > > > diff --git a/common/usb.c b/common/usb.c
> > > > > > > > > index 3ae71c98aaf4..d8302d39a91a 100644
> > > > > > > > > --- a/common/usb.c
> > > > > > > > > +++ b/common/usb.c
> > > > > > > > > @@ -200,6 +200,15 @@ int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
> > > > > > > > >     return submit_int_msg(dev, pipe, buffer, transfer_len, interval, false);
> > > > > > > > >  }
> > > > > > > > >
> > > > > > > > > +/*
> > > > > > > > > + * submits an Interrupt Message without retry
> > > > > > > > > + */
> > > > > > > > > +int usb_submit_int_msg_nonblock(struct usb_device *dev, unsigned long pipe,
> > > > > > > > > +                   void *buffer, int transfer_len, int interval)
> > > > > > > > > +{
> > > > > > > > > +   return submit_int_msg(dev, pipe, buffer, transfer_len, interval, true);
> > > > > > > > > +}
> > > > > > > >
> > > > > > > > Is this wrapper really necessary ?
> > > > > > > >
> > > > > > >
> > > > > > > Avoids changing other users of the code. Not that there are that many,
> > > > > > > anyway.
> > > > > >
> > > > > > Then I wonder why not change your codes to call submit_int_msg() instead?
> > > > > >
> > > > > Why do we have usb_submit_int_msg in the first place?
> > > >
> > > > I am happy to remove that. A patch is welcome. :)
> > > >
> > >
> > > So the answer is we have wrappers for USB messages, and while
> > > submit_int_msg is trivial others are not. To keep reasonable interface
> > > all messages should be wrapped.
> >
> > I don't see usb_submit_control_msg() or usb_submit_bulk_msg(), so I
> > think we should remove usb_submit_int_msg() and just leave
> > submit_int_msg() for drivers to call.
>
> There is no _submit_ in those. See include/usb.h
>

OK, so we should just rename usb_submit_int_msg() to usb_int_msg() and
everything is consistent, no?

Regards,
Bin
Michal Suchánek July 2, 2019, 3:44 p.m. UTC | #10
On Tue, 2 Jul 2019 23:39:42 +0800
Bin Meng <bmeng.cn@gmail.com> wrote:

> On Tue, Jul 2, 2019 at 11:30 PM Michal Suchánek <msuchanek@suse.de> wrote:
> >
> > On Tue, 2 Jul 2019 23:11:01 +0800
> > Bin Meng <bmeng.cn@gmail.com> wrote:
> >  
> > > Hi Michal,
> > >
> > > On Tue, Jul 2, 2019 at 10:58 PM Michal Suchánek <msuchanek@suse.de> wrote:  
> > > >
> > > > On Tue, 2 Jul 2019 22:29:42 +0800
> > > > Bin Meng <bmeng.cn@gmail.com> wrote:
> > > >  
> > > > > Hi Michal,
> > > > >
> > > > > On Tue, Jul 2, 2019 at 10:25 PM Michal Suchánek <msuchanek@suse.de> wrote:  
> > > > > >
> > > > > > On Tue, 2 Jul 2019 22:16:02 +0800
> > > > > > Bin Meng <bmeng.cn@gmail.com> wrote:
> > > > > >  
> > > > > > > Hi Michal,
> > > > > > >
> > > > > > > On Tue, Jul 2, 2019 at 10:14 PM Michal Suchánek <msuchanek@suse.de> wrote:  
> > > > > > > >
> > > > > > > > On Tue, 2 Jul 2019 13:59:49 +0200
> > > > > > > > Marek Vasut <marex@denx.de> wrote:
> > > > > > > >  
> > > > > > > > > On 7/1/19 5:56 PM, Michal Suchanek wrote:  
> > > > > > > > > > Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> > > > > > > > > > ---
> > > > > > > > > >  common/usb.c  | 9 +++++++++
> > > > > > > > > >  include/usb.h | 2 ++
> > > > > > > > > >  2 files changed, 11 insertions(+)
> > > > > > > > > >
> > > > > > > > > > diff --git a/common/usb.c b/common/usb.c
> > > > > > > > > > index 3ae71c98aaf4..d8302d39a91a 100644
> > > > > > > > > > --- a/common/usb.c
> > > > > > > > > > +++ b/common/usb.c
> > > > > > > > > > @@ -200,6 +200,15 @@ int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
> > > > > > > > > >     return submit_int_msg(dev, pipe, buffer, transfer_len, interval, false);
> > > > > > > > > >  }
> > > > > > > > > >
> > > > > > > > > > +/*
> > > > > > > > > > + * submits an Interrupt Message without retry
> > > > > > > > > > + */
> > > > > > > > > > +int usb_submit_int_msg_nonblock(struct usb_device *dev, unsigned long pipe,
> > > > > > > > > > +                   void *buffer, int transfer_len, int interval)
> > > > > > > > > > +{
> > > > > > > > > > +   return submit_int_msg(dev, pipe, buffer, transfer_len, interval, true);
> > > > > > > > > > +}  
> > > > > > > > >
> > > > > > > > > Is this wrapper really necessary ?
> > > > > > > > >  
> > > > > > > >
> > > > > > > > Avoids changing other users of the code. Not that there are that many,
> > > > > > > > anyway.  
> > > > > > >
> > > > > > > Then I wonder why not change your codes to call submit_int_msg() instead?
> > > > > > >  
> > > > > > Why do we have usb_submit_int_msg in the first place?  
> > > > >
> > > > > I am happy to remove that. A patch is welcome. :)
> > > > >  
> > > >
> > > > So the answer is we have wrappers for USB messages, and while
> > > > submit_int_msg is trivial others are not. To keep reasonable interface
> > > > all messages should be wrapped.  
> > >
> > > I don't see usb_submit_control_msg() or usb_submit_bulk_msg(), so I
> > > think we should remove usb_submit_int_msg() and just leave
> > > submit_int_msg() for drivers to call.  
> >
> > There is no _submit_ in those. See include/usb.h
> >  
> 
> OK, so we should just rename usb_submit_int_msg() to usb_int_msg() and
> everything is consistent, no?
> 

Yes, looks like the _submit in usb_submit_int_msg is superfluous.


Thanks

Michal
diff mbox series

Patch

diff --git a/common/usb.c b/common/usb.c
index 3ae71c98aaf4..d8302d39a91a 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -200,6 +200,15 @@  int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
 	return submit_int_msg(dev, pipe, buffer, transfer_len, interval, false);
 }
 
+/*
+ * submits an Interrupt Message without retry
+ */
+int usb_submit_int_msg_nonblock(struct usb_device *dev, unsigned long pipe,
+			void *buffer, int transfer_len, int interval)
+{
+	return submit_int_msg(dev, pipe, buffer, transfer_len, interval, true);
+}
+
 /*
  * submits a control message and waits for comletion (at least timeout * 1ms)
  * If timeout is 0, we don't wait for completion (used as example to set and
diff --git a/include/usb.h b/include/usb.h
index dde3e601da45..d1e7112f4c4e 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -263,6 +263,8 @@  int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
 			void *data, int len, int *actual_length, int timeout);
 int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
 			void *buffer, int transfer_len, int interval);
+int usb_submit_int_msg_nonblock(struct usb_device *dev, unsigned long pipe,
+			void *buffer, int transfer_len, int interval);
 int usb_disable_asynch(int disable);
 int usb_maxpacket(struct usb_device *dev, unsigned long pipe);
 int usb_get_configuration_no(struct usb_device *dev, int cfgno,