From patchwork Thu Oct 23 15:53:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yingjoe Chen X-Patchwork-Id: 39383 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 174C524022 for ; Thu, 23 Oct 2014 15:56:03 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id gi9sf763038lab.6 for ; Thu, 23 Oct 2014 08:56:02 -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=zUj7dRcVv1sbJ6VzIgfhxsxw5XC1SACtzM+TKVFnKEw=; b=O0TfOwNWDusNkUC6SbLiimruOaJdjYUUyyI5S7q2n3smMe7zMJ7z4M5niHhM0QA/cD ZbGvA0eedVmQt45h8j3rNEE4m8JlIgjkbIDBAFkPpLBgfbEBOaqzl5uGGD153Q9sR2ho SePea+80iO3lxjUdPPFt21VoJKhyhhhvzZXb+4L+3+LU20To/f1jV1RnZAq3eofga4YO RIYu1+eSHNzTejgmUdhsIkZiZF7X1WQrgmbySz1eGNLJSlE6JV2q++yecnpoFvrOWwFG gxwfJfQm+7Mxvw7Jm6+7VtY6M9cagHdyObVwUQZCkjgT4Bdun8LPAB1pP2yzRzXL6kbY XMvQ== X-Gm-Message-State: ALoCoQl/sBufzLRmpu6bAL8sBP3Z91ckofkXtzAnMzeEwpkSavA94w0CIUH9aSViZAlvpl+SKDa7 X-Received: by 10.180.19.198 with SMTP id h6mr6391724wie.5.1414079762926; Thu, 23 Oct 2014 08:56:02 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.202.230 with SMTP id kl6ls97376lac.99.gmail; Thu, 23 Oct 2014 08:56:02 -0700 (PDT) X-Received: by 10.112.97.135 with SMTP id ea7mr6178354lbb.46.1414079762746; Thu, 23 Oct 2014 08:56:02 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id r9si3281757lag.32.2014.10.23.08.56.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Oct 2014 08:56:02 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by mail-la0-f49.google.com with SMTP id q1so1118112lam.36 for ; Thu, 23 Oct 2014 08:56:02 -0700 (PDT) X-Received: by 10.112.130.41 with SMTP id ob9mr5992700lbb.74.1414079762621; Thu, 23 Oct 2014 08:56:02 -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.112.84.229 with SMTP id c5csp279846lbz; Thu, 23 Oct 2014 08:56:01 -0700 (PDT) X-Received: by 10.66.224.202 with SMTP id re10mr6134088pac.6.1414079760931; Thu, 23 Oct 2014 08:56:00 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sn3si1884388pbc.175.2014.10.23.08.56.00 for ; Thu, 23 Oct 2014 08:56:00 -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 S1755587AbaJWPyY (ORCPT + 28 others); Thu, 23 Oct 2014 11:54:24 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:49991 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1755442AbaJWPyU (ORCPT ); Thu, 23 Oct 2014 11:54:20 -0400 X-Listener-Flag: 11101 Received: from mtkhts09.mediatek.inc [(172.21.101.70)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 134749029; Thu, 23 Oct 2014 23:54:14 +0800 Received: from mtksdtcf02.mediatek.inc (10.21.12.142) by mtkhts09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.181.6; Thu, 23 Oct 2014 23:54:11 +0800 From: Yingjoe Chen To: Rob Herring , Jiang Liu , Marc Zyngier , Matthias Brugger , CC: Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Russell King , Thomas Gleixner , Jason Cooper , Benjamin Herrenschmidt , Yingjoe Chen , Grant Likely , Hans de Goede , Boris BREZILLON , , , , Olof Johansson , Arnd Bergmann , , , , , , Subject: [PATCH v4 2/7] irqdomain: Add back xlate and set_type for hierarchy irq domain Date: Thu, 23 Oct 2014 23:53:10 +0800 Message-ID: <1414079595-26129-3-git-send-email-yingjoe.chen@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1414079595-26129-1-git-send-email-yingjoe.chen@mediatek.com> References: <1414079595-26129-1-git-send-email-yingjoe.chen@mediatek.com> MIME-Version: 1.0 X-MTK: N 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: yingjoe.chen@mediatek.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.215.49 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: , Move xlate and set_type out to common code for hierarchy irq domain. Withouth this common code, all outermost irq domain will have to duplicate these function. Signed-off-by: Yingjoe Chen --- kernel/irq/irqdomain.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index dd8d3ab..b3288e8 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -478,11 +478,6 @@ unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data) return 0; } - if (irq_domain_is_hierarchy(domain)) { - virq = irq_domain_alloc_irqs(domain, 1, NUMA_NO_NODE, irq_data); - return virq <= 0 ? 0 : virq; - } - /* If domain has no translation, then we assume interrupt line */ if (domain->ops->xlate == NULL) hwirq = irq_data->args[0]; @@ -492,10 +487,26 @@ unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data) return 0; } - /* Create mapping */ - virq = irq_create_mapping(domain, hwirq); - if (!virq) - return virq; + if (irq_domain_is_hierarchy(domain)) { + if (domain->ops->xlate) { + /* + * If we've already configured this interrupt, + * don't do it again, or hell will break loose. + */ + virq = irq_find_mapping(domain, hwirq); + if (virq) + return virq; + } + + virq = irq_domain_alloc_irqs(domain, 1, NUMA_NO_NODE, irq_data); + if (virq <= 0) + return 0; + } else { + /* Create mapping */ + virq = irq_create_mapping(domain, hwirq); + if (!virq) + return virq; + } /* Set type if specified and different than the current one */ if (type != IRQ_TYPE_NONE &&