From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934523AbcIFPUm (ORCPT ); Tue, 6 Sep 2016 11:20:42 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:59771 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932180AbcIFPUl (ORCPT ); Tue, 6 Sep 2016 11:20:41 -0400 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: Russell King - ARM Linux , linux-kernel@vger.kernel.org Subject: [PATCH v2] ARM: common/locomo: remove NO_IRQ check Date: Tue, 06 Sep 2016 17:20:47 +0200 Message-ID: <4429009.oMpylzDcbd@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-34-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <4485846.n2NSoAbukL@wuerfel> References: <20160906135637.2622666-1-arnd@arndb.de> <20160906142144.GX1041@n2100.armlinux.org.uk> <4485846.n2NSoAbukL@wuerfel> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:bGKlwuwUvORyeuowDdlZqmfVH7zKajSNla0MIp2z4VpD8n1Fqmv 8LFUUCXB80pZL4uaeMZpXdZfiZ9NmMstFYpJbNUM8VDScmY5mWueqp5/dRwam3uyBUcISZG xS60MvmjGZmS0DFAU3ipTrG6fmR1qMG5HC2/MlYIcoo7C9WLfQ1HDxO2jUX7tCUXfMajs6o 54ikDRN8YcY8IY86DgFdA== X-UI-Out-Filterresults: notjunk:1;V01:K0:3SqPpQoyeDk=:oZYf0uF9YLfSXiXiiKhaz/ 7qWz0148aDqJRFuZ6vqyxVa5paa7twuDWQMBZ5XfLxA6fDby4FXkCjQMTLk6DTTYah149jMxo gUQ0iXwYzHwbJ5icUZWWEaMBNfMLLvQcfFIzL/D2/GxCRd/dW340sraW7B21HJ1Sqp9iq4P6m aaFKajpsDDfsTEPcH2HPPsFrra+Xrg2ZtZBQJhcSHFHBEADtTFeZwt69VsRgC+BvPF1WIunp0 dMQqrSWPVxGb4FQkgQkP3y5Va8rcYZK5lUTTikYUYp/nIbYnXAwKP6ZM8Ijy77a52UsnRUiXI fGoZ6A0WH/OtVVhrdhbOndvaB9QaKRmFOfeQNeTVfmcdnd/HwaqFAjJRm50854xe69r7SLSTA z6xNOU4oBFnschL+CqDb4CUOSmlRPs211hO75F/Dd7UWgHGXK+VAC8U4sykpMFBShso+s1Yjl o1OOTiEqG1MoKwMuGE4UXLItizh+oFSARJo8s2eh46HUpNgrwZh3B7ANORp2TdtM+V4DGm4rz JVBORwt4Mfr/md7NiaQpP8ZsUotLOCbNPAEt9xj1wdkoW14Biux3cnb/y5IbreaS0QaW8zjOn KuA5ZFm1P+xS6t5r41jigj5bOPNhZZdli+64pTVHZwWLjkRXK9c64QzbB3svoL5ERCt7GGXgM EZG38aOIzwPpfeYYw2tGXg8QlXln+VW7dvzjHxLzJNAxJcSTIfqFTEAm3r/89lYXwOv6UOJvI AwefDdhHprqhmHOd Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The locomo driver uses two irq numbers, its own IRQ as passed in the platform resources, and the base number for the interupts of its child devices, passed in platform_data. Since commit 489447380a29 ("[PATCH] handle errors returned by platform_get_irq*()") ten years ago, the locomo driver refuses to work without an interrupt line passed in its resources, so the check comparing lchip->irq to NO_IRQ is unnecessary. We still check the irq_base provided in the platform_data for NO_IRQ, but as both platforms that use locomo (poodle and collie) provide an irq_base, this can be done more consistently by just checking that both are valid in the probe function and otherwise returning an error. Signed-off-by: Arnd Bergmann --- v2: add back NULL pointer check, clarify changelog diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c index 0e97b4b871f9..38ca2db0cf12 100644 --- a/arch/arm/common/locomo.c +++ b/arch/arm/common/locomo.c @@ -253,8 +253,7 @@ locomo_init_one_child(struct locomo *lchip, struct locomo_dev_info *info) dev->mapbase = 0; dev->length = info->length; - dev->irq[0] = (lchip->irq_base == NO_IRQ) ? - NO_IRQ : lchip->irq_base + info->irq[0]; + dev->irq[0] = lchip->irq_base + info->irq[0]; ret = device_register(&dev->dev); if (ret) { @@ -376,6 +375,9 @@ __locomo_probe(struct device *me, struct resource *mem, int irq) unsigned long r; int i, ret = -ENODEV; + if (!pdata || !pdata->irq_base) + return ret; + lchip = kzalloc(sizeof(struct locomo), GFP_KERNEL); if (!lchip) return -ENOMEM; @@ -387,7 +389,7 @@ __locomo_probe(struct device *me, struct resource *mem, int irq) lchip->phys = mem->start; lchip->irq = irq; - lchip->irq_base = (pdata) ? pdata->irq_base : NO_IRQ; + lchip->irq_base = pdata->irq_base; /* * Map the whole region. This also maps the @@ -454,8 +456,7 @@ __locomo_probe(struct device *me, struct resource *mem, int irq) * The interrupt controller must be initialised before any * other device to ensure that the interrupts are available. */ - if (lchip->irq != NO_IRQ && lchip->irq_base != NO_IRQ) - locomo_setup_irq(lchip); + locomo_setup_irq(lchip); for (i = 0; i < ARRAY_SIZE(locomo_devices); i++) locomo_init_one_child(lchip, &locomo_devices[i]); @@ -476,9 +477,7 @@ static void __locomo_remove(struct locomo *lchip) { device_for_each_child(lchip->dev, NULL, locomo_remove_child); - if (lchip->irq != NO_IRQ) { - irq_set_chained_handler_and_data(lchip->irq, NULL, NULL); - } + irq_set_chained_handler_and_data(lchip->irq, NULL, NULL); iounmap(lchip->base); kfree(lchip);