From nobody Tue Dec 30 09:34:08 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 651E3C54E76 for ; Thu, 16 Nov 2023 22:30:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345542AbjKPWa7 (ORCPT ); Thu, 16 Nov 2023 17:30:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229741AbjKPWa5 (ORCPT ); Thu, 16 Nov 2023 17:30:57 -0500 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86262C5; Thu, 16 Nov 2023 14:30:52 -0800 (PST) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3AGMUlIm030689; Thu, 16 Nov 2023 16:30:47 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1700173847; bh=53MWMbTaJs5GbSNSY78WEVCLzsf+daLjAhhWbSNVocM=; h=From:To:CC:Subject:Date; b=kGXPTGI9rs5bdB3z9sDKVC3MaspMLYpptZh/nSvxh5rT4vUiRSHbDb+6GMMJpfvpl w3/QtO8uSgpa4CNUf6FTu3Zp/16VcswwB69V64CtamRud01cXM6Njc6YIleqblXEus rD633DWzwbxyCOfAz+ePQMbjjMezo1R2E6Kn+2uU= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3AGMUlRO049401 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 16 Nov 2023 16:30:47 -0600 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 16 Nov 2023 16:30:47 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 16 Nov 2023 16:30:47 -0600 Received: from lelv0327.itg.ti.com (ileaxei01-snat.itg.ti.com [10.180.69.5]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3AGMUkKq024789; Thu, 16 Nov 2023 16:30:46 -0600 From: Andrew Davis To: Andy Shevchenko , Linus Walleij , Bartosz Golaszewski CC: , , Andrew Davis Subject: [PATCH] pinctrl: as3722: Use devm_gpiochip_add_data() to simplify remove path Date: Thu, 16 Nov 2023 16:30:45 -0600 Message-ID: <20231116223045.274211-1-afd@ti.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use devm version of gpiochip add function to handle removal for us. Signed-off-by: Andrew Davis Reviewed-by: Andy Shevchenko Reviewed-by: Andy Shevchenko --- drivers/pinctrl/pinctrl-as3722.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/pinctrl/pinctrl-as3722.c b/drivers/pinctrl/pinctrl-as3= 722.c index 6a5f23cf7a2a2..0d8c75ce20eda 100644 --- a/drivers/pinctrl/pinctrl-as3722.c +++ b/drivers/pinctrl/pinctrl-as3722.c @@ -542,7 +542,6 @@ static int as3722_pinctrl_probe(struct platform_device = *pdev) =20 as_pci->dev =3D &pdev->dev; as_pci->as3722 =3D dev_get_drvdata(pdev->dev.parent); - platform_set_drvdata(pdev, as_pci); =20 as_pci->pins =3D as3722_pins_desc; as_pci->num_pins =3D ARRAY_SIZE(as3722_pins_desc); @@ -562,7 +561,7 @@ static int as3722_pinctrl_probe(struct platform_device = *pdev) =20 as_pci->gpio_chip =3D as3722_gpio_chip; as_pci->gpio_chip.parent =3D &pdev->dev; - ret =3D gpiochip_add_data(&as_pci->gpio_chip, as_pci); + ret =3D devm_gpiochip_add_data(&pdev->dev, &as_pci->gpio_chip, as_pci); if (ret < 0) { dev_err(&pdev->dev, "Couldn't register gpiochip, %d\n", ret); return ret; @@ -572,21 +571,10 @@ static int as3722_pinctrl_probe(struct platform_devic= e *pdev) 0, 0, AS3722_PIN_NUM); if (ret < 0) { dev_err(&pdev->dev, "Couldn't add pin range, %d\n", ret); - goto fail_range_add; + return ret; } =20 return 0; - -fail_range_add: - gpiochip_remove(&as_pci->gpio_chip); - return ret; -} - -static void as3722_pinctrl_remove(struct platform_device *pdev) -{ - struct as3722_pctrl_info *as_pci =3D platform_get_drvdata(pdev); - - gpiochip_remove(&as_pci->gpio_chip); } =20 static const struct of_device_id as3722_pinctrl_of_match[] =3D { @@ -601,7 +589,6 @@ static struct platform_driver as3722_pinctrl_driver =3D= { .of_match_table =3D as3722_pinctrl_of_match, }, .probe =3D as3722_pinctrl_probe, - .remove_new =3D as3722_pinctrl_remove, }; module_platform_driver(as3722_pinctrl_driver); =20 --=20 2.39.2