From patchwork Tue Mar 7 19:33:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 65841 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2644659wrd; Tue, 7 Mar 2023 12:27:29 -0800 (PST) X-Google-Smtp-Source: AK7set/+/p4l5aMBKbp/+9MuW4DOjXvlxDqokTvXW61x22QQ1/V3mY6fP0+7C1l3GNwWjrscmaNk X-Received: by 2002:a17:906:308e:b0:878:7a0e:5730 with SMTP id 14-20020a170906308e00b008787a0e5730mr15943659ejv.56.1678220848922; Tue, 07 Mar 2023 12:27:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678220848; cv=none; d=google.com; s=arc-20160816; b=Qj35Vl4dBQ/+34K6BLZQ04kPCBXvt81TLofbRxiLRyUel2nElqgQOyGbp3U7NXyL9C 3psYa4LwEb2/OZwkSU6bFmcRj5oue5LFk5CziXI/IqPDnis0fe2bRHhumdZz2W7HxX4U P/XUV4ttc+abKN+NSdSyDHPx8c4I1uG2zIwB1MH/ZigOMg7nRY12NyyRKMHU/dNwc/Tq CDhbkZfDVsa+4pKyZWHbhU+0tO47X6ZZhem1MDOSnaB3iE6XWhgJwyNrfu7z8vxZgJ76 01gd9edlnAhCPVTqxW5WNufOL58mv6lnmeP/ZCCHhvMe1zbfvMv22jNlXLM633R2Z68j UOMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0XkjNsVopQ86YcRrh07SREUk+5/73GCZODfBxC2xybw=; b=EvEMGIq4X++sGsEhSvRNkodOSvvy2FZZFZAmjK3f55d0X2uo6VAJ87VM4j/P/Pxr86 Zj/W/rZTeylgF2Tp6wQy3F8pXr5Zk5M+MGzs5T3P1ywGTtQmZBu2iUfNx4B1Gr51+mxz R7J2ttR0EhEwsQ/mO9uDcJMMVNguPYGI3MiSEHtoW67HPNdoeDFdBkkCacZ8ZigYs+n5 nEhkU6TGZFTegpeOW4hWzV1EC3BaA6EIosaZrDMUScJEPcDwxV1kr1KzhRDwBhJRaVyU wJc911rfFxEMW5PEPbGq9PrVhN0Htx/Ar4uCJZslcBUYjCVqILaI4aGO8KisomYBz0hb YJDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=TWi2c3hf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w3-20020a056402070300b004c01a821394si2372858edx.583.2023.03.07.12.27.05; Tue, 07 Mar 2023 12:27:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=TWi2c3hf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231233AbjCGTp5 (ORCPT + 99 others); Tue, 7 Mar 2023 14:45:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231636AbjCGToc (ORCPT ); Tue, 7 Mar 2023 14:44:32 -0500 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A30CE984F0; Tue, 7 Mar 2023 11:33:51 -0800 (PST) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 327JXkRc032049; Tue, 7 Mar 2023 13:33:46 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1678217626; bh=0XkjNsVopQ86YcRrh07SREUk+5/73GCZODfBxC2xybw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=TWi2c3hfntsI4caegan3sT5CLvp8soTVM9VXiSTkFwMsXlypMzOWGngsjix86LRve DRRMIFK8/TrTtmF/seb6C+DLsVulAJ7yGbnr9UKIaCPoxR0RT4midTU+XOHFkzsquP Gn0QYIvQp5gIi9nLiE2I58jAdIyJDfxQLbOjisE8= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 327JXkGS007548 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 7 Mar 2023 13:33:46 -0600 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Tue, 7 Mar 2023 13:33:46 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16 via Frontend Transport; Tue, 7 Mar 2023 13:33:46 -0600 Received: from ula0226330.dal.design.ti.com (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 327JXkWn026389; Tue, 7 Mar 2023 13:33:46 -0600 From: Andrew Davis To: Peter Tyser , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski CC: , , Andrew Davis Subject: [PATCH v2 2/6] gpio: twl4030: Use devm_gpiochip_add_data() to simplify remove path Date: Tue, 7 Mar 2023 13:33:42 -0600 Message-ID: <20230307193346.8718-2-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307193346.8718-1-afd@ti.com> References: <20230307193346.8718-1-afd@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759742104850192071?= X-GMAIL-MSGID: =?utf-8?q?1759742104850192071?= Use devm version of gpiochip add function to handle removal for us. Signed-off-by: Andrew Davis --- Changes from v1: - Actually add the devm call drivers/gpio/gpio-twl4030.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c index c1bb2c3ca6f2..3708ed2314e8 100644 --- a/drivers/gpio/gpio-twl4030.c +++ b/drivers/gpio/gpio-twl4030.c @@ -492,18 +492,6 @@ static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev, return omap_twl_info; } -/* Cannot use as gpio_twl4030_probe() calls us */ -static int gpio_twl4030_remove(struct platform_device *pdev) -{ - struct gpio_twl4030_priv *priv = platform_get_drvdata(pdev); - - gpiochip_remove(&priv->gpio_chip); - - /* REVISIT no support yet for deregistering all the IRQs */ - WARN_ON(!is_module()); - return 0; -} - static int gpio_twl4030_probe(struct platform_device *pdev) { struct twl4030_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev); @@ -577,16 +565,13 @@ static int gpio_twl4030_probe(struct platform_device *pdev) if (pdata->use_leds) priv->gpio_chip.ngpio += 2; - ret = gpiochip_add_data(&priv->gpio_chip, priv); + ret = devm_gpiochip_add_data(&pdev->dev, &priv->gpio_chip, priv); if (ret < 0) { dev_err(&pdev->dev, "could not register gpiochip, %d\n", ret); priv->gpio_chip.ngpio = 0; - gpio_twl4030_remove(pdev); - goto out; + return ret; } - platform_set_drvdata(pdev, priv); - if (pdata->setup) { int status; @@ -596,8 +581,7 @@ static int gpio_twl4030_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "setup --> %d\n", status); } -out: - return ret; + return 0; } static const struct of_device_id twl_gpio_match[] = { @@ -615,7 +599,6 @@ static struct platform_driver gpio_twl4030_driver = { .of_match_table = twl_gpio_match, }, .probe = gpio_twl4030_probe, - .remove = gpio_twl4030_remove, }; static int __init gpio_twl4030_init(void)