From patchwork Thu Jun 26 07:10:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sricharan R X-Patchwork-Id: 32527 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f200.google.com (mail-ve0-f200.google.com [209.85.128.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 648A8201EF for ; Thu, 26 Jun 2014 07:13:55 +0000 (UTC) Received: by mail-ve0-f200.google.com with SMTP id i13sf6231912veh.3 for ; Thu, 26 Jun 2014 00:13:55 -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:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=lXM4L8VGsfl0OPnX8o3QJiraoJriGkMZeq20wAZB0io=; b=TVUkooMoK1on/k61i4b4X7ah3/Z9qHy6hv8cmFbPqvMIOJOoyQEzW8lMkHVXOZXbmX ihOIB/ZAvrQDMM8GqYbWSFbucU9CMMqOw8aRkTZuHSXQPJwZhW2eUCQVVEyVt7A5KtE/ oAKXTtizI2FhKXQmJeYDHBgju/pSHyZNWpc0kavIwwHOaPXzdbeN4OYCD6S717e4HAxq 1SyXwNteaV7GFDgB+N6Bd/w7AcyehomuTZf3CAC/lLCWvu/ZNSzYNGI+jQexjdfNQMYg +KoPMJXW41kjr+xvqnQj7j01aNvxWVF9u3K+VJ5Aw15MRUh+joK7bt17GDWgX3nB1W5U 5VFg== X-Gm-Message-State: ALoCoQlDFXiw7d8hXRIsHgo0YuRSU6HxBrI/0/oj9fSw0C5OYfpEFymeeo1Wz64IjibQi+/Be6na X-Received: by 10.58.46.79 with SMTP id t15mr7122501vem.35.1403766835179; Thu, 26 Jun 2014 00:13:55 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.50.80 with SMTP id r74ls105031qga.71.gmail; Thu, 26 Jun 2014 00:13:55 -0700 (PDT) X-Received: by 10.221.4.66 with SMTP id ob2mr11709352vcb.28.1403766835100; Thu, 26 Jun 2014 00:13:55 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id ea4si3846570vcb.37.2014.06.26.00.13.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Jun 2014 00:13:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id il7so3053650vcb.40 for ; Thu, 26 Jun 2014 00:13:55 -0700 (PDT) X-Received: by 10.58.132.41 with SMTP id or9mr11608155veb.5.1403766834991; Thu, 26 Jun 2014 00:13:54 -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.37.5 with SMTP id tc5csp10242vcb; Thu, 26 Jun 2014 00:13:54 -0700 (PDT) X-Received: by 10.66.232.166 with SMTP id tp6mr18519568pac.127.1403766833907; Thu, 26 Jun 2014 00:13:53 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hl2si8578595pac.30.2014.06.26.00.13.53; Thu, 26 Jun 2014 00:13:53 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755465AbaFZHNk (ORCPT + 27 others); Thu, 26 Jun 2014 03:13:40 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:48352 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755308AbaFZHNh (ORCPT ); Thu, 26 Jun 2014 03:13:37 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s5Q7D0Od013558; Thu, 26 Jun 2014 02:13:00 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5Q7Cxam025278; Thu, 26 Jun 2014 02:12:59 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Thu, 26 Jun 2014 02:12:59 -0500 Received: from uda0393807.india.ti.com. (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5Q7CTSW000852; Thu, 26 Jun 2014 02:12:55 -0500 From: Sricharan R To: , , , CC: , , , , , , , , Subject: [PATCH V4 05/16] irqchip: crossbar: Change allocation logic by reversing search for free irqs Date: Thu, 26 Jun 2014 12:40:23 +0530 Message-ID: <1403766634-18543-6-git-send-email-r.sricharan@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1403766634-18543-1-git-send-email-r.sricharan@ti.com> References: <1403766634-18543-1-git-send-email-r.sricharan@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.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.181 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Nishanth Menon Reverse the search algorithm to ensure that address mapping and IRQ allocation logics are proper. This makes the below bugs visible sooner. class 1. address space errors -> example: reg = ti,max-irqs = is a wrong parameter class 2: irq-reserved list - which decides which entries in the address space is not actually wired in class 3: wrong list of routable-irqs. In general allocating from max to min tends to have benefits in ensuring the different issues that may be present in dts is easily caught at definition time, rather than at a later point in time. Signed-off-by: Nishanth Menon Signed-off-by: Sricharan R Acked-by: Santosh Shilimkar --- 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 4be30c0..a39cb31 100644 --- a/drivers/irqchip/irq-crossbar.c +++ b/drivers/irqchip/irq-crossbar.c @@ -58,7 +58,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; @@ -69,7 +69,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;