From nobody Fri Sep 12 00:13:50 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 ACBCDC64EC7 for ; Wed, 15 Feb 2023 13:42:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229619AbjBONmL (ORCPT ); Wed, 15 Feb 2023 08:42:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbjBONmJ (ORCPT ); Wed, 15 Feb 2023 08:42:09 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 748E7305F5; Wed, 15 Feb 2023 05:42:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676468527; x=1708004527; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gMKeJvWpmtoiaMn2I8gXdst5FiDonPYpqv3saTRG0Wc=; b=lo1xfOfqhB7+H4w8eTjdAbJkrPjHbrXTiwSFZCRD3EUOB8h34nWyq+Zf PLSToa9Iy9n0ANMEcvpkDQr0Mqsmw5u4AnXWSiziqRXj8bBeizMnZFLZ1 aDtodphbNDIftNQdqPTEUubIPzHfoWoEpP6FwEEIx6aU7MEsOR4IJkJ9c zoqf03BEtLhHOkN9lVJNs4VbjXCkKrfpHNYIm+NEi1d1vOtWnuWGMHC/o lq0LJV9QBwDhinK0yT4LCgXJ2+nAaYuXAOiHvyO3IbiB7ZUKtaw9Kq7Aj pInbp+9ZNWyztUdmLf2F/29Dg5Ea7+VM7LtE5IzVE2q3iWRJPuEvzEPaU A==; X-IronPort-AV: E=McAfee;i="6500,9779,10621"; a="358849416" X-IronPort-AV: E=Sophos;i="5.97,299,1669104000"; d="scan'208";a="358849416" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2023 05:42:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10621"; a="793502742" X-IronPort-AV: E=Sophos;i="5.97,299,1669104000"; d="scan'208";a="793502742" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 15 Feb 2023 05:42:04 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 674A7252; 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 4/5] pinctrl: at91: Use dev_err_probe() instead of custom messaging Date: Wed, 15 Feb 2023 15:42:41 +0200 Message-Id: <20230215134242.37618-5-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" The custom message has no value except printing the error code, the same does dev_err_probe(). Let's use the latter for the sake of unification. Note that some APIs already have messaging in them and some simply do not require the current noise. Signed-off-by: Andy Shevchenko Reviewed-by: Claudiu Beznea Tested-by: Claudiu Beznea --- drivers/pinctrl/pinctrl-at91.c | 64 +++++++++++----------------------- 1 file changed, 21 insertions(+), 43 deletions(-) diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index 055a88b2dacc..08f88403affb 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -1294,10 +1294,11 @@ static const struct of_device_id at91_pinctrl_of_ma= tch[] =3D { static int at91_pinctrl_probe_dt(struct platform_device *pdev, struct at91_pinctrl *info) { + struct device *dev =3D &pdev->dev; int ret =3D 0; int i, j, ngpio_chips_enabled =3D 0; uint32_t *tmp; - struct device_node *np =3D pdev->dev.of_node; + struct device_node *np =3D dev->of_node; struct device_node *child; =20 if (!np) @@ -1360,9 +1361,8 @@ static int at91_pinctrl_probe_dt(struct platform_devi= ce *pdev, continue; ret =3D at91_pinctrl_parse_functions(child, info, i++); if (ret) { - dev_err(&pdev->dev, "failed to parse function\n"); of_node_put(child); - return ret; + return dev_err_probe(dev, ret, "failed to parse function\n"); } } =20 @@ -1415,11 +1415,8 @@ static int at91_pinctrl_probe(struct platform_device= *pdev) platform_set_drvdata(pdev, info); info->pctl =3D devm_pinctrl_register(&pdev->dev, &at91_pinctrl_desc, info); - - if (IS_ERR(info->pctl)) { - dev_err(&pdev->dev, "could not register AT91 pinctrl driver\n"); - return PTR_ERR(info->pctl); - } + if (IS_ERR(info->pctl)) + return dev_err_probe(dev, PTR_ERR(info->pctl), "could not register AT91 = pinctrl driver\n"); =20 /* We will handle a range of GPIO pins */ for (i =3D 0; i < gpio_banks; i++) @@ -1820,39 +1817,28 @@ static int at91_gpio_probe(struct platform_device *= pdev) char **names; =20 BUG_ON(alias_idx >=3D ARRAY_SIZE(gpio_chips)); - if (gpio_chips[alias_idx]) { - ret =3D -EBUSY; - goto err; - } + if (gpio_chips[alias_idx]) + return dev_err_probe(dev, -EBUSY, "%d slot is occupied.\n", alias_idx); =20 irq =3D platform_get_irq(pdev, 0); - if (irq < 0) { - ret =3D irq; - goto err; - } + if (irq < 0) + return irq; =20 at91_chip =3D devm_kzalloc(&pdev->dev, sizeof(*at91_chip), GFP_KERNEL); - if (!at91_chip) { - ret =3D -ENOMEM; - goto err; - } + if (!at91_chip) + return -ENOMEM; =20 at91_chip->regbase =3D devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(at91_chip->regbase)) { - ret =3D PTR_ERR(at91_chip->regbase); - goto err; - } + if (IS_ERR(at91_chip->regbase)) + return PTR_ERR(at91_chip->regbase); =20 at91_chip->ops =3D of_device_get_match_data(dev); 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); - if (IS_ERR(at91_chip->clock)) { - dev_err(&pdev->dev, "failed to get clock, ignoring.\n"); - ret =3D PTR_ERR(at91_chip->clock); - goto err; - } + if (IS_ERR(at91_chip->clock)) + return dev_err_probe(dev, PTR_ERR(at91_chip->clock), "failed to get cloc= k, ignoring.\n"); =20 at91_chip->chip =3D at91_gpio_template; at91_chip->id =3D alias_idx; @@ -1865,17 +1851,15 @@ static int at91_gpio_probe(struct platform_device *= pdev) =20 if (!of_property_read_u32(np, "#gpio-lines", &ngpio)) { if (ngpio >=3D MAX_NB_GPIO_PER_BANK) - pr_err("at91_gpio.%d, gpio-nb >=3D %d failback to %d\n", - alias_idx, MAX_NB_GPIO_PER_BANK, MAX_NB_GPIO_PER_BANK); + dev_err(dev, "at91_gpio.%d, gpio-nb >=3D %d failback to %d\n", + alias_idx, MAX_NB_GPIO_PER_BANK, MAX_NB_GPIO_PER_BANK); else chip->ngpio =3D ngpio; } =20 names =3D devm_kasprintf_strarray(dev, "pio", chip->ngpio); - if (!names) { - ret =3D -ENOMEM; - goto err; - } + if (!names) + return -ENOMEM; =20 for (i =3D 0; i < chip->ngpio; i++) strreplace(names[i], '-', alias_idx + 'A'); @@ -1892,11 +1876,11 @@ static int at91_gpio_probe(struct platform_device *= pdev) =20 ret =3D at91_gpio_of_irq_setup(pdev, at91_chip); if (ret) - goto gpiochip_add_err; + return ret; =20 ret =3D gpiochip_add_data(chip, at91_chip); if (ret) - goto gpiochip_add_err; + return ret; =20 gpio_chips[alias_idx] =3D at91_chip; platform_set_drvdata(pdev, at91_chip); @@ -1905,12 +1889,6 @@ static int at91_gpio_probe(struct platform_device *p= dev) dev_info(&pdev->dev, "at address %p\n", at91_chip->regbase); =20 return 0; - -gpiochip_add_err: -err: - dev_err(&pdev->dev, "Failure %i for GPIO %i\n", ret, alias_idx); - - return ret; } =20 static const struct dev_pm_ops at91_gpio_pm_ops =3D { --=20 2.39.1