From patchwork Fri Jul 15 09:04:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9231407 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 1C02760865 for ; Fri, 15 Jul 2016 09:09:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0931B27B16 for ; Fri, 15 Jul 2016 09:09:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1F3428319; Fri, 15 Jul 2016 09:09:35 +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 75A5A27B16 for ; Fri, 15 Jul 2016 09:09:35 +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 1bNz6I-000537-RC; Fri, 15 Jul 2016 09:08:02 +0000 Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bNz3c-0001TC-7D for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2016 09:05:19 +0000 Received: by mail-pa0-x22d.google.com with SMTP id dx3so37839334pab.2 for ; Fri, 15 Jul 2016 02:04:55 -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=KhGaWNOBChbhN5L8nDllKl16/5X1FsYdzhdfLNlscWJrlHX8Gp4uehaxtYuD/guFOo sLnW0wMKM7bwfmf12qj/cFEUl03LHQjRxju1qLlZzXUJhWjRToul+zUFyQ2mmxDU0hDA Z9sBTybYRsWP8PJNC6z3k1AA5bhVHxHZVJs9o= 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=X5xFskuKX8lB1QnLTR34abr48g3XxcdVItxS2Q+b13+Vc2E2TWWcA+e7m1cZn8REJm xizb9UW4UBNNw4wXMZ47isEJ7yWdIqzpDoCmNufRgZSwlRYFlgDZghfxTgKiyp/v668C IbohwFx9ggO4q4bgDHmH4Kwl6bef+/Oqym2TX7gTuiJlKyU+Q2nrXMJ3HhKaimtyInFn OINfVjiPu54X6urhg54SJnUxcygk2rhWxNoRaGlKR+tGckDPR08ZXlkPWw9IEIPwOw/r 7cC4vNJ9xpr1wdq3rkXBr/DJ7hp2iDVDvnOpA3tSAIBOEMoN4Ddmg+TgpCgKT84cgUEY 9kvA== X-Gm-Message-State: ALyK8tIjaS58hNx9OTwssdbbZth8sCRwAEiqHvTCXt6xCzrEOmCqV6aIFmdeN61Jm1xn/79u X-Received: by 10.66.193.39 with SMTP id hl7mr29688999pac.10.1468573494881; Fri, 15 Jul 2016 02:04:54 -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 m78sm6811923pfj.66.2016.07.15.02.04.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Jul 2016 02:04:54 -0700 (PDT) From: Anup Patel To: "Hans J. Koch" , Greg Kroah-Hartman , Jonathan Corbet Subject: [PATCH 6/8] uio: UIO_IRQ_NONE is a valid option for uioinfo->irq Date: Fri, 15 Jul 2016 14:34:01 +0530 Message-Id: <1468573443-4670-7-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1468573443-4670-1-git-send-email-anup.patel@broadcom.com> References: <1468573443-4670-1-git-send-email-anup.patel@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160715_020516_484514_0FE57209 X-CRM114-Status: GOOD ( 14.07 ) 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: Scott Branden , linux-doc@vger.kernel.org, Ray Jui , 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) {