From patchwork Thu Oct 12 21:08:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 825102 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="0tZNCPaA"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yCk3F52nFz9s82 for ; Fri, 13 Oct 2017 08:08:25 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751876AbdJLVIY (ORCPT ); Thu, 12 Oct 2017 17:08:24 -0400 Received: from mail-lf0-f41.google.com ([209.85.215.41]:45288 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751541AbdJLVIY (ORCPT ); Thu, 12 Oct 2017 17:08:24 -0400 Received: by mail-lf0-f41.google.com with SMTP id n69so7365176lfn.2 for ; Thu, 12 Oct 2017 14:08:23 -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=0tZNCPaA+IjhAsF/TdGSewTXuBH50yydT27+wkLZwdnM8zifHmuzQ4M1f4kzzZnTCB jDeuDi/KsBY1m9b8Ul61uzQoezgMKi2kq3fGc5ieG0Fpu2Q4VwAcLPn2IIbd44WyRTHo 1so+qpjdm4zAIK2G08XJM4ro/l5njk1xz7Af8sDa4QSWrK0j33WdCqiNBZzTMn5lyEHa GCx2wfsClPX97wJGjVWOxzzliX+yibgrWiSE1G87hvzXzU/jBAkzU/UlTcUNoPEVSX1G 0m0MMCnCJrGugG4wLyOR8ux7fY7ZMKbLcrBlXYEEtKb1SBcwu96ikSrP1Ugo2Iuz3ZyN +QxA== 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=MIiKWXtYM+zWk1oDFE5auytNR10mMJ6M0vI92K6o4IoTl3WSNo1xkxH55EfGffZt08 dHlvIPBLP3tqzy06PFrIxeYxQRoUH5QM/tRMGw3DFDsJypPIt4lfTufvlIOxfw0H5u8n /O9RcTrj3EyLMyGudSjecdVk1/6ryFCiT1WCZOVG9DPALgqsGIVzWeIWfydYuinWrn/f ag7L/d90oSNRL6834GBrWtHE+sCrdpBPu5h0clGK9owqOJMMM7Slcc4is5vo06ttbjI7 L8hEG1ebBj0gOrtjE7pVehOtn+PVcTFka1w1cmv5NCctQS0riNKPfjoVzjoNR11RN5OX oVvA== X-Gm-Message-State: AMCzsaXSSsdQCZ1py2exDDoD1e9NXbLViTjSaHoIO3IXuX9nq9g2EgvN qRTMjF3rrzxTYnyz9ZilqUiFEw== X-Google-Smtp-Source: AOwi7QB1rahvLQ/NCjXUqu2zWJHFO9Ros2+o49ZPM+D4B7m+8l80UKU8Hs2LRPQdn4CXadcmSvhedg== X-Received: by 10.46.80.83 with SMTP id v19mr595932ljd.101.1507842502559; Thu, 12 Oct 2017 14:08:22 -0700 (PDT) Received: from wasted.cogentembedded.com ([31.173.83.169]) by smtp.gmail.com with ESMTPSA id y26sm1215006lfk.46.2017.10.12.14.08.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Oct 2017 14:08:21 -0700 (PDT) From: Sergei Shtylyov X-Google-Original-From: "Sergei Shtylyov" Received: by wasted.cogentembedded.com (sSMTP sendmail emulation); Fri, 13 Oct 2017 00:08:18 +0300 Message-Id: <20171012210818.806395567@cogentembedded.com> User-Agent: quilt/0.64 Date: Fri, 13 Oct 2017 00:08:14 +0300 To: Linus Walleij , linux-gpio@vger.kernel.org Cc: Geert Uytterhoeven , linux-renesas-soc@vger.kernel.org, Sergei Shtylyov Subject: [PATCH 1/1] 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 --- 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; }