From patchwork Mon Jun 16 11:23:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sricharan R X-Patchwork-Id: 31944 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f70.google.com (mail-pb0-f70.google.com [209.85.160.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A330820E7A for ; Mon, 16 Jun 2014 11:27:53 +0000 (UTC) Received: by mail-pb0-f70.google.com with SMTP id rp16sf18021709pbb.1 for ; Mon, 16 Jun 2014 04:27:52 -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=FPqKQaXdIJPRD762DYxnxuzJ0UKA+Ou476l5XHialXg=; b=AkdD/CEv+lkF3hzYc2WA8/JQ+HMjQ5LoaBJ76Afj8sFGXWhk0iwRUZ3+dTtROFyf6o ng4x8wVKfKlDdOx/bRoygQxikIeU5F3SoPO03xSofBpl9ozuAn0OEpJ8tSqyd5TmtH4w wQmY+x1oDLeA6dp23HLk0Chpr4MKp1ZEtTIa4/2o0XLGN4GYfk+4QUQLfpCrendn+tTB rPBw/xP4q5gYW4puT9WJ/42SDdhGEZY6gURcNZTD7QQxsnCsoFL+McVxYMST8fesgL04 lX8dPjcDAaiRPMc789N8wxj7lOa7OcBXw8zICTLgCW3hi7U/P26z77lWDYYgPjFs9YCq 06/w== X-Gm-Message-State: ALoCoQnDhFvJTte4pTRfndraigMC0rCT9OUEoIAedoJAenw85FuqkdSelT7q1dwKFDVte3y1+qFj X-Received: by 10.66.189.163 with SMTP id gj3mr2488070pac.32.1402918072769; Mon, 16 Jun 2014 04:27:52 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.42.111 with SMTP id b102ls4452510qga.31.gmail; Mon, 16 Jun 2014 04:27:52 -0700 (PDT) X-Received: by 10.58.29.16 with SMTP id f16mr5546681veh.23.1402918072666; Mon, 16 Jun 2014 04:27:52 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id xy3si3987303vec.77.2014.06.16.04.27.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Jun 2014 04:27:52 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id il7so4685150vcb.41 for ; Mon, 16 Jun 2014 04:27:52 -0700 (PDT) X-Received: by 10.220.53.72 with SMTP id l8mr16017583vcg.16.1402918072572; Mon, 16 Jun 2014 04:27:52 -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 vs6csp127361vcb; Mon, 16 Jun 2014 04:27:52 -0700 (PDT) X-Received: by 10.68.191.138 with SMTP id gy10mr3639368pbc.169.1402918071748; Mon, 16 Jun 2014 04:27:51 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rc8si13361413pab.132.2014.06.16.04.27.51; Mon, 16 Jun 2014 04:27:51 -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 S1754307AbaFPL1u (ORCPT + 9 others); Mon, 16 Jun 2014 07:27:50 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:41738 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752066AbaFPL0v (ORCPT ); Mon, 16 Jun 2014 07:26:51 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s5GBQMpF019438; Mon, 16 Jun 2014 06:26:22 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5GBQMwf026531; Mon, 16 Jun 2014 06:26:22 -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; Mon, 16 Jun 2014 06:26:22 -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 s5GBOx4B008965; Mon, 16 Jun 2014 06:26:18 -0500 From: Sricharan R To: , , , CC: , , , , , , , , Subject: [PATCH V3 14/16] irqchip: crossbar: introduce centralized check for crossbar write Date: Mon, 16 Jun 2014 16:53:14 +0530 Message-ID: <1402917796-31574-15-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.182 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 This is a basic check to ensure that crossbar register needs to be written. This ensures that we have a common check which is used in both map and unmap logic. Signed-off-by: Nishanth Menon Signed-off-by: Sricharan R --- drivers/irqchip/irq-crossbar.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c index c46e14b..ef613c4 100644 --- a/drivers/irqchip/irq-crossbar.c +++ b/drivers/irqchip/irq-crossbar.c @@ -84,10 +84,20 @@ static inline int allocate_free_irq(int cb_no) return -ENODEV; } +static inline bool needs_crossbar_write(irq_hw_number_t hw) +{ + if (hw > GIC_IRQ_START) + return true; + + return false; +} + static int crossbar_domain_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) { - cb->write(hw - GIC_IRQ_START, cb->irq_map[hw - GIC_IRQ_START]); + if (needs_crossbar_write(hw)) + cb->write(hw - GIC_IRQ_START, cb->irq_map[hw - GIC_IRQ_START]); + return 0; } @@ -106,7 +116,7 @@ static void crossbar_domain_unmap(struct irq_domain *d, unsigned int irq) { irq_hw_number_t hw = irq_get_irq_data(irq)->hwirq; - if (hw > GIC_IRQ_START) { + if (needs_crossbar_write(hw)) { cb->irq_map[hw - GIC_IRQ_START] = IRQ_FREE; cb->write(hw - GIC_IRQ_START, cb->safe_map); }