Patchwork [U-Boot] usb: common: Use a global definition for 'min3'

login
register
mail settings
Submitter Vivek Gautam
Date April 19, 2013, 9:38 a.m.
Message ID <1366364300-20988-1-git-send-email-gautam.vivek@samsung.com>
Download mbox | patch
Permalink /patch/237893/
State Superseded
Delegated to: Marek Vasut
Headers show

Comments

Vivek Gautam - April 19, 2013, 9:38 a.m.
We can use a common global method for calculating minimum of
3 numbers. Put the same in 'common header' and let 'ehci'
use it.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
---
 drivers/usb/host/ehci-hcd.c |   10 ----------
 include/common.h            |    5 +++++
 2 files changed, 5 insertions(+), 10 deletions(-)
Marek Vasut - April 19, 2013, 11:29 a.m.
Dear Vivek Gautam,

> We can use a common global method for calculating minimum of
> 3 numbers. Put the same in 'common header' and let 'ehci'
> use it.
> 
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>

Applied, thanks

> ---
>  drivers/usb/host/ehci-hcd.c |   10 ----------
>  include/common.h            |    5 +++++
>  2 files changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> index 19d4352..e0f3e4b 100644
> --- a/drivers/usb/host/ehci-hcd.c
> +++ b/drivers/usb/host/ehci-hcd.c
> @@ -603,16 +603,6 @@ fail:
>  	return -1;
>  }
> 
> -static inline int min3(int a, int b, int c)
> -{
> -
> -	if (b < a)
> -		a = b;
> -	if (c < a)
> -		a = c;
> -	return a;
> -}
> -
>  int
>  ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
>  		 int length, struct devrequest *req)
> diff --git a/include/common.h b/include/common.h
> index 0cfa6a8..611edca 100644
> --- a/include/common.h
> +++ b/include/common.h
> @@ -211,6 +211,11 @@ typedef void (interrupt_handler_t)(void *);
>  #define MIN(x, y)  min(x, y)
>  #define MAX(x, y)  max(x, y)
> 
> +static inline int min3(int a, int b, int c)
> +{
> +	return min(min(a, b), c);
> +}
> +
>  /*
>   * Return the absolute value of a number.
>   *

Best regards,
Marek Vasut
Tom Rini - April 22, 2013, 1:45 p.m.
On Fri, Apr 19, 2013 at 01:29:12PM +0200, Marek Vasut wrote:
> Dear Vivek Gautam,
> 
> > We can use a common global method for calculating minimum of
> > 3 numbers. Put the same in 'common header' and let 'ehci'
> > use it.
> > 
> > Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> 
> Applied, thanks

NAK, sorry.  Lets re-sync with the kernel's min/max/min3/max3 defines
here instead.
Vivek Gautam - April 24, 2013, 6:19 a.m.
On Mon, Apr 22, 2013 at 7:15 PM, Tom Rini <trini@ti.com> wrote:
> On Fri, Apr 19, 2013 at 01:29:12PM +0200, Marek Vasut wrote:
>> Dear Vivek Gautam,
>>
>> > We can use a common global method for calculating minimum of
>> > 3 numbers. Put the same in 'common header' and let 'ehci'
>> > use it.
>> >
>> > Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
>>
>> Applied, thanks
>
> NAK, sorry.  Lets re-sync with the kernel's min/max/min3/max3 defines
> here instead.

Alright, i shall sync the definitions with Linux kernel and send the
patch for same.
Vivek Gautam - April 24, 2013, 6:21 a.m.
Hi Marek,


On Wed, Apr 24, 2013 at 11:49 AM, Vivek Gautam
<gautamvivek1987@gmail.com> wrote:
> On Mon, Apr 22, 2013 at 7:15 PM, Tom Rini <trini@ti.com> wrote:
>> On Fri, Apr 19, 2013 at 01:29:12PM +0200, Marek Vasut wrote:
>>> Dear Vivek Gautam,
>>>
>>> > We can use a common global method for calculating minimum of
>>> > 3 numbers. Put the same in 'common header' and let 'ehci'
>>> > use it.
>>> >
>>> > Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
>>>
>>> Applied, thanks
>>
>> NAK, sorry.  Lets re-sync with the kernel's min/max/min3/max3 defines
>> here instead.
>
> Alright, i shall sync the definitions with Linux kernel and send the
> patch for same.

Will you be dropping this patch from u-boot-usb/next or shall i send a
subsequent patch on
top of this ?
Marek Vasut - April 24, 2013, 12:03 p.m.
Dear Vivek Gautam,

> Hi Marek,
> 
> 
> On Wed, Apr 24, 2013 at 11:49 AM, Vivek Gautam
> 
> <gautamvivek1987@gmail.com> wrote:
> > On Mon, Apr 22, 2013 at 7:15 PM, Tom Rini <trini@ti.com> wrote:
> >> On Fri, Apr 19, 2013 at 01:29:12PM +0200, Marek Vasut wrote:
> >>> Dear Vivek Gautam,
> >>> 
> >>> > We can use a common global method for calculating minimum of
> >>> > 3 numbers. Put the same in 'common header' and let 'ehci'
> >>> > use it.
> >>> > 
> >>> > Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> >>> 
> >>> Applied, thanks
> >> 
> >> NAK, sorry.  Lets re-sync with the kernel's min/max/min3/max3 defines
> >> here instead.
> > 
> > Alright, i shall sync the definitions with Linux kernel and send the
> > patch for same.
> 
> Will you be dropping this patch from u-boot-usb/next or shall i send a
> subsequent patch on
> top of this ?

Dropped and pushed

Best regards,
Marek Vasut

Patch

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 19d4352..e0f3e4b 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -603,16 +603,6 @@  fail:
 	return -1;
 }
 
-static inline int min3(int a, int b, int c)
-{
-
-	if (b < a)
-		a = b;
-	if (c < a)
-		a = c;
-	return a;
-}
-
 int
 ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
 		 int length, struct devrequest *req)
diff --git a/include/common.h b/include/common.h
index 0cfa6a8..611edca 100644
--- a/include/common.h
+++ b/include/common.h
@@ -211,6 +211,11 @@  typedef void (interrupt_handler_t)(void *);
 #define MIN(x, y)  min(x, y)
 #define MAX(x, y)  max(x, y)
 
+static inline int min3(int a, int b, int c)
+{
+	return min(min(a, b), c);
+}
+
 /*
  * Return the absolute value of a number.
  *