From patchwork Mon Jul 18 09:14:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9234253 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 652B3607FF for ; Mon, 18 Jul 2016 09:21:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 559C9263DC for ; Mon, 18 Jul 2016 09:21:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49B5726B4A; Mon, 18 Jul 2016 09:21:50 +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 D3108263DC for ; Mon, 18 Jul 2016 09:21:49 +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 1bP4ib-0004xR-I2; Mon, 18 Jul 2016 09:20:05 +0000 Received: from mail-pa0-x22e.google.com ([2607:f8b0:400e:c03::22e]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bP4e3-0000Z3-CN for linux-arm-kernel@lists.infradead.org; Mon, 18 Jul 2016 09:15:28 +0000 Received: by mail-pa0-x22e.google.com with SMTP id dx3so59097719pab.2 for ; Mon, 18 Jul 2016 02:15:05 -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=PbFhQbSg3r7MEyRz4ZVLLIoKjwWeBTJ+MFqHFFFNUyAAewTkz7ibzc2vQCio0zba6W rud8parspuCCALHa7G0GbDha8uuXIe6JDjc7SeT8bfb2643K2xnzKe9HQiCT4zWJMUrl Hb7CUkCrs6qOIWHkMZp8UoVYNy/d7H3P6mHfc= 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=UjoIXfhV04mja4STxOpdEjGuqv3gIgc/Fm+GsGoaZaNP21QitmQMhzx0edCBAS9fUi FarFSHlJA6vn9rTXKhjiV/kWQisI0AMVoynluqr9lseO7ZWPwGd0ScjkrGsCDm8pNLFg jekhq2xepGf9nUKxci7waaBfDIkrjMLUclpBA0ZdCcz6pD5tn9AKar4rpNjdeGljAPht 2kTIut5gHN8hXS4wgey1GzehTPGHHs1MQ+ulO6E3VnHAq7zR+5EWtHSQJjnpeR9ISa2b Fsn8Gm3VjHH913GW7XlIAGqQjW+o3rqCU2i2cT7OKUEykLZQzKpcGgJm+umDaxuPB7RR jRxA== X-Gm-Message-State: ALyK8tL8ZUML1SljkMjqxYptKUMiH/niT7nqFKexclloefqyg4SB7CGtXKx0ZLO1W74JxDf5 X-Received: by 10.66.148.7 with SMTP id to7mr1646460pab.128.1468833305044; Mon, 18 Jul 2016 02:15: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 z1sm2883269pab.19.2016.07.18.02.15.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jul 2016 02:15:04 -0700 (PDT) From: Anup Patel To: "Hans J. Koch" , Greg Kroah-Hartman , Jonathan Corbet Subject: [PATCH v2 6/8] uio: UIO_IRQ_NONE is a valid option for uioinfo->irq Date: Mon, 18 Jul 2016 14:44:18 +0530 Message-Id: <1468833260-5305-7-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1468833260-5305-1-git-send-email-anup.patel@broadcom.com> References: <1468833260-5305-1-git-send-email-anup.patel@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160718_021523_775402_CEFC58F2 X-CRM114-Status: GOOD ( 15.18 ) 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) {