Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752051AbdHGDY3 (ORCPT ); Sun, 6 Aug 2017 23:24:29 -0400 Received: from mail-sn1nam01on0051.outbound.protection.outlook.com ([104.47.32.51]:50624 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751868AbdHGDYY (ORCPT ); Sun, 6 Aug 2017 23:24:24 -0400 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; From: Zhao Qiang To: CC: , , , , Zhao Qiang Subject: [PATCH v10 3/4] irqchip/qeic: merge qeic_of_init into qe_ic_init Date: Mon, 7 Aug 2017 11:07:15 +0800 Message-ID: <1502075236-24078-4-git-send-email-qiang.zhao@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 In-Reply-To: <1502075236-24078-1-git-send-email-qiang.zhao@nxp.com> References: <1502075236-24078-1-git-send-email-qiang.zhao@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131465498607083129;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.168.50;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(336005)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(2950100002)(2351001)(6916009)(6666003)(36756003)(5660300001)(5003940100001)(33646002)(47776003)(104016004)(50986999)(76176999)(305945005)(50226002)(77096006)(8656003)(105606002)(8676002)(86362001)(106466001)(8936002)(81156014)(97736004)(48376002)(54906002)(85426001)(626005)(189998001)(68736007)(4326008)(50466002)(110136004);DIR:OUT;SFP:1101;SCL:1;SRVR:DM2PR0301MB0909;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q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OYCRQ0eC?= =?us-ascii?Q?6FcWcpJ6XAH9LcMSGifQXLPS034JaY3cf5mYO6E38/yWl+I8JEx7KU3w70hJ?= =?us-ascii?Q?dRVi45FOPUwzeBsgaHTQH7ZBqTE4DMDmVmB6z/mvg=3D=3D?= MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 87df90b6-679d-46eb-7d18-08d4dd43cb26 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603031)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:DM2PR0301MB0909; X-Microsoft-Exchange-Diagnostics: 1;DM2PR0301MB0909;3:1bA0KhXptu/6UqryhobYLjk3wWaYYMzZXdUvMptu5EuAYXyZ5bBzLyQDnTcFdhEG24VWoBt/aSFYHvNcPAOE9XCBN1tjCXVbu+rIRjvvz+Po+1ziFelcBFvhGFI5tAJyGKKJsZvFqP2ycHH04R0oQlE7l5PUT/fmG3HDc4TirwCb7TIY+vz5zxRko8n7y288ZI2M89k5TUNcsHDrloBmyypoG5u19kEYlVzGQ7Vj00Fb5pEp42Xifp3+unwaN/Oxd63/8XNK4+AE/5hpBJcKLxs0WdWId4woCRAOyuS8FLhmnRCKI6DE2rlcDTHehdkdBHhb8zAwvdm9yjsEMaOhoBvWo0CMKF9UNCUdhMCUzYw=;25:F2UsvXaT/r2kdZwl9IRCWY16csPDbCU8kI7nRURXpDl4XLX8yetznJPjwEsSTa3I4uLpB9NETQa8qyvVuJw0GidPWKU9QtjQImjdt1FvHoinhMFd8ZJ1cZKQwKDG/WajcTaN4xtPfeQQkLQXf2EQQSQ2gnP8nePe9w/Ehto4LM0j7w24JcVpgyovVls9B3vxy7SuxlNX8SYT4pzrNogFbdJf4j6Cq9HfezcikW/JSrD6FINUsd9xeEYoBwoTlSZ2gvyn/w4kGKNK8U/7KybnAaVKJgWXrtFeyK+/I4QwZw2TBbrA2ykajAGBJYOm37dty3Gc4jmhETmhB1qm3dwL8g== X-MS-TrafficTypeDiagnostic: DM2PR0301MB0909: X-Microsoft-Exchange-Diagnostics: 1;DM2PR0301MB0909;31:O1lbLbVNMjLFRlVUhaTbnznwUDTmJlBAgv6Z4/WMiMTIRuy1hz2jweK5FuWA4QLIJLPw22bh0O7KZ8vEPKxYkWrs4CZ6sF4h9Xkbw/WaJQ2nAPykXzJr+ULUUj14rqP+xgGZAPyeiel3+7TS5M6eGLWnycpqOmfs1KTS7l+tN2E01xINV8jziz2lceNS0sgsT6YA+l+tQ2Xb6oc6rBrcXm3BvMb9rNusT0z85pPEuEU= X-Forefront-PRVS: 0392679D18 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM2PR0301MB0909;23:lpM/rnKAySKFThSaR2SNP+BrzN/aJxznNFCO3+2?= =?us-ascii?Q?eFbwmZAium4BVwcmavt+U8DkpP1ttlESx3k1WVUpBKjTle4h6JTPioE0qs/n?= =?us-ascii?Q?FDKynM/fCBWUFmzDBtTjAHvB4x+CG1k2tYQkZYOBUeuBp6/JNf2RC0DBQbWI?= =?us-ascii?Q?kL6wAnDs4nK4Vy2HNWzGVpNiU3Ua0MwazUZalYyvFkVRfZHG63o0MKpTVx7r?= =?us-ascii?Q?Q/qpum7lpVnBakyuwkrIbrHKTQu6knFyG01O1oQpL1GWapVf+oIkLMALZtQj?= =?us-ascii?Q?lR40byFvQgJ9gktn1CRFZrQg0QR/f+h+dGmVbMbfgcYjxNB3pk/wpbDsFJ9L?= =?us-ascii?Q?eplLNWJSH3oBcCzA9Qn4q94AdmRkBQGTpfgdZqhk3kFHP1Z+6I9E42O0IMkp?= =?us-ascii?Q?eKDexjvXv5FUxuoMnbiz1nP6HJk+dZ4o5zdXAS3YTJTAvomVlYOps6yk6q2G?= =?us-ascii?Q?d7jpYdUuFn3G1BmrBq8FBJCKWwr2LFZZqzf2PMZFA+3UXROES6rEK+4w9zT3?= =?us-ascii?Q?9aPuZ/bon/xvZLQiKpi6MMn10la5+P4bvkQIzdWpu/8FSLNVP8rQPqore7Bp?= =?us-ascii?Q?RnEzLYkH5u9eHjrWRhLW6aH2QjUqDtJk3JoOL1ClzIQ30ql2xWj/C8VUd2o6?= =?us-ascii?Q?DVNwUVvY0JG/ZavMHVjnFXW2RnVjeYSAKrAPqBuabCqM+eHpA/YNl5NYa6Ab?= =?us-ascii?Q?oK312CIkr2eDChLjm8rncw/ix50yhgFlfD8x4HIO9Q80MQhAftS4QwDB3qrZ?= =?us-ascii?Q?ruhkqrG+hPqn6gyliuymtHaicx779/nI7fshHikbUeFX8CQufBnLDowyX5hn?= =?us-ascii?Q?q/5mC2LCRNQRB2//a2bQyJt9dvH5aXjSSjX+2YeJtQiVxmOt1PAHWElENC6l?= =?us-ascii?Q?ptYSzZEM8rn+ZGr8qoaomHQujoVLsljg50yt1IC/TI8xWeSulJmjUA0akJ+B?= =?us-ascii?Q?l6FwEMnuxm9DAkm7giLO2ZESkS3ItU1kuaBPNBuZcKA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;DM2PR0301MB0909;6:2GiNipfcDyIB3PcTzZGfcTw1T76o4mCY9PALUWP6S7yRFm16WJEdzoCOISRVJSga3UkavWPRrDLA8DiLUoQpuxTPzcCGzP5xRrhlf7ZSednJC1Ck71esbGa765CFJ5MPTnNBEqAeXEFtldMeEMkUZFAVWQusSuDGd1lmua3Txu7EqiAGenmMmQ9Jzyaq3UshYtuQynEoY9zbuBPecVTXfPs4H7h9BzokytNS5bTXcbB1pX451BDosDFWd6KZcYmsS5g2HNaAeIUpiljEk3OgQXARUUfzv3CY84IoXGxRSQf+UvVeJfuh03K2oQSVK7gQaXOEVF28g9fCrB0nCnfkjA==;24:bKTmko3RhGfgeWzQYiQcRZGguogAH10HAvGv1Mj2fO6YedpeGT+tyhQXWskPOCoUTmCQg97qGGmEinax8GJvSgNonm0lWXDHKu+zC1/9B0s=;7:Xn1AGJuGDEdDAsrV/tVaewTV5o0Pl2VKyIrC9eoju8tD/kEj1Y+F3O6w0+TnUI8K8DPFlysyyZ3YEmu9WWfN5JpOByYMQkOBItskntlYw4GwERqJjo8Ms/Eecmn8kgdFdo3EkRnk6eEIwhdpj4Tu/jCqwJoQ0FNgwCHgSFq/ul5iq+PHmG6SksQsZLJkJvlbLw6Vd+GDl8NNnpmVWgYQnlxAwqq5Sf56FP7bzi/AJBQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2017 03:24:20.5211 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0301MB0909 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5017 Lines: 175 qeic_of_init just get device_node of qeic from dtb and call qe_ic_init, pass the device_node to qe_ic_init. So merge qeic_of_init into qe_ic_init to get the qeic node in qe_ic_init. Signed-off-by: Zhao Qiang --- drivers/irqchip/irq-qeic.c | 90 ++++++++++++++++++++-------------------------- include/soc/fsl/qe/qe_ic.h | 7 ---- 2 files changed, 39 insertions(+), 58 deletions(-) diff --git a/drivers/irqchip/irq-qeic.c b/drivers/irqchip/irq-qeic.c index 8287c22..a2d8084 100644 --- a/drivers/irqchip/irq-qeic.c +++ b/drivers/irqchip/irq-qeic.c @@ -407,27 +407,33 @@ unsigned int qe_ic_get_high_irq(struct qe_ic *qe_ic) return irq_linear_revmap(qe_ic->irqhost, irq); } -void __init qe_ic_init(struct device_node *node, unsigned int flags, - void (*low_handler)(struct irq_desc *desc), - void (*high_handler)(struct irq_desc *desc)) +static int __init qe_ic_init(struct device_node *node, unsigned int flags) { struct qe_ic *qe_ic; struct resource res; - u32 temp = 0, ret, high_active = 0; + u32 temp = 0, high_active = 0; + int ret = 0; + + if (!node) + return -ENODEV; ret = of_address_to_resource(node, 0, &res); - if (ret) - return; + if (ret) { + ret = -ENODEV; + goto err_put_node; + } qe_ic = kzalloc(sizeof(*qe_ic), GFP_KERNEL); - if (qe_ic == NULL) - return; + if (qe_ic == NULL) { + ret = -ENOMEM; + goto err_put_node; + } qe_ic->irqhost = irq_domain_add_linear(node, NR_QE_IC_INTS, &qe_ic_host_ops, qe_ic); if (qe_ic->irqhost == NULL) { - kfree(qe_ic); - return; + ret = -ENOMEM; + goto err_free_qe_ic; } qe_ic->regs = ioremap(res.start, resource_size(&res)); @@ -438,9 +444,9 @@ void __init qe_ic_init(struct device_node *node, unsigned int flags, qe_ic->virq_low = irq_of_parse_and_map(node, 1); if (qe_ic->virq_low == NO_IRQ) { - printk(KERN_ERR "Failed to map QE_IC low IRQ\n"); - kfree(qe_ic); - return; + pr_err("Failed to map QE_IC low IRQ\n"); + ret = -ENOMEM; + goto err_domain_remove; } /* default priority scheme is grouped. If spread mode is */ @@ -467,13 +473,24 @@ void __init qe_ic_init(struct device_node *node, unsigned int flags, qe_ic_write(qe_ic->regs, QEIC_CICR, temp); irq_set_handler_data(qe_ic->virq_low, qe_ic); - irq_set_chained_handler(qe_ic->virq_low, low_handler); + irq_set_chained_handler(qe_ic->virq_low, qe_ic_cascade_low_mpic); if (qe_ic->virq_high != NO_IRQ && qe_ic->virq_high != qe_ic->virq_low) { irq_set_handler_data(qe_ic->virq_high, qe_ic); - irq_set_chained_handler(qe_ic->virq_high, high_handler); + irq_set_chained_handler(qe_ic->virq_high, + qe_ic_cascade_high_mpic); } + of_node_put(node); + return 0; + +err_domain_remove: + irq_domain_remove(qe_ic->irqhost); +err_free_qe_ic: + kfree(qe_ic); +err_put_node: + of_node_put(node); + return ret; } void qe_ic_set_highest_priority(unsigned int virq, int high) @@ -570,45 +587,16 @@ int qe_ic_set_high_priority(unsigned int virq, unsigned int priority, int high) return 0; } -static struct bus_type qe_ic_subsys = { - .name = "qe_ic", - .dev_name = "qe_ic", -}; - -static struct device device_qe_ic = { - .id = 0, - .bus = &qe_ic_subsys, -}; - -static int __init init_qe_ic_sysfs(void) +static int __init init_qe_ic(struct device_node *node, + struct device_node *parent) { - int rc; - - printk(KERN_DEBUG "Registering qe_ic with sysfs...\n"); + int ret; - rc = subsys_system_register(&qe_ic_subsys, NULL); - if (rc) { - printk(KERN_ERR "Failed registering qe_ic sys class\n"); - return -ENODEV; - } - rc = device_register(&device_qe_ic); - if (rc) { - printk(KERN_ERR "Failed registering qe_ic sys device\n"); - return -ENODEV; - } - return 0; -} + ret = qe_ic_init(node, 0); + if (ret) + return ret; -static int __init qeic_of_init(struct device_node *node, - struct device_node *parent) -{ - if (!node) - return -ENODEV; - qe_ic_init(node, 0, qe_ic_cascade_low_mpic, - qe_ic_cascade_high_mpic); - of_node_put(node); return 0; } -IRQCHIP_DECLARE(qeic, "fsl,qe-ic", qeic_of_init); -subsys_initcall(init_qe_ic_sysfs); +IRQCHIP_DECLARE(qeic, "fsl,qe-ic", init_qe_ic); diff --git a/include/soc/fsl/qe/qe_ic.h b/include/soc/fsl/qe/qe_ic.h index 1e155ca..6113699 100644 --- a/include/soc/fsl/qe/qe_ic.h +++ b/include/soc/fsl/qe/qe_ic.h @@ -58,16 +58,9 @@ enum qe_ic_grp_id { }; #ifdef CONFIG_QUICC_ENGINE -void qe_ic_init(struct device_node *node, unsigned int flags, - void (*low_handler)(struct irq_desc *desc), - void (*high_handler)(struct irq_desc *desc)); unsigned int qe_ic_get_low_irq(struct qe_ic *qe_ic); unsigned int qe_ic_get_high_irq(struct qe_ic *qe_ic); #else -static inline void qe_ic_init(struct device_node *node, unsigned int flags, - void (*low_handler)(struct irq_desc *desc), - void (*high_handler)(struct irq_desc *desc)) -{} static inline unsigned int qe_ic_get_low_irq(struct qe_ic *qe_ic) { return 0; } static inline unsigned int qe_ic_get_high_irq(struct qe_ic *qe_ic) -- 2.1.0.27.g96db324