From patchwork Fri Jul 15 09:04:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9231403 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 CA02F60865 for ; Fri, 15 Jul 2016 09:07:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B784925E13 for ; Fri, 15 Jul 2016 09:07:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ABDD4280D0; Fri, 15 Jul 2016 09:07:42 +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 4AC3A25E13 for ; Fri, 15 Jul 2016 09:07:42 +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 1bNz4f-0003fk-BE; Fri, 15 Jul 2016 09:06:21 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bNz3Y-00022X-Ef for linux-arm-kernel@bombadil.infradead.org; Fri, 15 Jul 2016 09:05:12 +0000 Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]) by merlin.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bNz3W-000102-6a for linux-arm-kernel@lists.infradead.org; Fri, 15 Jul 2016 09:05:11 +0000 Received: by mail-pa0-x22d.google.com with SMTP id pp5so30946693pac.3 for ; Fri, 15 Jul 2016 02:04:49 -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=kvYPR++SO1nhIymUS1kP7HxIvMqLzVg/LgjX83aoVVc=; b=cWk6QR6gKUStAW7mijasl1lJGIC4kW7y5zZApJ//svV9s+UXmD5Brpbxdy7r8nLlgP nMWrEQslzYfHlVefTebnHtpirAbqHpjnjeMD7lHf7ZQ+VMWBDN5gYzF2Se6X9Q6UGINM uaSyHq9otec9yiC/FOHb3HMQ9CAxZ+mPYSOV8= 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=kvYPR++SO1nhIymUS1kP7HxIvMqLzVg/LgjX83aoVVc=; b=lpgHKGkILzcwnjtcO0lYuFqAQe6kHecOkaUWiusL8D1jx3uu/ANOotiRN+sbsRj0Ys GmeZQEcelpnyBAuwf31cD+OSBHw0bw3fKnHSX2QOUy/NA8xMAXl2D3eAto2DwnEqOEDC 5rFq9wm5/DhHQjdO/I9tOwaaIYCPkvINXkXmlbPnqOCTmB65ZyUf1Mjop5F3zvsyA/f5 wWDAEOagCdxIfpidQTxK0h5RaeHxzszFeFf93mH+T0J0p3e7scFCTPimWuZOx1Bd1Jlz xV6+dzuafcB5VbLI3H8S/8QpAL5+q62oP4OPQgwp8UCTxEloatfkXwjwqVjWpaTQ2mKj BhsA== X-Gm-Message-State: ALyK8tKnMYL5B0yuHJH8ueAvJkBVEDVtVvz3n2GLmd9MsHwk5BiIrjgYLcLCZqQnTEmWW+Jr X-Received: by 10.66.32.197 with SMTP id l5mr5085720pai.129.1468573488370; Fri, 15 Jul 2016 02:04:48 -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.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Jul 2016 02:04:47 -0700 (PDT) From: Anup Patel To: "Hans J. Koch" , Greg Kroah-Hartman , Jonathan Corbet Subject: [PATCH 5/8] uio: fix dmem_region_start computation Date: Fri, 15 Jul 2016 14:34:00 +0530 Message-Id: <1468573443-4670-6-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_050510_433423_98766BAA X-CRM114-Status: GOOD ( 12.41 ) 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 The variable i contains a total number of resources (including IORESOURCE_IRQ). However, we want the dmem_region_start to point after the last resource of type IORESOURCE_MEM. The original behaviour leads (very likely) to skipping several UIO mapping regions and makes them useless. Fix this by computing dmem_region_start from the uiomem which points to the last used UIO mapping. Fixes: 0a0c3b5a24bd ("Add new uio device for dynamic memory allocation") Signed-off-by: Jan Viktorin --- drivers/uio/uio_dmem_genirq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c index 915facb..e1134a4 100644 --- a/drivers/uio/uio_dmem_genirq.c +++ b/drivers/uio/uio_dmem_genirq.c @@ -229,7 +229,7 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev) ++uiomem; } - priv->dmem_region_start = i; + priv->dmem_region_start = uiomem - &uioinfo->mem[0]; priv->num_dmem_regions = pdata->num_dynamic_regions; for (i = 0; i < pdata->num_dynamic_regions; ++i) {