From nobody Fri Sep 12 00:13:49 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FA12C6379F for ; Wed, 15 Feb 2023 13:42:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229914AbjBONmY (ORCPT ); Wed, 15 Feb 2023 08:42:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229882AbjBONmM (ORCPT ); Wed, 15 Feb 2023 08:42:12 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD82434C37; Wed, 15 Feb 2023 05:42:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676468530; x=1708004530; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=72poG9BNyJWgNcO4lHVwaSx+WheBWsmEuGzRhm0Pokw=; b=kfilNg2aA4iWyMBK/GdaraISK50PkTKLeSlFr+5VbO01wsADhUPE+FVp v2cNYQhxXgkV+ViMvIWlswKvU0p2V4Es0MnFlnSeZqzkaP/5j6w7C3F5/ I6cFVl1CeiJ1X9J5kWmCtgfysuRgt5jgP01ASgRT5AGBQyoBWvRJNqBAA rdpP77PDRz/XGZYZPOqOrp9UDuIbW+q6ntDPyAFuscEIQGzDNqMP+gQkC bdxvfxoOIeouUbSnUmaeJTIThFiHso2EW51Ca8tVTBSHFRB1HO/joB/fn 4TO/NPtwXyrkBOiZpONELlnf7wOl742zcZg4MyhTR63DviFnVv2We7u6z Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10621"; a="332734641" X-IronPort-AV: E=Sophos;i="5.97,299,1669104000"; d="scan'208";a="332734641" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2023 05:42:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10621"; a="812450051" X-IronPort-AV: E=Sophos;i="5.97,299,1669104000"; d="scan'208";a="812450051" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 15 Feb 2023 05:42:07 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6F212269; Wed, 15 Feb 2023 15:42:44 +0200 (EET) From: Andy Shevchenko To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ludovic Desroches , Linus Walleij , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Andy Shevchenko Subject: [PATCH v3 5/5] pinctrl: at91: Utilise temporary variable for struct device Date: Wed, 15 Feb 2023 15:42:42 +0200 Message-Id: <20230215134242.37618-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230215134242.37618-1-andriy.shevchenko@linux.intel.com> References: <20230215134242.37618-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" We have a temporary variable to keep pointer to struct device. Utilise it inside the ->probe() implementation. Signed-off-by: Andy Shevchenko Reviewed-by: Claudiu Beznea --- drivers/pinctrl/pinctrl-at91.c | 60 +++++++++++++++------------------- 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index 08f88403affb..de48a8e0f85f 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -1304,7 +1304,7 @@ static int at91_pinctrl_probe_dt(struct platform_devi= ce *pdev, if (!np) return -ENODEV; =20 - info->dev =3D &pdev->dev; + info->dev =3D dev; info->ops =3D of_device_get_match_data(dev); at91_pinctrl_child_count(info, np); =20 @@ -1324,35 +1324,31 @@ static int at91_pinctrl_probe_dt(struct platform_de= vice *pdev, if (ret) return ret; =20 - dev_dbg(&pdev->dev, "nmux =3D %d\n", info->nmux); + dev_dbg(dev, "nmux =3D %d\n", info->nmux); =20 - dev_dbg(&pdev->dev, "mux-mask\n"); + dev_dbg(dev, "mux-mask\n"); tmp =3D info->mux_mask; for (i =3D 0; i < gpio_banks; i++) { for (j =3D 0; j < info->nmux; j++, tmp++) { - dev_dbg(&pdev->dev, "%d:%d\t0x%x\n", i, j, tmp[0]); + dev_dbg(dev, "%d:%d\t0x%x\n", i, j, tmp[0]); } } =20 - dev_dbg(&pdev->dev, "nfunctions =3D %d\n", info->nfunctions); - dev_dbg(&pdev->dev, "ngroups =3D %d\n", info->ngroups); - info->functions =3D devm_kcalloc(&pdev->dev, - info->nfunctions, - sizeof(struct at91_pmx_func), - GFP_KERNEL); + dev_dbg(dev, "nfunctions =3D %d\n", info->nfunctions); + dev_dbg(dev, "ngroups =3D %d\n", info->ngroups); + info->functions =3D devm_kcalloc(dev, info->nfunctions, sizeof(*info->fun= ctions), + GFP_KERNEL); if (!info->functions) return -ENOMEM; =20 - info->groups =3D devm_kcalloc(&pdev->dev, - info->ngroups, - sizeof(struct at91_pin_group), - GFP_KERNEL); + info->groups =3D devm_kcalloc(dev, info->ngroups, sizeof(*info->groups), + GFP_KERNEL); if (!info->groups) return -ENOMEM; =20 - dev_dbg(&pdev->dev, "nbanks =3D %d\n", gpio_banks); - dev_dbg(&pdev->dev, "nfunctions =3D %d\n", info->nfunctions); - dev_dbg(&pdev->dev, "ngroups =3D %d\n", info->ngroups); + dev_dbg(dev, "nbanks =3D %d\n", gpio_banks); + dev_dbg(dev, "nfunctions =3D %d\n", info->nfunctions); + dev_dbg(dev, "ngroups =3D %d\n", info->ngroups); =20 i =3D 0; =20 @@ -1376,7 +1372,7 @@ static int at91_pinctrl_probe(struct platform_device = *pdev) struct pinctrl_pin_desc *pdesc; int ret, i, j, k; =20 - info =3D devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); + info =3D devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); if (!info) return -ENOMEM; =20 @@ -1384,13 +1380,10 @@ static int at91_pinctrl_probe(struct platform_devic= e *pdev) if (ret) return ret; =20 - at91_pinctrl_desc.name =3D dev_name(&pdev->dev); + at91_pinctrl_desc.name =3D dev_name(dev); at91_pinctrl_desc.npins =3D gpio_banks * MAX_NB_GPIO_PER_BANK; at91_pinctrl_desc.pins =3D pdesc =3D - devm_kcalloc(&pdev->dev, - at91_pinctrl_desc.npins, sizeof(*pdesc), - GFP_KERNEL); - + devm_kcalloc(dev, at91_pinctrl_desc.npins, sizeof(*pdesc), GFP_KERNEL); if (!at91_pinctrl_desc.pins) return -ENOMEM; =20 @@ -1413,8 +1406,7 @@ static int at91_pinctrl_probe(struct platform_device = *pdev) } =20 platform_set_drvdata(pdev, info); - info->pctl =3D devm_pinctrl_register(&pdev->dev, &at91_pinctrl_desc, - info); + info->pctl =3D devm_pinctrl_register(dev, &at91_pinctrl_desc, info); if (IS_ERR(info->pctl)) return dev_err_probe(dev, PTR_ERR(info->pctl), "could not register AT91 = pinctrl driver\n"); =20 @@ -1423,7 +1415,7 @@ static int at91_pinctrl_probe(struct platform_device = *pdev) if (gpio_chips[i]) pinctrl_add_gpio_range(info->pctl, &gpio_chips[i]->range); =20 - dev_info(&pdev->dev, "initialized AT91 pinctrl driver\n"); + dev_info(dev, "initialized AT91 pinctrl driver\n"); =20 return 0; } @@ -1714,6 +1706,7 @@ static void gpio_irq_handler(struct irq_desc *desc) static int at91_gpio_of_irq_setup(struct platform_device *pdev, struct at91_gpio_chip *at91_gpio) { + struct device *dev =3D &pdev->dev; struct gpio_chip *gpiochip_prev =3D NULL; struct at91_gpio_chip *prev =3D NULL; struct irq_data *d =3D irq_get_irq_data(at91_gpio->pioc_virq); @@ -1721,8 +1714,7 @@ static int at91_gpio_of_irq_setup(struct platform_dev= ice *pdev, struct gpio_irq_chip *girq; int i; =20 - gpio_irqchip =3D devm_kzalloc(&pdev->dev, sizeof(*gpio_irqchip), - GFP_KERNEL); + gpio_irqchip =3D devm_kzalloc(dev, sizeof(*gpio_irqchip), GFP_KERNEL); if (!gpio_irqchip) return -ENOMEM; =20 @@ -1758,7 +1750,7 @@ static int at91_gpio_of_irq_setup(struct platform_dev= ice *pdev, if (!gpiochip_prev) { girq->parent_handler =3D gpio_irq_handler; girq->num_parents =3D 1; - girq->parents =3D devm_kcalloc(&pdev->dev, 1, + girq->parents =3D devm_kcalloc(dev, girq->num_parents, sizeof(*girq->parents), GFP_KERNEL); if (!girq->parents) @@ -1824,7 +1816,7 @@ static int at91_gpio_probe(struct platform_device *pd= ev) if (irq < 0) return irq; =20 - at91_chip =3D devm_kzalloc(&pdev->dev, sizeof(*at91_chip), GFP_KERNEL); + at91_chip =3D devm_kzalloc(dev, sizeof(*at91_chip), GFP_KERNEL); if (!at91_chip) return -ENOMEM; =20 @@ -1836,7 +1828,7 @@ static int at91_gpio_probe(struct platform_device *pd= ev) at91_chip->pioc_virq =3D irq; at91_chip->pioc_idx =3D alias_idx; =20 - at91_chip->clock =3D devm_clk_get_enabled(&pdev->dev, NULL); + at91_chip->clock =3D devm_clk_get_enabled(dev, NULL); if (IS_ERR(at91_chip->clock)) return dev_err_probe(dev, PTR_ERR(at91_chip->clock), "failed to get cloc= k, ignoring.\n"); =20 @@ -1844,8 +1836,8 @@ static int at91_gpio_probe(struct platform_device *pd= ev) at91_chip->id =3D alias_idx; =20 chip =3D &at91_chip->chip; - chip->label =3D dev_name(&pdev->dev); - chip->parent =3D &pdev->dev; + chip->label =3D dev_name(dev); + chip->parent =3D dev; chip->owner =3D THIS_MODULE; chip->base =3D alias_idx * MAX_NB_GPIO_PER_BANK; =20 @@ -1886,7 +1878,7 @@ static int at91_gpio_probe(struct platform_device *pd= ev) platform_set_drvdata(pdev, at91_chip); gpio_banks =3D max(gpio_banks, alias_idx + 1); =20 - dev_info(&pdev->dev, "at address %p\n", at91_chip->regbase); + dev_info(dev, "at address %p\n", at91_chip->regbase); =20 return 0; } --=20 2.39.1