From patchwork Thu Jun 12 11:53:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sricharan R X-Patchwork-Id: 31826 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B733B20AE6 for ; Thu, 12 Jun 2014 11:59:31 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id ij19sf2277607vcb.10 for ; Thu, 12 Jun 2014 04:59:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:mime-version:cc:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=dtxSlutShXQ+bnwevGSPU9hRkKo0a5wAT66O++jg5lM=; b=VHKi8Hizd2SrnRl0sSnOlp+XnvUzNtEcmLXTFHNMIy8mtwUtPMx6KYhgL7gP6darGw qrlgQinNJVYo3h4HEa1WIcjKSwk7iLJdGrg37+81qPBbgRKjRgyhO+p6uXzbLj9zikQ5 0DyDzjPO2EkheTyIKo0XdZK7lhAk8CbFD64shj7lsyWZQwi2AbMhnMxBmld1HLDARoQ0 82eFG+Cm8lMhTdicq3MDXYHnIzPSixYTTOlyBndRXWT9x/N8PZ0hw9YKjCVZbg+OZP85 /wY9I5kGEk/Fh7KswcL6drAQcbbUqwsNp+OtauutocRuaTviZqdsVK6fzKTYEzZltBui vz5Q== X-Gm-Message-State: ALoCoQkA0TM6kCV7/0/nw/AGKggbuXGnLQqK7FDKwItyqREl6t4JZr8+uAPENjV4F92lFPko8HN9 X-Received: by 10.224.57.142 with SMTP id c14mr4319183qah.7.1402574371528; Thu, 12 Jun 2014 04:59:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.24.42 with SMTP id 39ls2848161qgq.26.gmail; Thu, 12 Jun 2014 04:59:31 -0700 (PDT) X-Received: by 10.220.103.141 with SMTP id k13mr43816220vco.25.1402574371455; Thu, 12 Jun 2014 04:59:31 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id te2si236697vcb.101.2014.06.12.04.59.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Jun 2014 04:59:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id ij19so674715vcb.37 for ; Thu, 12 Jun 2014 04:59:31 -0700 (PDT) X-Received: by 10.52.141.74 with SMTP id rm10mr3855604vdb.6.1402574371339; Thu, 12 Jun 2014 04:59:31 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp397291vcb; Thu, 12 Jun 2014 04:59:31 -0700 (PDT) X-Received: by 10.224.37.10 with SMTP id v10mr31163273qad.98.1402574370756; Thu, 12 Jun 2014 04:59:30 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id a4si829421qar.41.2014.06.12.04.59.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jun 2014 04:59:30 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wv3d5-0005N5-Ct; Thu, 12 Jun 2014 11:57:15 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wv3cA-0004qx-Nq for linux-arm-kernel@lists.infradead.org; Thu, 12 Jun 2014 11:56:20 +0000 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s5CBtmuK009126; Thu, 12 Jun 2014 06:55:48 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5CBtmdS023077; Thu, 12 Jun 2014 06:55:48 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Thu, 12 Jun 2014 06:55:47 -0500 Received: from uda0393807.india.ti.com. (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5CBtEbs008910; Thu, 12 Jun 2014 06:55:42 -0500 From: Sricharan R To: , , , Subject: [PATCH V2 05/19] irqchip: crossbar: Change allocation logic by reversing search for free irqs Date: Thu, 12 Jun 2014 17:23:13 +0530 Message-ID: <1402574007-13987-6-git-send-email-r.sricharan@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1402574007-13987-1-git-send-email-r.sricharan@ti.com> References: <1402574007-13987-1-git-send-email-r.sricharan@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140612_045618_899212_D7D4E701 X-CRM114-Status: GOOD ( 11.50 ) X-Spam-Score: -5.7 (-----) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-5.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [198.47.26.153 listed in wl.mailspike.net] -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [198.47.26.153 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: nm@ti.com, linux@arm.linux.org.uk, jason@lakedaemon.net, tony@atomide.com, rnayak@ti.com, r.sricharan@ti.com, santosh.shilimkar@ti.com, tglx@linutronix.de X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: r.sricharan@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Nishanth Menon Reverse the search algorithm to ensure that address mapping and IRQ allocation logics are proper. This can open up new bugs which are easily fixable rather than wait till allocation logic approaches the limit to find new bugs. Signed-off-by: Nishanth Menon Signed-off-by: Sricharan R Signed-off-by: Tony Lindgren --- drivers/irqchip/irq-crossbar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c index 287d3ce..de021638 100644 --- a/drivers/irqchip/irq-crossbar.c +++ b/drivers/irqchip/irq-crossbar.c @@ -68,7 +68,7 @@ static inline int get_prev_map_irq(int cb_no) { int i; - for (i = 0; i < cb->int_max; i++) + for (i = cb->int_max - 1; i >= 0; i--) if (cb->irq_map[i] == cb_no) return i; @@ -79,7 +79,7 @@ static inline int allocate_free_irq(int cb_no) { int i; - for (i = 0; i < cb->int_max; i++) { + for (i = cb->int_max - 1; i >= 0; i--) { if (cb->irq_map[i] == IRQ_FREE) { cb->irq_map[i] = cb_no; return i;