From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Fri, 19 Apr 2013 13:29:12 +0200 Subject: [U-Boot] [PATCH] usb: common: Use a global definition for 'min3' In-Reply-To: <1366364300-20988-1-git-send-email-gautam.vivek@samsung.com> References: <201304141911.45060.marex@denx.de> <1366364300-20988-1-git-send-email-gautam.vivek@samsung.com> Message-ID: <201304191329.12280.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 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