From patchwork Wed Nov 12 13:42:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 40667 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 203F5206A5 for ; Wed, 12 Nov 2014 13:47:37 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id k14sf6603508wgh.3 for ; Wed, 12 Nov 2014 05:47:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:user-agent:date:from:to :cc:subject: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 :content-disposition; bh=gIB5xoVoEG9Al4HEA4EWlgy1bzZHENMec4+zdImV/f0=; b=NQneHrCMBQsj4IpX4MbxP3ZO/z1aMMo/iIBT+gqCaf/PuIOjXvD+o2XlDbiqlhK6nl gvMet8dTwOYdAsa5FEl4nd3ARH2Kz134vxoLF1NpRPOJ1aM4oOnZq4iieSgHZi6xaGDp pYOZcJeMEXnTjSgTvAw8SX1BCYDEMccMUEq9j7sxzpCHmRLf6WAl5X3UIYxJhaKp+y/v lakpV0eXplqQ27k7Txsljidpd31BBP61vWx5+KSz3CRO58VVERvvv9TG1M1qo0219nKM 1bZcg+Kknu0xmIoR92JUJm6uJg14y8QBx3zSpvrGIEaZ7e5ihAJqk2wROyr82eh9+kFD BeRQ== X-Gm-Message-State: ALoCoQmYQOQIdP3MfVsdiT1VUoyBFAbDXU26XoZmvO+/9xIdiDBRxkaR4hRWvG794wNXwIzJ43+V X-Received: by 10.152.36.135 with SMTP id q7mr384498laj.8.1415800056152; Wed, 12 Nov 2014 05:47:36 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.39 with SMTP id b7ls593423lae.38.gmail; Wed, 12 Nov 2014 05:47:35 -0800 (PST) X-Received: by 10.112.140.135 with SMTP id rg7mr2077380lbb.100.1415800055773; Wed, 12 Nov 2014 05:47:35 -0800 (PST) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id xe3si34877392lbb.114.2014.11.12.05.47.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Nov 2014 05:47:35 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id l4so9390959lbv.38 for ; Wed, 12 Nov 2014 05:47:35 -0800 (PST) X-Received: by 10.112.235.196 with SMTP id uo4mr32801455lbc.66.1415800055656; Wed, 12 Nov 2014 05:47:35 -0800 (PST) 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.184.201 with SMTP id ew9csp425586lbc; Wed, 12 Nov 2014 05:47:34 -0800 (PST) X-Received: by 10.66.90.129 with SMTP id bw1mr47017827pab.61.1415800053345; Wed, 12 Nov 2014 05:47:33 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bh4si22943986pbc.5.2014.11.12.05.47.32 for ; Wed, 12 Nov 2014 05:47:33 -0800 (PST) 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 S1753329AbaKLNrM (ORCPT + 25 others); Wed, 12 Nov 2014 08:47:12 -0500 Received: from www.linutronix.de ([62.245.132.108]:41599 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752521AbaKLNmy (ORCPT ); Wed, 12 Nov 2014 08:42:54 -0500 Received: from localhost ([127.0.0.1] helo=[127.0.1.1]) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1XoYCC-00050W-V9; Wed, 12 Nov 2014 14:42:53 +0100 Message-Id: <20141112134119.962065711@linutronix.de> User-Agent: quilt/0.63-1 Date: Wed, 12 Nov 2014 13:42:54 -0000 From: Thomas Gleixner To: LKML Cc: Jiang Liu , Yingjoe Chen , Bjorn Helgaas , Grant Likely , Marc Zyngier , Yijing Wang Subject: [patch 02/16] irqdomain: Do irq_find_mapping and set_type for hierarchy irqdomain in case OF References: <20141112133941.647950773@linutronix.de> MIME-Version: 1.0 X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1, SHORTCIRCUIT=-0.0001, URIBL_BLOCKED=0.001 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: tglx@linutronix.de X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 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: , Content-Disposition: inline; filename=irqdomain-do-irq_find_mapping-and-set_type-for-hierarchy-irqdomain-in-case-of.patch From: Yingjoe Chen It is possible to call irq_create_of_mapping to create/translate the same IRQ from DT for multiple times. Perform irq_find_mapping check and set_type for hierarchy irqdomain in irq_create_of_mapping() to avoid duplicate these functionality in all outer most irqdomain. Signed-off-by: Yingjoe Chen Signed-off-by: Jiang Liu Cc: Bjorn Helgaas Cc: Grant Likely Cc: Marc Zyngier Cc: Yingjoe Chen Cc: Yijing Wang Signed-off-by: Thomas Gleixner --- kernel/irq/irqdomain.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 610891e63844..4811bee1b8a7 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,24 @@ 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 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 &&