From patchwork Thu Oct 12 20:15:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 825074 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=cogentembedded-com.20150623.gappssmtp.com header.i=@cogentembedded-com.20150623.gappssmtp.com header.b="N9UtGxIi"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yChtS08H1z9rxm for ; Fri, 13 Oct 2017 07:15:44 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753016AbdJLUPm (ORCPT ); Thu, 12 Oct 2017 16:15:42 -0400 Received: from mail-lf0-f45.google.com ([209.85.215.45]:56166 "EHLO mail-lf0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752452AbdJLUPl (ORCPT ); Thu, 12 Oct 2017 16:15:41 -0400 Received: by mail-lf0-f45.google.com with SMTP id p184so7230190lfe.12 for ; Thu, 12 Oct 2017 13:15:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:user-agent:date:to:cc:subject:mime-version :content-disposition; bh=MKj1wodAx/kEuovPmDXPfiyT+nOJx4Xn2pbdn1AekBU=; b=N9UtGxIihUdXUj/GuSFyA5Mp8r4gc0XwTM5XSg9gpJr0887sKlq17tb98k1z5rhSei wcwJl6X+qqan1L5TPdCqbcXD9I0ipvh1zDSADONSDTsudaBvP2hlsjpSyVxYGqx40n4a lWR5TjwucNv6g38syU0ZqN65SmWzPqWNH4IR0BCfbD295nzuWM89wj6Boy3zVQPy0O1t E/nVuqgl19TCc6lJeaJ9aj7eXlQrushmMDdv6peR6qQVEW15AVU1LJ1hsoBpKK54+EAc 481maxM/HYkgTjOsR6G8lvHMoUPCHx6hfPC6l1HShvXlcIA6jUuuSM1iRrzxZLkljhFi k/vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:user-agent:date:to:cc:subject :mime-version:content-disposition; bh=MKj1wodAx/kEuovPmDXPfiyT+nOJx4Xn2pbdn1AekBU=; b=iOzA47mjctWJTqOc695Xf6XnznmRlbGEliB/ag/6xp1AqTVp+37nRwi7fx2hY5xQkR ZUtYhJ40RnlhuY1x4vV799qEV4TYhZXI8KPmcWu3F/VC5FigUPcteA3PJRb1owkjGoA3 j4ydKRiIIJtzIrOqbmjZa9zZyDZEU7C/674OtvAfpzVTWByo3rV/yAFBmda1r9CiSyMj HZhKX+RXfE00cPmwY1w51TJ4MfUrdPpcuUkdijVfHWUjXpjhEhUHEbqEfpFmTtOrLRWu LlKQuZPuEX4Fptrdw5CdLiz5jHXRu7iebQ/2Qka50ycp+yi1IZo5QwF+szxeWzjiD7rY JMfw== X-Gm-Message-State: AMCzsaXlHc+gujtZm0sFXevVXvfiM66kE3jtqe204mcEdnArpzQMYCKX WIzs1YAG6eiVj6HSzm37EkEiqg== X-Google-Smtp-Source: ABhQp+RjkJGnpyHjQMES57arpIWzQX+mhQtRZhBsEp3fDTJd6R4/VXgsyW9X+QSnfE49EhXplHXv+Q== X-Received: by 10.25.17.21 with SMTP id g21mr1126818lfi.170.1507839340552; Thu, 12 Oct 2017 13:15:40 -0700 (PDT) Received: from wasted.cogentembedded.com ([31.173.83.169]) by smtp.gmail.com with ESMTPSA id b15sm2845850lfl.88.2017.10.12.13.15.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Oct 2017 13:15:39 -0700 (PDT) From: Sergei Shtylyov X-Google-Original-From: "Sergei Shtylyov" Received: by wasted.cogentembedded.com (sSMTP sendmail emulation); Thu, 12 Oct 2017 23:15:37 +0300 Message-Id: <20171012201537.102610518@cogentembedded.com> User-Agent: quilt/0.64 Date: Thu, 12 Oct 2017 23:15:30 +0300 To: Linus Walleij , linux-gpio@vger.kernel.org Cc: Geert Uytterhoeven , linux-renesas-soc@vger.kernel.org, Sergei Shtylyov Subject: [PATCH] gpio-rcar: use devm_ioremap_resource() MIME-Version: 1.0 Content-Disposition: inline; filename=gpio-rcar-use-devm_ioremap_resource.patch Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Using devm_ioremap_resource() has several advantages over devm_ioremap(): - it checks the passed resource's validity; - it calls devm_request_mem_region() to check for the resource overlap; - it prints an error message in case of error. We can call devm_ioremap_resource() instead of devm_ioremap_nocache() as ioremap() and ioremap_nocache() are implemented identically on ARM. Doing this saves 2 LoCs and 80 bytes (AArch64 gcc 4.8.5). Signed-off-by: Sergei Shtylyov Reviewed-by: Geert Uytterhoeven --- The patch is against the 'devel' branch of Linus Walleij's 'linux-gpio.git' repo. drivers/gpio/gpio-rcar.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-gpio/drivers/gpio/gpio-rcar.c =================================================================== --- linux-gpio.orig/drivers/gpio/gpio-rcar.c +++ linux-gpio/drivers/gpio/gpio-rcar.c @@ -452,19 +452,17 @@ static int gpio_rcar_probe(struct platfo pm_runtime_enable(dev); - io = platform_get_resource(pdev, IORESOURCE_MEM, 0); irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - - if (!io || !irq) { - dev_err(dev, "missing IRQ or IOMEM\n"); + if (!irq) { + dev_err(dev, "missing IRQ\n"); ret = -EINVAL; goto err0; } - p->base = devm_ioremap_nocache(dev, io->start, resource_size(io)); - if (!p->base) { - dev_err(dev, "failed to remap I/O memory\n"); - ret = -ENXIO; + io = platform_get_resource(pdev, IORESOURCE_MEM, 0); + p->base = devm_ioremap_resource(dev, io); + if (IS_ERR(p->base)) { + ret = PTR_ERR(p->base); goto err0; }