From patchwork Fri Apr 19 09:38:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 16257 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f71.google.com (mail-qe0-f71.google.com [209.85.128.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7ED3E23A42 for ; Fri, 19 Apr 2013 09:40:44 +0000 (UTC) Received: by mail-qe0-f71.google.com with SMTP id b10sf7443040qen.6 for ; Fri, 19 Apr 2013 02:40:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-auditid:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-brightmail-tracker:x-brightmail-tracker :dlp-filter:x-mtr:x-cfilter-loop:x-gm-message-state :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-google-group-id:list-post:list-help :list-archive:list-unsubscribe; bh=gs6JM5COIKI7GB+TnYEgKDHj+yVfC+GGWSxUKi+V+98=; b=Mlgm+gFXFg/5nEi0Ldq2K6ZBAKzkbZZF6iHQQgp1uqEn58yTw0KOGg1DIR2aCxpFQZ zokQRGuqarW8hH4vwNOpGgMQJe/zKatMyedC2kQ2XNJxbmcy0UJZvgCQdLBj7WPUreGv Wfz6dqKOg0Jnfsw+n9y4mSRaUM7JCa2XI5b1me5Ixby7lnZhXj0HkTwr4s5yyN6NN+JS YTz4yu/p6bWzpBjER1KYeBRGh44wGZ3EQ8kYj5fLUGxwhm3cf2OJFlyWq+6kbLW18t6E t0wMmbj4CVj8TkE/ak+3tVAjVqmKmVkLdhcZLInuT6masqxiyfZk468Fk+OcR+9aDQ3G F7/g== X-Received: by 10.236.198.207 with SMTP id v55mr7250113yhn.44.1366364404866; Fri, 19 Apr 2013 02:40:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.5.10 with SMTP id o10ls1898900qeo.69.gmail; Fri, 19 Apr 2013 02:40:04 -0700 (PDT) X-Received: by 10.52.230.197 with SMTP id ta5mr4752613vdc.103.1366364404535; Fri, 19 Apr 2013 02:40:04 -0700 (PDT) Received: from mail-vb0-x22a.google.com (mail-vb0-x22a.google.com [2607:f8b0:400c:c02::22a]) by mx.google.com with ESMTPS id pq1si8948621vec.29.2013.04.19.02.40.04 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Apr 2013 02:40:04 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22a is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::22a; Received: by mail-vb0-f42.google.com with SMTP id p12so3428906vbe.15 for ; Fri, 19 Apr 2013 02:40:04 -0700 (PDT) X-Received: by 10.52.228.71 with SMTP id sg7mr9057908vdc.51.1366364404428; Fri, 19 Apr 2013 02:40:04 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp3657veb; Fri, 19 Apr 2013 02:40:03 -0700 (PDT) X-Received: by 10.68.134.136 with SMTP id pk8mr18582829pbb.100.1366364403156; Fri, 19 Apr 2013 02:40:03 -0700 (PDT) Received: from mailout2.samsung.com (mailout2.samsung.com. [203.254.224.25]) by mx.google.com with ESMTP id vu9si11543078pbc.158.2013.04.19.02.40.02; Fri, 19 Apr 2013 02:40:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of gautam.vivek@samsung.com designates 203.254.224.25 as permitted sender) client-ip=203.254.224.25; Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MLH00HB3XII3AV0@mailout2.samsung.com> for patches@linaro.org; Fri, 19 Apr 2013 18:40:01 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.125]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id DB.7F.07735.1F011715; Fri, 19 Apr 2013 18:40:01 +0900 (KST) X-AuditID: cbfee68e-b7f946d000001e37-27-517110f11195 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 6F.13.17838.1F011715; Fri, 19 Apr 2013 18:40:01 +0900 (KST) Received: from vivekkumarg-linuxpc.sisodomain.com ([107.108.214.169]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MLH006COXIJMZ50@mmp1.samsung.com>; Fri, 19 Apr 2013 18:40:01 +0900 (KST) From: Vivek Gautam To: u-boot@lists.denx.de, marex@denx.de Cc: u-boot-review@google.com, patches@linaro.org, rajeshwari.s@samsung.com Subject: [PATCH] usb: common: Use a global definition for 'min3' Date: Fri, 19 Apr 2013 15:08:20 +0530 Message-id: <1366364300-20988-1-git-send-email-gautam.vivek@samsung.com> X-Mailer: git-send-email 1.7.6.5 In-reply-to: <201304141911.45060.marex@denx.de> References: <201304141911.45060.marex@denx.de> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDLMWRmVeSWpSXmKPExsWyRsSkVvejQGGgwdGp8hZv2hoZLaYc/sJi 0bL2AKvF8tcb2S3e7u1kd2D1mDfrBIvHgk2lHneu7WHzOHtnB6NH35ZVjAGsUVw2Kak5mWWp Rfp2CVwZP5sWsxYc56z4vH8qSwPjXvYuRk4OCQETiTlnTjNC2GISF+6tZ+ti5OIQEljKKDHt +G4WmKKZy05AJRYxSvy5u4cRwpnCJPHh3F1WkCo2AV2Jpre7wEaJCKhL/D/cC2YzC3hJ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MTc1NrU0sTAxsyRNWEmc90CrdaCQQHpiSWp2ampBahHMFiYOTqkGRrt2Rdbq K/UtYs9XaV6xklsT860hq+DTpQ83bk61OnQxd8OGkvY4XY+Hyo2p0YurV3NenNPCbu81N+dk nNztwqBmhv9sW2d5O14580Tx90om87y87h6b0wVzzgcmMEyc/JtTpsm+30tS99Jjcd3Wp3vv TZmhuZs5fk9HlMKCSVzeO0R9yswMlFiKMxINtZiLihMB5bpBW90CAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQkVX731s3coK28gCEHk6JBK6eERFKi/saImUXPNkUyP1su/00McwDdrrgpgdfFqDAh69qNo X-Original-Sender: gautam.vivek@samsung.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::22a is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- 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. *