From patchwork Mon Jan 2 13:31:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 89505 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp7593068qgi; Mon, 2 Jan 2017 05:34:40 -0800 (PST) X-Received: by 10.98.147.93 with SMTP id b90mr53243007pfe.170.1483364080875; Mon, 02 Jan 2017 05:34:40 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a7si37440854pll.172.2017.01.02.05.34.40; Mon, 02 Jan 2017 05:34:40 -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 dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933218AbdABNeU (ORCPT + 25 others); Mon, 2 Jan 2017 08:34:20 -0500 Received: from mail-pg0-f42.google.com ([74.125.83.42]:36496 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933202AbdABNeR (ORCPT ); Mon, 2 Jan 2017 08:34:17 -0500 Received: by mail-pg0-f42.google.com with SMTP id f188so204003137pgc.3 for ; Mon, 02 Jan 2017 05:34:17 -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=hBrlStp1xcBnTMtznFN4BupkwPyFcJP9Y3jWS8MMBOk=; b=eG+/LsOS6eHsNTZJiSzqCJlNqBZ+6LIi5pIEEiMBZgpB91ZgP0iP/2J2Y65znr0Y76 aw6mZrZLLsR93RldMG+jh+NEXeGGdwwj73H9m6sJO3L9QpwQBejhElEpqf5yz8071yc+ YDl2VQrvo0hY2k2m9a31xBc/E13TSdN5pdG4U= 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=hBrlStp1xcBnTMtznFN4BupkwPyFcJP9Y3jWS8MMBOk=; b=S4fnK5FkZjAVqDBtxF9cio7rYQ+p7Oji56DZaLrT2ART3oOWuhBTiXjMRjdOhSLHLH 4+/1C4Rej/9VOIkuPg67ZKHe7WFpzMF+Z7oLyvjMHdjVod6rTVOA2USUNsm8YXeCyyxA a827qDRWcIKtOEpZ5Xu2a8Io09aXUBpujJO9so0SgtUst7aWqzVGcNEcmkbByQKbjHc9 Wl37rqDlc7tG27pjGk1XvgNYNuthtjTE+Uw1FQlZWe+GNLsVNo55H8oKELlwYUiROZUN tFKIgSc8FC7q4/DdxY3uK0McXRnyU/sX2DQRji65veFte4d/v5Gx6KsD1b4E5j08zTv0 a9Xw== X-Gm-Message-State: AIkVDXJU8zRRjADGNHQehGUg5PshWJlZmcNY86Px/wWy6fsUkTGSEevQ3qP7QXOQBeCKJ8ED X-Received: by 10.98.32.12 with SMTP id g12mr44493523pfg.0.1483364056879; Mon, 02 Jan 2017 05:34:16 -0800 (PST) Received: from localhost ([104.237.91.251]) by smtp.googlemail.com with ESMTPSA id t21sm132618339pfa.1.2017.01.02.05.34.15 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 02 Jan 2017 05:34:16 -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 , charles.garcia-tobin@arm.com, huxinwei@huawei.com, yimin@huawei.com, Jon Masters , Hanjun Guo Subject: [PATCH v6 13/14] irqchip: mbigen: introduce mbigen_of_create_domain() Date: Mon, 2 Jan 2017 21:31:44 +0800 Message-Id: <1483363905-2806-14-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1483363905-2806-1-git-send-email-hanjun.guo@linaro.org> References: <1483363905-2806-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: Majun Tested-by: Majun Tested-by: Xinwei Kong 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; }