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: 9493649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6C5B762AB4 for ; Mon, 2 Jan 2017 13:36:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BDAD1FF35 for ; Mon, 2 Jan 2017 13:36:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 506D42679B; Mon, 2 Jan 2017 13:36:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0E6601FF35 for ; Mon, 2 Jan 2017 13:36:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cO2lp-0007aT-DH; Mon, 02 Jan 2017 13:35:25 +0000 Received: from mail-pg0-x22f.google.com ([2607:f8b0:400e:c05::22f]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cO2ky-00061S-NE for linux-arm-kernel@lists.infradead.org; Mon, 02 Jan 2017 13:34:43 +0000 Received: by mail-pg0-x22f.google.com with SMTP id i5so139270958pgh.2 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=PLQeyBd1KmTD/MTpJ+i5ZWyXLfMRNH34Ey50Gj3XDkhiKvnG7CNJIM/24HyfQKyUR0 b4rrjr4MyUjiUVHNjiUYZe3xttYrRTHXc9KJ5K/yb8DwBmwrj3oiEoIRQI7OXiASj4Du yesoxs1EUHkMkL9Nq8FgHrspaNK0yju7Nle/MF7wKrvV5RUkYNtw4vWJaXdZNYku6mt1 Gl6YHVX/l1oG/boUl4OMEVly9D6TS6dgB6jR3r7cE3rt76U0gqsuwDwq1P0T91/3sJSC OiQhk066tEQqD6L5IpklOVokcPdb3rBGQXhIDJ3CNvZBS0F+FrF7rzYMbReM+LpOr0Ki PsRA== X-Gm-Message-State: AIkVDXIXiVxhbgvsBjL8qaL/bqxHhKdkwUouqnL6e+zkmM8FA7sijBICK0S+4nru2wnIiHBO 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170102_053433_321383_632AC1E4 X-CRM114-Status: GOOD ( 12.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huxinwei@huawei.com, Kefeng Wang , charles.garcia-tobin@arm.com, Jon Masters , yimin@huawei.com, Greg KH , linux-kernel@vger.kernel.org, linuxarm@huawei.com, Sinan Kaya , linux-acpi@vger.kernel.org, Hanjun Guo , Tomasz Nowicki , Thomas Gleixner , Agustin Vega-Frias , linux-arm-kernel@lists.infradead.org, Ma Jun MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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; }