From patchwork Fri Nov 16 05:46:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damian Hobson-Garcia X-Patchwork-Id: 1753071 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 8DC314005F for ; Fri, 16 Nov 2012 05:47:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751116Ab2KPFrF (ORCPT ); Fri, 16 Nov 2012 00:47:05 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:54825 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751477Ab2KPFrE (ORCPT ); Fri, 16 Nov 2012 00:47:04 -0500 Received: by mail-pa0-f46.google.com with SMTP id hz1so1622277pad.19 for ; Thu, 15 Nov 2012 21:47:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=aCl2Rjc9NOVX3PDT7yWFBnsbjTzs5/CpcnwBX6KyRRU=; b=Hc3k5emAaTTKw7FRh/jutmTe2hcrJBUrBzVkC0Lo0+ru8pXmjIYvVROf1Cpqpc1Rwb usJz4WBIqAjZwbW+CXFJ4gYeM/MyPJHUeVF4DERJgDcDuPQk+gQ0UAAWfhaGq/UrbM8q Eh1sVVAjKgQ7ZFrIAwnUI29yT9bjPn7CbBZ/q6/W4M+L0HYjiuEFR5/+Fqlsdg3y0y0r Gt8X08A/7X4yGsyNgQRq3GwSR+FgctF/eqcFMLlCDL6KVptWiGHGRac8myxfxvP9DRLe ePtd/LrPb2EDNWXKl91RPlWjuI/2JcFdriPh/kqO76BoJ9O95HuIzJ13XNl/eCWBNpRj FsSw== Received: by 10.66.78.67 with SMTP id z3mr9829820paw.33.1353044824127; Thu, 15 Nov 2012 21:47:04 -0800 (PST) Received: from localhost.localdomain ([219.106.231.132]) by mx.google.com with ESMTPS id j4sm484425pax.31.2012.11.15.21.47.01 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Nov 2012 21:47:03 -0800 (PST) From: Damian Hobson-Garcia To: hjk@hansjkoch.de, gregkh@linuxfoundation.org, magnus.damm@gmail.com, horms@verge.net.au Cc: linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org, Damian Hobson-Garcia Subject: [PATCH 2/4] drivers: uio_dmem_genirq: Don't use DMA_ERROR_CODE to indicate unmapped regions Date: Fri, 16 Nov 2012 14:46:10 +0900 Message-Id: <1353044772-18803-3-git-send-email-dhobsong@igel.co.jp> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1353044772-18803-1-git-send-email-dhobsong@igel.co.jp> References: <1353044772-18803-1-git-send-email-dhobsong@igel.co.jp> X-Gm-Message-State: ALoCoQk/OzIJThHCmlBE6IN1dtIeRWhr0nHp7nh3/8XInWZ8BNvE2IDftNwFq3U7vmySlPMxCUig Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org DMA_ERROR_CODE is not defined on all architectures and is architecture specific. Instead, use the constant, ~0 to indicate unmapped regions. Reported-by: Fengguang Wu Reported-by: Geert Uytterhoeven Signed-off-by: Damian Hobson-Garcia --- Documentation/DocBook/uio-howto.tmpl | 2 +- drivers/uio/uio_dmem_genirq.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl index fdbf86f..ddb05e9 100644 --- a/Documentation/DocBook/uio-howto.tmpl +++ b/Documentation/DocBook/uio-howto.tmpl @@ -771,7 +771,7 @@ framework to set up sysfs files for this region. Simply leave it alone. /sys/class/uio/uioX/maps/mapY/*. The dynmaic memory regions will be freed when the UIO device file is closed. When no processes are holding the device file open, the address - returned to userspace is DMA_ERROR_CODE. + returned to userspace is ~0. diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c index d8bbe07..7be8d04 100644 --- a/drivers/uio/uio_dmem_genirq.c +++ b/drivers/uio/uio_dmem_genirq.c @@ -29,6 +29,7 @@ #include #define DRIVER_NAME "uio_dmem_genirq" +#define DMEM_MAP_ERROR (~0) struct uio_dmem_genirq_platdata { struct uio_info *uioinfo; @@ -60,6 +61,7 @@ static int uio_dmem_genirq_open(struct uio_info *info, struct inode *inode) addr = dma_alloc_coherent(&priv->pdev->dev, uiomem->size, (dma_addr_t *)&uiomem->addr, GFP_KERNEL); if (!addr) { + uiomem->addr = DMEM_MAP_ERROR; ret = -ENOMEM; break; } @@ -95,7 +97,7 @@ static int uio_dmem_genirq_release(struct uio_info *info, struct inode *inode) dma_free_coherent(&priv->pdev->dev, uiomem->size, priv->dmem_region_vaddr[dmem_region++], uiomem->addr); - uiomem->addr = DMA_ERROR_CODE; + uiomem->addr = DMEM_MAP_ERROR; ++uiomem; } @@ -238,7 +240,7 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev) break; } uiomem->memtype = UIO_MEM_PHYS; - uiomem->addr = DMA_ERROR_CODE; + uiomem->addr = DMEM_MAP_ERROR; uiomem->size = pdata->dynamic_region_sizes[i]; ++uiomem; }