From patchwork Wed Jan 11 15:06:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 90914 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1166790qgi; Wed, 11 Jan 2017 07:09:40 -0800 (PST) X-Received: by 10.98.102.21 with SMTP id a21mr5962239pfc.29.1484147380012; Wed, 11 Jan 2017 07:09:40 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j19si6054071pgn.187.2017.01.11.07.09.39; Wed, 11 Jan 2017 07:09:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764834AbdAKPJW (ORCPT + 25 others); Wed, 11 Jan 2017 10:09:22 -0500 Received: from mail-pg0-f54.google.com ([74.125.83.54]:35314 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764805AbdAKPJT (ORCPT ); Wed, 11 Jan 2017 10:09:19 -0500 Received: by mail-pg0-f54.google.com with SMTP id 194so21638180pgd.2 for ; Wed, 11 Jan 2017 07:09:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3uuQ0vYcdRVaBrnn0+Zhdf7QJ0Jx8XtyjVeviTuiAIU=; b=baWLlbQUE4p/6aiAejCbOq0N0wvHiZZcMMu55BKMTZ+aISmxgQlogVjaVv4Tgm71of gOZFY3npzScEAlf2a6CE0gI6/eFE/ZkYrigSDM7csMWMgyQlWorbm8QMCu40LyoCoY2N 5wxH+94+JK/BJRbY7D5BxdNrGv0bAjEf7HjFQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3uuQ0vYcdRVaBrnn0+Zhdf7QJ0Jx8XtyjVeviTuiAIU=; b=kLRo11KZ9SOYuoGTXEX7aoiVx9QnEPLHWp5J/3r2VRiN7V6bhGlJwygAiQOJiFdaCM RuNblmqV7mDZW6k0mLQaRQw1/Omh122PjGr+7M7A9zF/57gPliRCnqgbo23QQmp5uJig VAbBxWsLO4qYPyTEZ/UGe7CSjVuiDB8Ah5KanhLvq6biVnUCkEiScqlzPq00a+B7pE1c exBWJXNrJl09vpLhhCno6SozyrYvP1ieR8GdJdlxfvnWJ6vW940vVdOTZEUGmzoCAiwH c/ATKai1TxOu6KKdkbWBV9N+EAYv5riGmltpJLCNl2A5RJYKgSj5WjW9xrcFuTkK6DMQ 6JrQ== X-Gm-Message-State: AIkVDXKqjnvd+WGbdPOsnZivBemIAj7V1oCN01iEVhyjUEOcZG34Qz6Xibl/bgi2dg6ImwUJ X-Received: by 10.99.62.73 with SMTP id l70mr11037972pga.97.1484147358409; Wed, 11 Jan 2017 07:09:18 -0800 (PST) Received: from localhost ([104.237.91.103]) by smtp.googlemail.com with ESMTPSA id 18sm14703340pgf.28.2017.01.11.07.09.16 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 11 Jan 2017 07:09:17 -0800 (PST) From: Hanjun Guo To: Marc Zyngier , "Rafael J. Wysocki" , Lorenzo Pieralisi Cc: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxarm@huawei.com, Thomas Gleixner , Greg KH , Tomasz Nowicki , Ma Jun , Kefeng Wang , Agustin Vega-Frias , Sinan Kaya , huxinwei@huawei.com, yimin@huawei.com, Jon Masters , Matthias Brugger , Xinwei Kong , Hanjun Guo Subject: [PATCH v7 14/15] irqchip: mbigen: introduce mbigen_of_create_domain() Date: Wed, 11 Jan 2017 23:06:38 +0800 Message-Id: <1484147199-4267-15-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1484147199-4267-1-git-send-email-hanjun.guo@linaro.org> References: <1484147199-4267-1-git-send-email-hanjun.guo@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kefeng Wang Introduce mbigen_of_create_domain() to consolidate OF related code and prepare for ACPI later, no funtional change. Signed-off-by: Kefeng Wang Signed-off-by: Hanjun Guo Reviewed-by: Ma Jun Cc: Marc Zyngier Cc: Thomas Gleixner --- drivers/irqchip/irq-mbigen.c | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) -- 1.9.1 diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c index c01ab41..4e11da5 100644 --- a/drivers/irqchip/irq-mbigen.c +++ b/drivers/irqchip/irq-mbigen.c @@ -236,27 +236,15 @@ static int mbigen_irq_domain_alloc(struct irq_domain *domain, .free = irq_domain_free_irqs_common, }; -static int mbigen_device_probe(struct platform_device *pdev) +static int mbigen_of_create_domain(struct platform_device *pdev, + struct mbigen_device *mgn_chip) { - struct mbigen_device *mgn_chip; + struct device *parent; struct platform_device *child; struct irq_domain *domain; struct device_node *np; - struct device *parent; - struct resource *res; u32 num_pins; - mgn_chip = devm_kzalloc(&pdev->dev, sizeof(*mgn_chip), GFP_KERNEL); - if (!mgn_chip) - return -ENOMEM; - - mgn_chip->pdev = pdev; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - mgn_chip->base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(mgn_chip->base)) - return PTR_ERR(mgn_chip->base); - for_each_child_of_node(pdev->dev.of_node, np) { if (!of_property_read_bool(np, "interrupt-controller")) continue; @@ -280,6 +268,30 @@ static int mbigen_device_probe(struct platform_device *pdev) return -ENOMEM; } + return 0; +} + +static int mbigen_device_probe(struct platform_device *pdev) +{ + struct mbigen_device *mgn_chip; + struct resource *res; + int err; + + mgn_chip = devm_kzalloc(&pdev->dev, sizeof(*mgn_chip), GFP_KERNEL); + if (!mgn_chip) + return -ENOMEM; + + mgn_chip->pdev = pdev; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + mgn_chip->base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); + if (IS_ERR(mgn_chip->base)) + return PTR_ERR(mgn_chip->base); + + err = mbigen_of_create_domain(pdev, mgn_chip); + if (err) + return err; + platform_set_drvdata(pdev, mgn_chip); return 0; }