Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755433AbcLZIqD (ORCPT ); Mon, 26 Dec 2016 03:46:03 -0500 Received: from mail-sn1nam02on0075.outbound.protection.outlook.com ([104.47.36.75]:45864 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755405AbcLZIpz (ORCPT ); Mon, 26 Dec 2016 03:45:55 -0500 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;nxp.com; dkim=none (message not signed) header.d=none; From: Zhao Qiang To: , CC: , , , , Zhao Qiang Subject: [Patch V7 3/4] irqchip/qeic: merge qeic_of_init into qe_ic_init Date: Mon, 26 Dec 2016 16:32:45 +0800 Message-ID: <1482741166-33164-3-git-send-email-qiang.zhao@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 In-Reply-To: <1482741166-33164-1-git-send-email-qiang.zhao@nxp.com> References: <1482741166-33164-1-git-send-email-qiang.zhao@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131272155535076636;(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)(7916002)(39400400002)(39380400002)(39860400002)(39450400003)(39850400002)(39840400002)(39410400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(4326007)(626004)(5001770100001)(97736004)(5660300001)(2906002)(92566002)(8936002)(50226002)(104016004)(189998001)(50986999)(76176999)(50466002)(356003)(305945005)(48376002)(81166006)(81156014)(8676002)(68736007)(47776003)(106466001)(85426001)(105606002)(36756003)(38730400001)(8656002)(77096006)(6666003)(33646002)(86362001)(5003940100001)(2950100002)(7059030);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR03MB2477;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD045;1:XZPPLgp4ZwKifN8LCn1VoT+WeR3H7qW0F/OcC7CmW/cEEYYTfJoVeE2xq+c5NlgHcWnDCdmQmIS31JbXNosMFBow1m4ayiBKe6eba0etdlLDd222O4FVK6TO7VWtkVHWU2VvUVFjYaPOK7qeGB55Rat3me6KUDqYaKolfGN74Cn5DXySm4A8v0GH9wKDa90XXwYq0Bx9gMERrqrhq3ztxDa2qE8lUCGKz+gDfnjY+VSeBn9YEnFqeOoDsLZvyLCYJcATlvJ4620iLViUpqsffbMqFK314xUB9h9AwQf4ObxDQQWY7yEVLZY+U+cP6cPG3zAJTrk+/bt0ktEbK5FJftEvTKueXCXvW3ScEy/JVJnIzi69XNWzoZbel9lhqns9s/V2vlMyPWc/xyhdVzMTq5Acq0bIuof/HiMZUbylioxauIqjZ0u++vNPAMs//CtnZAfqd7RAgvTvnmZERkDh+DXJF/X+Whqbm2pGLh+/F0P3SSJ6E1+KZakjnia8W4k6HcrjlPWD2644rDjiOcvxqBUM2kxRWgePybrQ0xhQt7Er5z0CksExsKEWQ8SuH0/AAxc+IZSM/IJAdH6HtVgLWx2DU56kTmG657+Dkfl8PHOgEG86DfJFXUxwQoTIvT5no61epChk1TEoNFipQ5lD0isHm9h1t4WSAUNluECUrn5kIJ/Ng8b4qegbBx2H2q4TA7hk0Yp1WWU8roJx66l/qjRHPlDBOHr5jg5wkXWFasSu40c+N2EeGzskQg68NzXA MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: b737566a-b136-4a26-00d7-08d42d6b99f3 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR03MB2477; X-Microsoft-Exchange-Diagnostics: 1;MWHPR03MB2477;3:nkd0T4uUGX7jBhB39hc9ux8Y+miarLp7g25CDBl5gsMANf87t3f5SLuI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fBnjdplvFx+OqxiSWXDw1Pd+QakMw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6095060)(601004)(2401047)(13024025)(13023025)(13015025)(13017025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123565025)(20161123563025);SRVR:MWHPR03MB2477;BCL:0;PCL:0;RULEID:(400006);SRVR:MWHPR03MB2477; X-Microsoft-Exchange-Diagnostics: 1;MWHPR03MB2477;4:Qy6GHzP/gf8uq2N3c878cfoVgeOnoy9WJtmxoBE4DghM6DbU+e9AheA7hWyhxhnXN3UXQKhhRkgSx13jvBaRJyJtAib46d9BMXiGspTdNEAzZx1cbYmEEfnaokZ6/1SYNXkB8XxYhluUDPIOEXOev1VWY9oW6acN2OQdrd0MMkqL7u6XZ4NRQX7sBV7RNnged4iipPfGFNdtiPrjFrqtN1kUCjOGnISnejH8JNEIQFHlKtcOBvEWXseH0xCNroUclaH7+zbaL1n1v/T2qdomiuhjn/wtm9E/7f1eDS+RfBf+xMh/JppZUM9KRSnbudkscqyq6X9/vWaQIkSRDcpMwK4TLGzf13nE19sMfg27D5jwrsIXNNWoyuEF2TKNGWh3v8h7b9WWLAdJg2u6NFkFMqvwEuJ36wDngDCl9aEUnd3O86L7cn4zxLmtyDzBeTzE2l+ltvVojugQojsrMWI5NorC/cj1RXVm8s8D8HEFrvspFy9eDDn1NZMOU+qEuuLVJ5qFsTyBvgJbUy/b1Ph+W7G1kR5x5q0A88d1Qkl2ATLJxYo+5y9ZDAkGaEs89/fM8jmU7FEKdEsN+Ov5f0NQCadSwMq7qz/g+yjLyzEqaUI889uT8IOKcs7YE1kzFqzKFKbQZ23jGak2scAtF1EVj7SUeJ6rmj/LIsY4hglbzyJVZBlqpdqza+JqMA4ubdpeOYZYEMNIA0VfBHb+TbHY7rH28ZZt8Udk+oeql1pzd1pYyvfjZTfUmctymmz/0ZIG X-Forefront-PRVS: 016885DD9B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;MWHPR03MB2477;23:LSKHi5/QQPJ4B4N8+GUuN7U5GbwlDwerBY74gPILC?= =?us-ascii?Q?NunDUvjgD1aSMId1kBxPaBHFRT66EHqpn/bG78a7cyjm8QYRyN1V3CZz41DK?= =?us-ascii?Q?9lTssemuw4VMHSt9uYuNgJLCsWECu3aL6ngsH9jxXoknOZ4vEEO9+EMUcj2J?= =?us-ascii?Q?h+n8VuIzrX5PExcwamxroVAjX/zk/Fyl+y9MkFjGgFRneMGC2IvM6i5Mt/Pb?= =?us-ascii?Q?KOvmnitNLb/TvWshPGIuhdVKmzuu/qPnZPGAy3t35mL8i5Hpr2zXCUVGWaXp?= =?us-ascii?Q?qlZHbo5AvVqgnsCfTUS6qRVKERwKtmFR5HO47nGP3sGlszr8zTMNX4w/nbV6?= =?us-ascii?Q?A5yXejElO189YBd7KU7bS+RqKyLLzT4P6X8+2q4MMHPsTVW1Y5slnIg8IHUA?= =?us-ascii?Q?G7tmPJOw0EW/+nM8I2CreHvHOlZUuHNn3V71TnIVYc+dgNlOPUR2SUrqZPV8?= =?us-ascii?Q?vG2C2rCPqdbXqKg/X6qnlhiFBY+LBrJrfQekTftDmApszbrrYRg8uZw3xQ03?= =?us-ascii?Q?WPTFtXSszDe1gQgeKxgaq/uIEB6fn6jMFW/MHuzjC5abl+dFfiAf/cplYgi0?= =?us-ascii?Q?HhTF8mpNHMu1eiPmUUumYg7NVufjNmr81kKfWf141p3Br9ojZL840zRTQyo5?= =?us-ascii?Q?OLJyHM7gGp6aWTJVdZcpGIbs8EaVOteVzJwlnMNrPZWsMpzDlnL6vmqvJ2/t?= =?us-ascii?Q?Qw+mXll6GErO1dnjaNQtiscl8soeUo/uzhYeeruLtz4yM6n6/O2SLDDk+tTq?= =?us-ascii?Q?coAai0aXiKJP8grVovaeJL6Gf9elROpxJxm7D5vMMN3CLu9gBllMdGc/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+jiidZoPndYFcpzXXYfwyilFcI4nZmC17k5ubFvc5PtdpYd81vRzoLRH28FBgO2fZkyxpQSbOeC0ZdiVTbmZAx+KAzsvoHeJdXksplxQ+jpuMjrfaJsz9wLeQQNG+tnrG+GCPVfrf2jNxn5CcMfchN0JJJ1wbn32OSM5jeEDXw;24:4StTA7hVXdMHkt2M3DaEL11NT2mZwB/YZ7LPa4M00mPMG4tHef4/1rLyJROEL+x8rVkLpC8aiWQPsSseF5F6siCYW1RWwm/lP7c428OIs7E= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR03MB2477;7:Nugq6BJaQidRZ83wWs3Bz/BLnHNA11sby/woL/jorumqCyBt0sweTzBW/V33BqcjvD0YAOlJAkb8cza4d1nEEdElYDrx1lUowq9YjyZf/RfuW+3nwbC7OZyRgTO2toPFQPOOmzUTHGAHX2nuDiQKlPD9SR0QWwx8agoLjFEF2SneVoTPH7kUKAc0e50ujrmwAMugjBQHTqe4vsLzGLjn92oQzQ/xbPz9eLdxLS1IlLH3qVsZychNb8/noXakIpu0LaDu7QIcc1Fjm8mQZuAUEksjRsbOQ6rZh8EaLkdT/QLfHfgJmSR9QAy5DFRiXBpUi0SWifeFxVWyV8HNmrnokfBvO5cm/CqZc6KhCMvaxUMTmpIZBlJYubNN/NPzcijqiiz9GJohg3poD3s1fBfLcAnAi+wrwG1UvWipK0OjmwSUqhR1DFh3rvfuxHdljAj+L9cRTWZ+ksrVoSu8MOxC4Q== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2016 08:45:53.1644 (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: MWHPR03MB2477 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5362 Lines: 194 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 --- Changes for v2: - modify subject and commit msg - return 0 and add put node when return in qe_ic_init Changes for v3: - na Changes for v4: - na Changes for v5: - na Changes for v6: - rebase Changes for v6: - na drivers/irqchip/irq-qeic.c | 91 +++++++++++++++++++++++++--------------------- include/soc/fsl/qe/qe_ic.h | 7 ---- 2 files changed, 50 insertions(+), 48 deletions(-) diff --git a/drivers/irqchip/irq-qeic.c b/drivers/irqchip/irq-qeic.c index 1463731..4f49d4b 100644 --- a/drivers/irqchip/irq-qeic.c +++ b/drivers/irqchip/irq-qeic.c @@ -406,27 +406,38 @@ 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(unsigned int flags) { + struct device_node *node; struct qe_ic *qe_ic; struct resource res; - u32 temp = 0, ret, high_active = 0; + u32 temp = 0, high_active = 0; + int ret = 0; + + node = of_find_compatible_node(NULL, NULL, "fsl,qe-ic"); + if (!node) { + node = of_find_node_by_type(NULL, "qeic"); + 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)); @@ -437,9 +448,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 */ @@ -466,13 +477,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) @@ -579,39 +601,26 @@ static struct device device_qe_ic = { .bus = &qe_ic_subsys, }; -static int __init init_qe_ic_sysfs(void) +static int __init init_qe_ic(void) { - int rc; + int ret; - printk(KERN_DEBUG "Registering qe_ic with sysfs...\n"); + ret = qe_ic_init(0); + if (ret) + return ret; - rc = subsys_system_register(&qe_ic_subsys, NULL); - if (rc) { - printk(KERN_ERR "Failed registering qe_ic sys class\n"); + ret = subsys_system_register(&qe_ic_subsys, NULL); + if (ret) { + pr_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"); + ret = device_register(&device_qe_ic); + if (ret) { + pr_err("Failed registering qe_ic sys device\n"); return -ENODEV; } - return 0; -} - -static int __init qeic_of_init(void) -{ - struct device_node *np; - np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic"); - if (!np) { - np = of_find_node_by_type(NULL, "qeic"); - if (!np) - return; - } - qe_ic_init(np, 0, qe_ic_cascade_low_mpic, - qe_ic_cascade_high_mpic); - of_node_put(np); + return 0; } -subsys_initcall(qeic_of_init); -subsys_initcall(init_qe_ic_sysfs); +subsys_initcall(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