From patchwork Mon Aug 6 15:12:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 143518 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3406650ljj; Mon, 6 Aug 2018 08:12:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdVlU6wk/6CZqoYxa2BmiBO8XqBQ8His17gLyc9cG9jrVOVzSQ/yvRiKSJIE5JqSqYVkC0k X-Received: by 2002:a17:902:b401:: with SMTP id x1-v6mr14268962plr.236.1533568351303; Mon, 06 Aug 2018 08:12:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533568351; cv=none; d=google.com; s=arc-20160816; b=tlC/MS8WMMqTr26phEIijivnXGrUFlh9XrNDifgPOj8YxprC9pDfB7jNFpgbcN6La4 HgCOQmSJ00PA3fsATUhKtIxl/NB+gaRuQFNtpayvDkfMcQ0X9SnoZYEd/2vfvJol/LJ4 RtG+yE8qJ4cKsfwfqnLSs4RypZ46hr761t6oacRrOQfvU9i1k+b0mWjVthuC/G/Ago0x fOwIcehrca0q3SBKXGhwouJ5f8gnJS+XmIhIIfGp9WAAJh9Cb5OQ72Sh+FYSgYvDXFVr /LBNKbwIMlPF/ksZJRE48V/anUyYTacMB8ZDUHYpwvVI/0djr4tEVtyzj4MMAHK7lIfG cBoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=hKof7J/fdmxQgmxggEw1RbYGynVsATnoSGGVOMU07qA=; b=yIe8gDbbDLc0erxpZLKPaRJ6V0FfDx8veMfWf0JrT0sLlQtqpH3kFDMzQFNApumT1c c5hhn8KVowYPZbCK3ytGuPyNT1JKDipJH7gb0QMQKAxwq5mDpC4aRaYcSUgqiMGXf5i+ +gRYhM0AbGvLU3PmqMO64XF2YewyjQO2ZEkyCxODMKfq2WBg619pMN0iTBeJWpHev7IL SbIhmbXTrfeR/t72ppEsoDX3Vvw5GI49o4kNFnWllb2kA5bumFGOD0L9Vrg1euzXZQDo 3R7Q/Fgb0ZAikUcvIp56OCU0tkPnX+v0vDFR9Xp+TQKOSc06f0ZuwEP4LgmNiTtpliX/ rTTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="iBw/Iapy"; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ce1-v6si10921223plb.391.2018.08.06.08.12.30; Mon, 06 Aug 2018 08:12:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="iBw/Iapy"; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730882AbeHFRWC (ORCPT + 5 others); Mon, 6 Aug 2018 13:22:02 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:56182 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727541AbeHFRWC (ORCPT ); Mon, 6 Aug 2018 13:22:02 -0400 Received: by mail-wm0-f66.google.com with SMTP id f21-v6so14187228wmc.5 for ; Mon, 06 Aug 2018 08:12:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=VtBk3vD++1QBFK6ZO9rw9D2wIYwiVNGsrz1B8jRW3AY=; b=iBw/IapyVAEFYjdBsNbgj55tb2Zi8V5MX7Hx3bz2z0R/FpRS8qaVnhCjEn3bAzHQnv vpHb+fstFA3dN7fhf9YfmXW+kncSAEIYYr5eTaGPYgoSuIfQ8Fikv51Jr85ftLg2lPkP e44C+bLV6e/ROhW8M7cvmVjEuoaYR6/Zr8ldU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=VtBk3vD++1QBFK6ZO9rw9D2wIYwiVNGsrz1B8jRW3AY=; b=cyuszyuRo8iEirLIGYAi7AMOQ7XNhd4uDOAWE54oEXmHTg9kpBcmfVDNzV1sDpGnjd /ujMQGFD/16hExUmWNPC6j/SsD3wzjvxqPrr3Tcjuh8hDXDRDWNnj+s965FVfyY5kSC+ x2MRfGc4MKqkO24tg+wf4rt4KfNOwreXojqFrA527RC+S4g0hFxvMuG4Kw98d92ltYaq L2fO2hiZ/eR5YuIrCWXnI+pHCpyWOZi5MLPmQoaMOMlv2RF8lFh3o76WRD5HEXlgU/P4 A4aszRWKBuGUql+WXA8Qsl7bul0wm9ZdpgqUkm1yZzz6Mc/MMpthvcCBKAPJTWPyol5f 6vSg== X-Gm-Message-State: AOUpUlH82oCvdRo2A8dWpEJDghvdHZDKQSFpazJRCL+0iaEn3eNmdP2l 39+xXfXI6rla5VWvjsnbt2Y+anv5REo= X-Received: by 2002:a1c:dc41:: with SMTP id t62-v6mr12313650wmg.42.1533568348191; Mon, 06 Aug 2018 08:12:28 -0700 (PDT) Received: from localhost.localdomain (catv-89-135-96-219.catv.broadband.hu. [89.135.96.219]) by smtp.gmail.com with ESMTPSA id v65-v6sm5608096wme.22.2018.08.06.08.12.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Aug 2018 08:12:27 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Linus Walleij , linux-snps-arc@lists.infradead.org, Christian Ruppert Subject: [PATCH 1/2] gpio: tb10x: Create local helper variables Date: Mon, 6 Aug 2018 17:12:24 +0200 Message-Id: <20180806151224.2338-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Create a local struct device *dev helper variable to make the code easier to read. Most GPIO drivers use "np" (node pointer) rather than "dn" (device node) to point to the device tree node. Let's follow this convention. Cc: linux-snps-arc@lists.infradead.org Cc: Christian Ruppert Signed-off-by: Linus Walleij --- drivers/gpio/gpio-tb10x.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) -- 2.17.0 -- 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 Acked-by: Christian Ruppert diff --git a/drivers/gpio/gpio-tb10x.c b/drivers/gpio/gpio-tb10x.c index a12cd0b5c972..422b0ac5a9de 100644 --- a/drivers/gpio/gpio-tb10x.c +++ b/drivers/gpio/gpio-tb10x.c @@ -169,29 +169,30 @@ static int tb10x_gpio_probe(struct platform_device *pdev) { struct tb10x_gpio *tb10x_gpio; struct resource *mem; - struct device_node *dn = pdev->dev.of_node; + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; int ret = -EBUSY; u32 ngpio; - if (!dn) + if (!np) return -EINVAL; - if (of_property_read_u32(dn, "abilis,ngpio", &ngpio)) + if (of_property_read_u32(np, "abilis,ngpio", &ngpio)) return -EINVAL; - tb10x_gpio = devm_kzalloc(&pdev->dev, sizeof(*tb10x_gpio), GFP_KERNEL); + tb10x_gpio = devm_kzalloc(dev, sizeof(*tb10x_gpio), GFP_KERNEL); if (tb10x_gpio == NULL) return -ENOMEM; spin_lock_init(&tb10x_gpio->spinlock); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - tb10x_gpio->base = devm_ioremap_resource(&pdev->dev, mem); + tb10x_gpio->base = devm_ioremap_resource(dev, mem); if (IS_ERR(tb10x_gpio->base)) return PTR_ERR(tb10x_gpio->base); - tb10x_gpio->gc.label = - devm_kasprintf(&pdev->dev, GFP_KERNEL, "%pOF", pdev->dev.of_node); + tb10x_gpio->gc.label = + devm_kasprintf(dev, GFP_KERNEL, "%pOF", pdev->dev.of_node); if (!tb10x_gpio->gc.label) return -ENOMEM; @@ -210,31 +211,31 @@ static int tb10x_gpio_probe(struct platform_device *pdev) ret = devm_gpiochip_add_data(&pdev->dev, &tb10x_gpio->gc, tb10x_gpio); if (ret < 0) { - dev_err(&pdev->dev, "Could not add gpiochip.\n"); + dev_err(dev, "Could not add gpiochip.\n"); return ret; } platform_set_drvdata(pdev, tb10x_gpio); - if (of_find_property(dn, "interrupt-controller", NULL)) { + if (of_find_property(np, "interrupt-controller", NULL)) { struct irq_chip_generic *gc; ret = platform_get_irq(pdev, 0); if (ret < 0) { - dev_err(&pdev->dev, "No interrupt specified.\n"); + dev_err(dev, "No interrupt specified.\n"); return ret; } tb10x_gpio->gc.to_irq = tb10x_gpio_to_irq; tb10x_gpio->irq = ret; - ret = devm_request_irq(&pdev->dev, ret, tb10x_gpio_irq_cascade, + ret = devm_request_irq(dev, ret, tb10x_gpio_irq_cascade, IRQF_TRIGGER_NONE | IRQF_SHARED, - dev_name(&pdev->dev), tb10x_gpio); + dev_name(dev), tb10x_gpio); if (ret != 0) return ret; - tb10x_gpio->domain = irq_domain_add_linear(dn, + tb10x_gpio->domain = irq_domain_add_linear(np, tb10x_gpio->gc.ngpio, &irq_generic_chip_ops, NULL); if (!tb10x_gpio->domain) {