From patchwork Fri May 3 14:31:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 16643 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CFEFF23905 for ; Fri, 3 May 2013 14:33:56 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id jz10sf3029778veb.0 for ; Fri, 03 May 2013 07:33:47 -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-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references: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=3fiRa1cZ4KKEOt8Z59Wv5V3lT9svgsrea42dbB/aUys=; b=BOiaIhVXpWW7eGC6R64X6kgVc4fTSa66+SyerQDoZ9Z4O8ggjHpFy08WyZo+Wn+KGn 5RdiKfT3q3jhnfjHdsUfopYIWgkgzn8jC90B/FYbk5Q7VPsv00XySarAvVaMT1POc6nu ozBSq071/+NXoitReYHRFLMJEY8kzUDptyJJpBK3tc580n5XVD/9OFeJFg8fmC7jwbMc O81QOOFZuO4/O0UemAQqWHhwEl3meV5LxJL9TudKuf4wHjLUgfl/yzMGYjIVZd/H/pqk Z79OFpB4W+CC4E9WQfd1IAIcdwBKXNyjBeel2xj+6Tjp6p5L+UDB5mOi450CgS1Ee12y wTbg== X-Received: by 10.236.190.134 with SMTP id e6mr8297844yhn.40.1367591627014; Fri, 03 May 2013 07:33:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.107.70 with SMTP id ha6ls1683197qeb.81.gmail; Fri, 03 May 2013 07:33:46 -0700 (PDT) X-Received: by 10.52.96.138 with SMTP id ds10mr3183822vdb.3.1367591626573; Fri, 03 May 2013 07:33:46 -0700 (PDT) Received: from mail-ve0-x235.google.com (mail-ve0-x235.google.com [2607:f8b0:400c:c01::235]) by mx.google.com with ESMTPS id by3si1554836vdc.95.2013.05.03.07.33.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 May 2013 07:33:46 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::235 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:c01::235; Received: by mail-ve0-f181.google.com with SMTP id d10so1522551vea.26 for ; Fri, 03 May 2013 07:33:46 -0700 (PDT) X-Received: by 10.52.166.103 with SMTP id zf7mr3185857vdb.94.1367591626309; Fri, 03 May 2013 07:33:46 -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 nf2csp25173veb; Fri, 3 May 2013 07:33:45 -0700 (PDT) X-Received: by 10.180.14.5 with SMTP id l5mr15340249wic.32.1367591625336; Fri, 03 May 2013 07:33:45 -0700 (PDT) Received: from mail-we0-x22b.google.com (mail-we0-x22b.google.com [2a00:1450:400c:c03::22b]) by mx.google.com with ESMTPS id s3si8079663wic.104.2013.05.03.07.33.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 May 2013 07:33:45 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::22b is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c03::22b; Received: by mail-we0-f171.google.com with SMTP id u7so1396658wey.16 for ; Fri, 03 May 2013 07:33:45 -0700 (PDT) X-Received: by 10.180.72.227 with SMTP id g3mr3524095wiv.1.1367591624877; Fri, 03 May 2013 07:33:44 -0700 (PDT) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPSA id o3sm17516019wia.2.2013.05.03.07.33.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 May 2013 07:33:43 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, srinidhi.kasagar@stericsson.com, Lee Jones , Vinod Koul , Dan Williams , Per Forlin , Rabin Vincent Subject: [PATCH 12/63] dmaengine: ste_dma40: Remove home-brew MAX() macro Date: Fri, 3 May 2013 15:31:58 +0100 Message-Id: <1367591569-32197-13-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1367591569-32197-1-git-send-email-lee.jones@linaro.org> References: <1367591569-32197-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQmydgEDal5VONPbacB5nQ8DUZu6bdebYNXP46p47VBsl9freDM4Mm8WvQvGCphnmWsJlfT/ X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::235 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: , The current implementation of the DMA40's local MAX() macro evaluates its arguments more times than is necessary and it not type checked. This patch strips replaces it with a new, more efficient constant. Cc: Vinod Koul Cc: Dan Williams Cc: Per Forlin Cc: Rabin Vincent Acked-by: Linus Walleij Reported-by: Harvey Harrison Signed-off-by: Lee Jones --- drivers/dma/ste_dma40.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 2354474..9a04559 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -53,8 +53,6 @@ #define D40_ALLOC_PHY (1 << 30) #define D40_ALLOC_LOG_FREE 0 -#define MAX(a, b) (((a) < (b)) ? (b) : (a)) - /* Reserved event lines for memcpy only. */ static int dma40_memcpy_channels[] = { 56, 57, 58, 59, 60 }; @@ -202,6 +200,9 @@ static u32 d40_backup_regs_chan[] = { D40_CHAN_REG_SDLNK, }; +#define BACKUP_REGS_SZ_MAX ((BACKUP_REGS_SZ_V4A > BACKUP_REGS_SZ_V4B) ? \ + BACKUP_REGS_SZ_V4A : BACKUP_REGS_SZ_V4B) + /** * struct d40_interrupt_lookup - lookup table for interrupt handler * @@ -565,7 +566,7 @@ struct d40_base { resource_size_t lcpa_size; struct kmem_cache *desc_slab; u32 reg_val_backup[BACKUP_REGS_SZ]; - u32 reg_val_backup_v4[MAX(BACKUP_REGS_SZ_V4A, BACKUP_REGS_SZ_V4B)]; + u32 reg_val_backup_v4[BACKUP_REGS_SZ_MAX]; u32 *reg_val_backup_chan; u16 gcc_pwr_off_mask; bool initialized;