From patchwork Mon Jun 16 11:23:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sricharan R X-Patchwork-Id: 31936 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A76F620E7A for ; Mon, 16 Jun 2014 11:26:12 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id uy5sf30384983obc.1 for ; Mon, 16 Jun 2014 04:26:12 -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=HXf2e7KURmQ6OlGLrBoMk03vvvtmemoNlMVflmycsvw=; b=Fs5SNTTddwdLDBSeem3L0D6lwlwJduPTWNPI8p4gQwFhJhkzDC2oBuZTudJoBazyEK a0NDjVxHWsx1qvDO8IU7D99iFmtvYAXto2R5ihC+S+1BRMXVmHLXzfTOi57PHLCc4XCR 2KF/FwCCG23zgiguL/c4DVubsAEGFjPoqrklebY/xk9JV8Wu0n5hGDBQ3ropW4FGp1ma 5flFHtURptGOv4iiTnWmBi1oSx5jH0Dbq9Lo1s03qhlgET04/xO1UtYGTsSnzd1JusMQ +5L2lx20G/pHdmpOYTBA5h+7s+mbKSImY7KBdqtCwj6lkKOJ25eOFLDWpcl+jqmwE8oL DpFw== X-Gm-Message-State: ALoCoQl2hnuj9oa1ib7ef1SER0I3i9CLOIzpcKaiGQ+x7zNec6Fy+9UnQ22N6PJ+K8VF4t9r3Lt2 X-Received: by 10.50.55.35 with SMTP id o3mr3356844igp.6.1402917972250; Mon, 16 Jun 2014 04:26:12 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.44.36 with SMTP id f33ls4278121qga.19.gmail; Mon, 16 Jun 2014 04:26:12 -0700 (PDT) X-Received: by 10.52.52.168 with SMTP id u8mr13163662vdo.25.1402917972123; Mon, 16 Jun 2014 04:26:12 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id qk6si3976994vdb.68.2014.06.16.04.26.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Jun 2014 04:26:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id la4so4873835vcb.28 for ; Mon, 16 Jun 2014 04:26:12 -0700 (PDT) X-Received: by 10.53.8.162 with SMTP id dl2mr13181604vdd.24.1402917972031; Mon, 16 Jun 2014 04:26:12 -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 vs6csp127273vcb; Mon, 16 Jun 2014 04:26:11 -0700 (PDT) X-Received: by 10.66.150.169 with SMTP id uj9mr23124724pab.148.1402917971312; Mon, 16 Jun 2014 04:26:11 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rk7si13342393pab.174.2014.06.16.04.26.10; Mon, 16 Jun 2014 04:26:10 -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 S1755259AbaFPL0H (ORCPT + 9 others); Mon, 16 Jun 2014 07:26:07 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:43245 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752565AbaFPL0E (ORCPT ); Mon, 16 Jun 2014 07:26:04 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s5GBPXFU018894; Mon, 16 Jun 2014 06:25:33 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5GBPXLW027090; Mon, 16 Jun 2014 06:25:33 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Mon, 16 Jun 2014 06:25:33 -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 s5GBOx42008965; Mon, 16 Jun 2014 06:25:29 -0500 From: Sricharan R To: , , , CC: , , , , , , , , Subject: [PATCH V3 05/16] irqchip: crossbar: change allocation logic by reversing search for free irqs Date: Mon, 16 Jun 2014 16:53:05 +0530 Message-ID: <1402917796-31574-6-git-send-email-r.sricharan@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1402917796-31574-1-git-send-email-r.sricharan@ti.com> References: <1402917796-31574-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.169 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 --- [V3] Added more description to commit log. 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 d1f67f6..9528cf2 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;