From patchwork Mon Aug 8 05:52:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9266693 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 033E260839 for ; Mon, 8 Aug 2016 05:56:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E668F26E69 for ; Mon, 8 Aug 2016 05:56:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D95E027813; Mon, 8 Aug 2016 05:56:51 +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=ham 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 53D7226E69 for ; Mon, 8 Aug 2016 05:56:51 +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 1bWdWz-0002EQ-KK; Mon, 08 Aug 2016 05:55:21 +0000 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bWdW7-0000oY-1R for linux-arm-kernel@lists.infradead.org; Mon, 08 Aug 2016 05:54:30 +0000 Received: by mail-pa0-x235.google.com with SMTP id ti13so32202710pac.0 for ; Sun, 07 Aug 2016 22:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kQj+04I+m5/c3LhVdRGC4KS2oVhU4M7Ma71oP/thj9M=; b=SpsL0XfWk2ZsyGUwHPI97HRrd2ejVi6FhJAAg8DtEhOPzMsrVomYrOJRVpW6F9/iEp UOAzcj9cBQcezipzUJVhcHU92NugD6YfJkodjWt/KJKuMtNBWLUhPXSpZcRO6EWM71ry saYLPyxs3UttausJyH7OuddmLrCN5OUQCN/9c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kQj+04I+m5/c3LhVdRGC4KS2oVhU4M7Ma71oP/thj9M=; b=LUvXVkPUsHisXbRhvnkC13FIdPgin5jTUAFzXcPsMMRezeuzzf5emXAOZvXR/z154J WruDh10dWKS5/lM6MCVSMS0eekxUq7ABAQcsau0CPn7jyk9X2ea/2u+2SDCygf/85ec2 BwV8XcYf2zXwLlmzbz+L1IjcTupjtMABxkfJboK5jwJ4+fpmoPrQIrQXcjmPfY5LfV0z PuaO8tEkB3OcZFiN1IHtWmO/mEq19gYv7672U8ULX8XyzIeVmmMgV2RQdk5GvixI2qwC zgHSlt7AhirmMQTlaZVBhqL7MxKOtStgHuJroY728iFZ+J6PoJBhhHuKHtyyIRZmecic /HJg== X-Gm-Message-State: AEkoouvmB549MuH4ahpi0SsW9GFvyEJhAVhcYMcodG4csRL5TBM2gRTHiXDPx54zGQWeJhx6 X-Received: by 10.66.88.161 with SMTP id bh1mr103139618pab.133.1470635645743; Sun, 07 Aug 2016 22:54:05 -0700 (PDT) Received: from anup-HP-Compaq-8100-Elite-CMT-PC.ban.broadcom.com ([202.140.56.34]) by smtp.gmail.com with ESMTPSA id u72sm44404402pfa.31.2016.08.07.22.53.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 07 Aug 2016 22:54:05 -0700 (PDT) From: Anup Patel To: Greg Kroah-Hartman , Jonathan Corbet Subject: [PATCH RESEND v2 6/8] uio: UIO_IRQ_NONE is a valid option for uioinfo->irq Date: Mon, 8 Aug 2016 11:22:35 +0530 Message-Id: <1470635557-13416-7-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1470635557-13416-1-git-send-email-anup.patel@broadcom.com> References: <1470635557-13416-1-git-send-email-anup.patel@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160807_225427_322474_673C97B2 X-CRM114-Status: GOOD ( 15.11 ) 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: Mark Rutland , devicetree@vger.kernel.org, Scott Branden , linux-doc@vger.kernel.org, Ray Jui , Russell King - ARM Linux , linux-kernel@vger.kernel.org, Rob Herring , bcm-kernel-feedback-list@broadcom.com, Ankit Jindal , linux-arm-kernel@lists.infradead.org, Jan Viktorin 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: Jan Viktorin We can simplify handling of platform_get_irq into one place as it is acceptable to see UIO_IRQ_NONE instead of a valid IRQ number. Some devices don't have or don't need any interrupt to be handled. The same change has been already done for uio_pdrv_genirq. Signed-off-by: Jan Viktorin --- drivers/uio/uio_dmem_genirq.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c index e1134a4..a4d6d81 100644 --- a/drivers/uio/uio_dmem_genirq.c +++ b/drivers/uio/uio_dmem_genirq.c @@ -154,8 +154,6 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev) int i; if (pdev->dev.of_node) { - int irq; - /* alloc uioinfo for one device */ uioinfo = kzalloc(sizeof(*uioinfo), GFP_KERNEL); if (!uioinfo) { @@ -165,13 +163,6 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev) } uioinfo->name = pdev->dev.of_node->name; uioinfo->version = "devicetree"; - - /* Multiple IRQs are not supported */ - irq = platform_get_irq(pdev, 0); - if (irq == -ENXIO) - uioinfo->irq = UIO_IRQ_NONE; - else - uioinfo->irq = irq; } if (!uioinfo || !uioinfo->name || !uioinfo->version) { @@ -200,14 +191,18 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev) priv->pdev = pdev; mutex_init(&priv->alloc_lock); + /* Multiple IRQs are not supported */ if (!uioinfo->irq) { ret = platform_get_irq(pdev, 0); - if (ret < 0) { + uioinfo->irq = ret; + if (ret == -ENXIO && pdev->dev.of_node) + uioinfo->irq = UIO_IRQ_NONE; + else if (ret < 0) { dev_err(&pdev->dev, "failed to get IRQ\n"); goto bad1; } - uioinfo->irq = ret; } + uiomem = &uioinfo->mem[0]; for (i = 0; i < pdev->num_resources; ++i) {