From patchwork Tue Mar 7 19:33:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 65839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2643751wrd; Tue, 7 Mar 2023 12:25:24 -0800 (PST) X-Google-Smtp-Source: AK7set8E9aJEkMBlXI3+cfO2J3iPgyALHcdkAfd5/cYh5ze3rVfV2MohNtKeUbjmaApW/F0IY4+k X-Received: by 2002:aa7:d910:0:b0:4ad:7c44:35fc with SMTP id a16-20020aa7d910000000b004ad7c4435fcmr13513913edr.6.1678220724723; Tue, 07 Mar 2023 12:25:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678220724; cv=none; d=google.com; s=arc-20160816; b=jjD9w4X7npY7/FHg0+mRu/OYAXMc5qgJ6CL9BsvjQa+KM8BwRn25giAhVuJW6/zQHP Cw9lJc1d8pZlQ3wbCJZCcUqN+gbi8BqKmHWbI6BaFUH0VokQTsuD7y24BgTr8tSitryk +gOHe9K5LqFtN4C4NSJxzh+ytBOUJEDhtZ6baTkXzqNvg30qgv37IFWK2njPDgg7utsm ggxF+XrpdI2+S3kFZUXBUhMxCpFQ7SGAmdbiIlKn+92D4jyRf1cb2NNKudqo9a95pNeH kCBDVaJkysj2VzxhBtBIObJHzU9w7gc44mgssUACUAm63tnoI88mP2s9J+0KuiHuSHgz ckqQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=VZPQo90BF4za+2DxTnTfA4rqN5o7cRlXJuablQTN0vI=; b=dL/5HAjKc5YT8BYKbzdph/mO51MzgFYl4KpSHSTD4aS9jcQzf8NNBmU8W+pC7WNJK2 YkgZuab+z0fgJVqLsaeFischPkEBa0ds6b1b8aKAzwxbvkVYAmF0O5PLamWw3L1/Mj1v qzESui1iyn5oNkMuE/Nebf0tHu6WcQbrtku4B/MLYW8+ULosI8LOcGslmDSYJmoJNLjE QSftssJVlyU3O6u/1etzqmptisdUT0eO/lIeIqr1/HigvNeXvIv/Pulgr5ptgiYWrmT1 pLwLn7hti/qReZtnsKnGLnF6hFGznMkfRgSzzWp4yW0wnzO9y+qDtQB7hrJEXUgfS/HM xONw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=s3h3WlDG; 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 n8-20020a056402060800b004c180fc7861si2843815edv.357.2023.03.07.12.25.00; Tue, 07 Mar 2023 12:25:24 -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=s3h3WlDG; 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 S231700AbjCGTqI (ORCPT + 99 others); Tue, 7 Mar 2023 14:46:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232512AbjCGToe (ORCPT ); Tue, 7 Mar 2023 14:44:34 -0500 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 959DA9AFD2; Tue, 7 Mar 2023 11:33:52 -0800 (PST) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 327JXkLV129393; 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=VZPQo90BF4za+2DxTnTfA4rqN5o7cRlXJuablQTN0vI=; h=From:To:CC:Subject:Date; b=s3h3WlDG9pUBA/NUm3vq1MQtBXYjRR+DzoctbMy4B8PC61IQOiCU/fPY5XNNRTeO/ d1AFt1+ue4ol9FOC3OOvhDZ36iWhgp9Q/6OYduT030cUjRuioM3ts4AZTxXcNXcsai DlhLlBXU/rA5ZvB/bWXhNqw2Zkcwf8/aMMYBOAXE= Received: from DLEE111.ent.ti.com (dlee111.ent.ti.com [157.170.170.22]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 327JXkEA123433 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 7 Mar 2023 13:33:46 -0600 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE111.ent.ti.com (157.170.170.22) 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 DLEE110.ent.ti.com (157.170.170.21) 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 327JXkWm026389; 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 1/6] gpio: ich: Use devm_gpiochip_add_data() to simplify remove path Date: Tue, 7 Mar 2023 13:33:41 -0600 Message-ID: <20230307193346.8718-1-afd@ti.com> X-Mailer: git-send-email 2.39.2 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?1759741974376930210?= X-GMAIL-MSGID: =?utf-8?q?1759741974376930210?= Use devm version of gpiochip add function to handle removal for us. Signed-off-by: Andrew Davis --- drivers/gpio/gpio-ich.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/gpio/gpio-ich.c b/drivers/gpio/gpio-ich.c index 3b31f5e9bf40..0be9285efebc 100644 --- a/drivers/gpio/gpio-ich.c +++ b/drivers/gpio/gpio-ich.c @@ -457,7 +457,7 @@ static int ichx_gpio_probe(struct platform_device *pdev) init: ichx_gpiolib_setup(&ichx_priv.chip); - err = gpiochip_add_data(&ichx_priv.chip, NULL); + err = devm_gpiochip_add_data(dev, &ichx_priv.chip, NULL); if (err) { dev_err(dev, "Failed to register GPIOs\n"); return err; @@ -469,19 +469,11 @@ static int ichx_gpio_probe(struct platform_device *pdev) return 0; } -static int ichx_gpio_remove(struct platform_device *pdev) -{ - gpiochip_remove(&ichx_priv.chip); - - return 0; -} - static struct platform_driver ichx_gpio_driver = { .driver = { .name = DRV_NAME, }, .probe = ichx_gpio_probe, - .remove = ichx_gpio_remove, }; module_platform_driver(ichx_gpio_driver); 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) From patchwork Tue Mar 7 19:33:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 65829 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2633110wrd; Tue, 7 Mar 2023 12:02:09 -0800 (PST) X-Google-Smtp-Source: AK7set+j0DGBL1zDhEE/IojdkY461lA/95QnT+EvT7d4HrYyKYYEmpUC7Gx9ZRKwyfqMj4jyHIgf X-Received: by 2002:a17:906:3197:b0:8b1:3293:ead2 with SMTP id 23-20020a170906319700b008b13293ead2mr16608909ejy.25.1678219329727; Tue, 07 Mar 2023 12:02:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678219329; cv=none; d=google.com; s=arc-20160816; b=U5azw9Rf0zmje3kfiD40CXrU8zpGzesIi2XEvBJFCYwpz8yiibV0HnrZoOWnDIe98d eT/hZeViNmyFtLhKN2VsvH7nBHQMZFAnufkLr/+u9/194Q8ah6v8O/pzshWTHJmI8SRk 8sTqcF6SaXa7UjdpHQ3ZHAmTDm2mvTdgzoyapLBHNKAzdEW5dtg5+0IqLmdgfjxS2ujt b4JCHsblNoThvi1tGLNMXFRHeohLGsxiUCKQWlCwtqjlD8HH3pvCxGmOvKC+uZhpiAOz EfoTOF+dMi7AVHC6oZuibEbaTIj9pmYIYZYNP7Qs6BWFPQcuA8ColSCHrV7DOe5NNTlu C/PA== 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=2QKk8MDasC9TQp6Y/MGWR5Z7h/GdVQwRLQTrVMYwwAU=; b=0+/19syKTYLczsKT+XagESGQXrcJ5xFcbYznw+UIkTXqfqs4ujwLHgfr0A9dgU3wR+ RT94XHiW16VETn8oHFeUMmLhEGZz1oqazWG+261yxSBRBN8Lp7itvkEvY8dXb104yR/y g/r8hL1SeL6CWltiC8mFH9hMsQawWIRYoTDYCMYwKX5WML6Wf9K2hUt3wapBSB9qhZN9 VDWgrwRAYae5bwuU4zycZlYrkBZZmFuxPzcNgDazJaxoHBhtGCfqyTAQ0yN7wzvE9BmD zHdfsFGOvjTb8WmVYidCYB8NqYxmIzS47rBmpqDEghf7Vv7ZyCsc45uaIjZVUUofjfHl MOfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=qIJxhOmy; 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 n24-20020a05640206d800b004accb663177si12879185edy.330.2023.03.07.12.01.45; Tue, 07 Mar 2023 12:02:09 -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=qIJxhOmy; 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 S231752AbjCGTqO (ORCPT + 99 others); Tue, 7 Mar 2023 14:46:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231940AbjCGToe (ORCPT ); Tue, 7 Mar 2023 14:44:34 -0500 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D4E498EAE; Tue, 7 Mar 2023 11:33:51 -0800 (PST) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 327JXkUo129397; 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=2QKk8MDasC9TQp6Y/MGWR5Z7h/GdVQwRLQTrVMYwwAU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=qIJxhOmytpNBGTwFVkqA6fcECG1b/POelKbKOD7gzUYobfwP6yqjhwazWtY0IlN8s b3ic42MCYEY11U6NA3I+KWuLGgYl3JjiE0U3o78kGYRdKROUXaoOu0vxIWwxvFYZ0V sxQetdKFVL54LdUgTCpAM0qZC97FGguXm7N43KMg= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 327JXkOC123439 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 7 Mar 2023 13:33:46 -0600 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE112.ent.ti.com (157.170.170.23) 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 DLEE112.ent.ti.com (157.170.170.23) 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 327JXkWo026389; 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 3/6] gpio: sch311x: Use devm_gpiochip_add_data() to simplify remove path Date: Tue, 7 Mar 2023 13:33:43 -0600 Message-ID: <20230307193346.8718-3-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?1759740511820895570?= X-GMAIL-MSGID: =?utf-8?q?1759740511820895570?= Use devm version of gpiochip add function to handle removal for us. Signed-off-by: Andrew Davis --- drivers/gpio/gpio-sch311x.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/drivers/gpio/gpio-sch311x.c b/drivers/gpio/gpio-sch311x.c index da01e1cad7cb..ba7c300511a5 100644 --- a/drivers/gpio/gpio-sch311x.c +++ b/drivers/gpio/gpio-sch311x.c @@ -281,8 +281,6 @@ static int sch311x_gpio_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; - platform_set_drvdata(pdev, priv); - for (i = 0; i < ARRAY_SIZE(priv->blocks); i++) { block = &priv->blocks[i]; @@ -305,36 +303,17 @@ static int sch311x_gpio_probe(struct platform_device *pdev) block->data_reg = sch311x_gpio_blocks[i].data_reg; block->runtime_reg = pdata->runtime_reg; - err = gpiochip_add_data(&block->chip, block); + err = devm_gpiochip_add_data(&pdev->dev, &block->chip, block); if (err < 0) { dev_err(&pdev->dev, "Could not register gpiochip, %d\n", err); - goto exit_err; + return err; } dev_info(&pdev->dev, "SMSC SCH311x GPIO block %d registered.\n", i); } return 0; - -exit_err: - /* release already registered chips */ - for (--i; i >= 0; i--) - gpiochip_remove(&priv->blocks[i].chip); - return err; -} - -static int sch311x_gpio_remove(struct platform_device *pdev) -{ - struct sch311x_gpio_priv *priv = platform_get_drvdata(pdev); - int i; - - for (i = 0; i < ARRAY_SIZE(priv->blocks); i++) { - gpiochip_remove(&priv->blocks[i].chip); - dev_info(&pdev->dev, - "SMSC SCH311x GPIO block %d unregistered.\n", i); - } - return 0; } static struct platform_driver sch311x_gpio_driver = { From patchwork Tue Mar 7 19:33:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 65830 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2633216wrd; Tue, 7 Mar 2023 12:02:20 -0800 (PST) X-Google-Smtp-Source: AK7set9Mjj4qybriebvVGpDPzRiYxR6dJkReEu00qjIwRjJvFr8+FasUhvWZujeAn3Rh46xT5gKc X-Received: by 2002:a05:6402:150e:b0:4ad:316:b4d9 with SMTP id f14-20020a056402150e00b004ad0316b4d9mr16543258edw.15.1678219340476; Tue, 07 Mar 2023 12:02:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678219340; cv=none; d=google.com; s=arc-20160816; b=dAoDwyz4S3fVExl4yGBlpiU78jvKt2mlWLabc+oZScElk4IuU8hsHrhJhxWBQexnGa HPM4+kJZ8+7GslfcMwvLSFrU8S1x4Y8AO0o3CD6tFSmgEyD6XBY8duULVovBHkCJRFb/ Ap3J/Hib5ZxC/8uuSnzC6OlLhLQLn0DxF+jYhx/TifUjPae8JdsNMOI3TlaZ/rcHjJHy 7BJ7H40qIVBc406OABspplPLjo7gdGqamxI68LWzEb0KTUONgXI/SSsGeWnmMc2hSg1O OLIvtVyYjNJy6miCxz+h1rrBcKlokp0bPwU3wgxQ3mmFYW37YN9aHEPZpor3qBUpjB22 G3CQ== 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=DjK0sRaZ4GVXYwVt87u0D782I7dRwIU+ZR/XTBfA0TU=; b=SJna7/PQgbQA9KXlI8HyxN9H9OrK3eNE3kzyaxjoKRupqBv209ezw9+hxkZWqDOwMf jgUhU/TU6N8rLIPmkXFw/ITzVplQgMVPk0MfTbEdgKm+JPH0C44gUCXMWNgWoKdM9NoR 4H7F67V+eFNEBv75uWYr8pl1DT2WJdNDNQiEfdKyMdl/YkmyoD+4B+ktfNQouwwekrjF voc6oaWiONHMDbVNFDyOZwKDhKfa16/J8kXKkMVjEamsCzNuiMudwpTde5LUcZI5Zhjz 4hrlshz3B8yUVbmf68qewPd9T/PesYCUtpEthIxmUaZTaWFVIrlpMHqKpISNVx4iMLso w40w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=EitCBHAh; 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 j14-20020a170906278e00b008f8929efcf4si1543561ejc.108.2023.03.07.12.01.57; Tue, 07 Mar 2023 12:02:20 -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=EitCBHAh; 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 S229806AbjCGTqR (ORCPT + 99 others); Tue, 7 Mar 2023 14:46:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231623AbjCGToe (ORCPT ); Tue, 7 Mar 2023 14:44:34 -0500 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D29898EAC; Tue, 7 Mar 2023 11:33:51 -0800 (PST) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 327JXkUT129401; 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=DjK0sRaZ4GVXYwVt87u0D782I7dRwIU+ZR/XTBfA0TU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=EitCBHAh+cm7VmVxIbji4uMTPu+LdVUOa7hsuXAzdv9vz/sEfS3wFfbzAUwY4V9XL PRXtDV9PkXkSZGDShQHGn/Zb1X8ALlbZlM9cWRA62FZKfmIgHsySoJyOn6FJzg9oUZ PA3tgf7JANtolRhICYY5N6j/BMqOWmyy5kyPjans= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 327JXk6p007552 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 7 Mar 2023 13:33:46 -0600 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE108.ent.ti.com (157.170.170.38) 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 DLEE101.ent.ti.com (157.170.170.31) 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 327JXkWp026389; 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 4/6] gpio: pisosr: Use devm_gpiochip_add_data() to simplify remove path Date: Tue, 7 Mar 2023 13:33:44 -0600 Message-ID: <20230307193346.8718-4-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?1759740523162440779?= X-GMAIL-MSGID: =?utf-8?q?1759740523162440779?= Use devm version of gpiochip add function to handle removal for us. While here update copyright and module author. Signed-off-by: Andrew Davis --- Changes from v1: - Use devm to cleanup mutex drivers/gpio/gpio-pisosr.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/drivers/gpio/gpio-pisosr.c b/drivers/gpio/gpio-pisosr.c index 67071bea08c2..4c9d138a7dc7 100644 --- a/drivers/gpio/gpio-pisosr.c +++ b/drivers/gpio/gpio-pisosr.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/ - * Andrew F. Davis + * Copyright (C) 2015-2023 Texas Instruments Incorporated - https://www.ti.com/ + * Andrew Davis */ #include @@ -116,6 +116,13 @@ static const struct gpio_chip template_chip = { .can_sleep = true, }; +static void pisosr_mutex_destroy(void *data) +{ + struct mutex *lock = data; + + mutex_destroy(lock); +} + static int pisosr_gpio_probe(struct spi_device *spi) { struct device *dev = &spi->dev; @@ -126,8 +133,6 @@ static int pisosr_gpio_probe(struct spi_device *spi) if (!gpio) return -ENOMEM; - spi_set_drvdata(spi, gpio); - gpio->chip = template_chip; gpio->chip.parent = dev; of_property_read_u16(dev->of_node, "ngpios", &gpio->chip.ngpio); @@ -145,8 +150,11 @@ static int pisosr_gpio_probe(struct spi_device *spi) "Unable to allocate load GPIO\n"); mutex_init(&gpio->lock); + ret = devm_add_action_or_reset(dev, pisosr_mutex_destroy, &gpio->lock); + if (ret) + return ret; - ret = gpiochip_add_data(&gpio->chip, gpio); + ret = devm_gpiochip_add_data(dev, &gpio->chip, gpio); if (ret < 0) { dev_err(dev, "Unable to register gpiochip\n"); return ret; @@ -155,15 +163,6 @@ static int pisosr_gpio_probe(struct spi_device *spi) return 0; } -static void pisosr_gpio_remove(struct spi_device *spi) -{ - struct pisosr_gpio *gpio = spi_get_drvdata(spi); - - gpiochip_remove(&gpio->chip); - - mutex_destroy(&gpio->lock); -} - static const struct spi_device_id pisosr_gpio_id_table[] = { { "pisosr-gpio", }, { /* sentinel */ } @@ -182,11 +181,10 @@ static struct spi_driver pisosr_gpio_driver = { .of_match_table = pisosr_gpio_of_match_table, }, .probe = pisosr_gpio_probe, - .remove = pisosr_gpio_remove, .id_table = pisosr_gpio_id_table, }; module_spi_driver(pisosr_gpio_driver); -MODULE_AUTHOR("Andrew F. Davis "); +MODULE_AUTHOR("Andrew Davis "); MODULE_DESCRIPTION("SPI Compatible PISO Shift Register GPIO Driver"); MODULE_LICENSE("GPL v2"); From patchwork Tue Mar 7 19:33:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 65846 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2645560wrd; Tue, 7 Mar 2023 12:29:28 -0800 (PST) X-Google-Smtp-Source: AK7set9p/9JmBd/nGcOd5x9f8SC1Tz/xhsr6DS/gej6IP7JLs1DwjRruGKthpCrlkqmMELuYtNrE X-Received: by 2002:aa7:c1d7:0:b0:4ab:d1f4:4b88 with SMTP id d23-20020aa7c1d7000000b004abd1f44b88mr11785568edp.41.1678220967800; Tue, 07 Mar 2023 12:29:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678220967; cv=none; d=google.com; s=arc-20160816; b=LiQEt+uRqXioqONFufx+tZcSZTP6GKmlxmb781cFmwu6BGnpYCFiuxD3ilX7As7CNf +aNiMlGROgFnL7ZcoybEQMs5E5DjGTSHFjp/NYbSU3NBLANh776g+ehGzJYJK0ePkS7a 9dIGq7VJafLQA+JT1YwXly0bzK2J8e4EaJ6ta2LICoeY5lstCpivEy6RPBEfaJqhyM1/ P770cyZ3VeuOlYWO3mBswyvUxHYzAke8OCBEWW1vCXRVg7bIXl8l3pUqK/6avkMbrLun mag8mSNDsW6HEf+HKJ3pn4vebO5hoEhrVwyTn8gCnKg0ibML2el4YvycT9HORBZ6koeN 1AmA== 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=MjozjsM7oc2HrtgkTcGYDiESorMVaDXnh/A+VTPqizc=; b=VUPaeT2YlG6/iG+J5NZJ2thAkl7ZXghDcmJsaw3KCpyfwbzl92u4FsIf9L9Fsbi6tJ 8ZdoCGMiV8aHG6Epr4qtUz6cJUXx3oqwKiDEZZzFw1IGg0rg+8jBRJNtBCJhu6vqty37 irajnHXhj5iG73qpSdm6z00I4kLq6uCEUSAWb7nJZlvnOR1LRtZSHiQMFEsWVkm+Y2x2 xiaTuw5GWk1i5uKhYM+pWzoxNYiDldc1vUpPo09L1hjSmwIZKSNp1Ac1eD0B/5mi7xzx 6tFvq5ENYfcFbMNzMCgH3oWxo+VoeQ9oa0NXoNk47IuMfArwaT5Ln5VRYe83kDwvf7Rk i7KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=oVGE1yOn; 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 n8-20020a056402060800b004c180fc7861si2843815edv.357.2023.03.07.12.29.04; Tue, 07 Mar 2023 12:29:27 -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=oVGE1yOn; 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 S231546AbjCGTqF (ORCPT + 99 others); Tue, 7 Mar 2023 14:46:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231894AbjCGTod (ORCPT ); Tue, 7 Mar 2023 14:44:33 -0500 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A324A98850; Tue, 7 Mar 2023 11:33:51 -0800 (PST) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 327JXk43032053; 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=MjozjsM7oc2HrtgkTcGYDiESorMVaDXnh/A+VTPqizc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=oVGE1yOnfCxQuT8mDvLuDK359VltJfZcdeDlDg8J1L2l5CL2+bLWKb3f8nB3BOWMw 5/7k0czFmU+HEAECuEn14y1C8k6iJ/PkMstb0kwGaHlgLIXhJlWEFFFG5+UItmbar/ 4Q5GYmZv/meOe/QC2sOwy2rQLtDbofV6YdLB0jIA= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 327JXkY3123444 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 7 Mar 2023 13:33:46 -0600 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE112.ent.ti.com (157.170.170.23) 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 DLEE114.ent.ti.com (157.170.170.25) 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 327JXkWq026389; 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 5/6] gpio: tpic2810: Use devm_gpiochip_add_data() to simplify remove path Date: Tue, 7 Mar 2023 13:33:45 -0600 Message-ID: <20230307193346.8718-5-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?1759742229612256945?= X-GMAIL-MSGID: =?utf-8?q?1759742229612256945?= Use devm version of gpiochip add function to handle removal for us. While here update copyright and module author. Signed-off-by: Andrew Davis --- drivers/gpio/gpio-tpic2810.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/gpio/gpio-tpic2810.c b/drivers/gpio/gpio-tpic2810.c index 349c5fbd9b02..718053edd76a 100644 --- a/drivers/gpio/gpio-tpic2810.c +++ b/drivers/gpio/gpio-tpic2810.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/ - * Andrew F. Davis + * Copyright (C) 2015-2023 Texas Instruments Incorporated - https://www.ti.com/ + * Andrew Davis */ #include @@ -107,8 +107,6 @@ static int tpic2810_probe(struct i2c_client *client) if (!gpio) return -ENOMEM; - i2c_set_clientdata(client, gpio); - gpio->chip = template_chip; gpio->chip.parent = &client->dev; @@ -116,7 +114,7 @@ static int tpic2810_probe(struct i2c_client *client) mutex_init(&gpio->lock); - ret = gpiochip_add_data(&gpio->chip, gpio); + ret = devm_gpiochip_add_data(&client->dev, &gpio->chip, gpio); if (ret < 0) { dev_err(&client->dev, "Unable to register gpiochip\n"); return ret; @@ -125,13 +123,6 @@ static int tpic2810_probe(struct i2c_client *client) return 0; } -static void tpic2810_remove(struct i2c_client *client) -{ - struct tpic2810 *gpio = i2c_get_clientdata(client); - - gpiochip_remove(&gpio->chip); -} - static const struct i2c_device_id tpic2810_id_table[] = { { "tpic2810", }, { /* sentinel */ } @@ -144,11 +135,10 @@ static struct i2c_driver tpic2810_driver = { .of_match_table = tpic2810_of_match_table, }, .probe_new = tpic2810_probe, - .remove = tpic2810_remove, .id_table = tpic2810_id_table, }; module_i2c_driver(tpic2810_driver); -MODULE_AUTHOR("Andrew F. Davis "); +MODULE_AUTHOR("Andrew Davis "); MODULE_DESCRIPTION("TPIC2810 8-Bit LED Driver GPIO Driver"); MODULE_LICENSE("GPL v2"); From patchwork Tue Mar 7 19:33:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 65847 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2646346wrd; Tue, 7 Mar 2023 12:31:10 -0800 (PST) X-Google-Smtp-Source: AK7set/fUcUcHH1GtGoG09M0C2EMtECF+MNGzfPg/+DIsGBtsawHxae02NWRL1pDFgYQ21hQ7z16 X-Received: by 2002:a05:6a20:1447:b0:cd:87ef:3f33 with SMTP id a7-20020a056a20144700b000cd87ef3f33mr20498579pzi.29.1678221069991; Tue, 07 Mar 2023 12:31:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678221069; cv=none; d=google.com; s=arc-20160816; b=A/O5eff3/5/MXO7BO3CFvLeU9cSegIMrhAZ6NJTo/0mGIkYPHQZzN6pNNmSlEHelOK 5g6Lqq1gEpZaBIaVRNT3jmqQ4PhH7BzhEICn2GEbGJG/stwZ1Dn0cxZgzfaKHefQPWvu BMUy5SKasrILNGoGvU2mcNvTtEFqDMQgVQYy1P4TXbwB00C/KYwfP6yBvmLwtCzcen8l Wi4NWtMEcoKw6HQ3gPAcnVtp5j/cFHuqwECCrhqj07epIlZnPOLcTLt/pGDhSZIz/l31 herkgD5U2/rVaNGAXKh945yWESM8NCJbC8DnBJlOMzXm448jmIGKeRQezbx3ApZUjNUx c+kA== 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=ZZ2CX0VbEpPFPtwgXxUtM9c1eVceTlwlTZUDyoR3v1Y=; b=FaBchefMvGeFptBWsnjPDEJtxF5x5PGaeYv25YKAwa8ja4yww43DHwMfYZXev2K5ab PRaAGrAyyDKBRSY2sdEIVzfSI6UfHHdFcBBqJAqRvUKYKi9tqKFF3vCMF5DE5aV9JYJh tLXbV7KTsLvfVsBibH+qAbq1iF0R0Ql/BJIRgw9q5yGE3zIpdauFxpsfHZKVQ6KByl/K dwd8+0ntYwS612i+jIB/aadKrQjowROdaAVmnhb6nVDFRMh5k5/+f6j7TSIxuHFoRPmT S9Xl9L/dMl4qT6Cr+RWqBHH+9TrI3dv9asM3k2oFo2Kl4Yjq1X0JH3Yei5gjT/A3z8lA Kp9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=bNl9+8uq; 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 65-20020a630244000000b004fb64c27835si12245282pgc.524.2023.03.07.12.30.57; Tue, 07 Mar 2023 12:31:09 -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=bNl9+8uq; 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 S229890AbjCGTpw (ORCPT + 99 others); Tue, 7 Mar 2023 14:45:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231936AbjCGTod (ORCPT ); Tue, 7 Mar 2023 14:44:33 -0500 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3023984CD; Tue, 7 Mar 2023 11:33:51 -0800 (PST) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 327JXlRV032057; Tue, 7 Mar 2023 13:33:47 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1678217627; bh=ZZ2CX0VbEpPFPtwgXxUtM9c1eVceTlwlTZUDyoR3v1Y=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=bNl9+8uqN53pjLIupqoy/oH95usAq5iHt1SAZA5xK/EAbqhQapiX/52A/0RBumICm XHfvxY305hPCuHu8+SqYaeLMQtb795U5YV1MREGR649P3KZY+/X3SAYfLCmUHGXBH/ LyHp8AQrbpS/IWw4tRphgftFtqj8RKymQGcv/l5s= Received: from DFLE110.ent.ti.com (dfle110.ent.ti.com [10.64.6.31]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 327JXlGm022502 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 7 Mar 2023 13:33:47 -0600 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE110.ent.ti.com (10.64.6.31) 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 DFLE109.ent.ti.com (10.64.6.30) 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 327JXkWr026389; 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 6/6] gpio: tps65086: Use devm_gpiochip_add_data() to simplify remove path Date: Tue, 7 Mar 2023 13:33:46 -0600 Message-ID: <20230307193346.8718-6-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?1759742336929455936?= X-GMAIL-MSGID: =?utf-8?q?1759742336929455936?= Use devm version of gpiochip add function to handle removal for us. While here update copyright and module author. Signed-off-by: Andrew Davis --- drivers/gpio/gpio-tps65086.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/gpio/gpio-tps65086.c b/drivers/gpio/gpio-tps65086.c index 1e9d8262d0ff..0b8b631441ae 100644 --- a/drivers/gpio/gpio-tps65086.c +++ b/drivers/gpio/gpio-tps65086.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/ - * Andrew F. Davis + * Copyright (C) 2015-2023 Texas Instruments Incorporated - https://www.ti.com/ + * Andrew Davis * * Based on the TPS65912 driver */ @@ -86,13 +86,11 @@ static int tps65086_gpio_probe(struct platform_device *pdev) if (!gpio) return -ENOMEM; - platform_set_drvdata(pdev, gpio); - gpio->tps = dev_get_drvdata(pdev->dev.parent); gpio->chip = template_chip; gpio->chip.parent = gpio->tps->dev; - ret = gpiochip_add_data(&gpio->chip, gpio); + ret = devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio); if (ret < 0) { dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret); return ret; @@ -101,15 +99,6 @@ static int tps65086_gpio_probe(struct platform_device *pdev) return 0; } -static int tps65086_gpio_remove(struct platform_device *pdev) -{ - struct tps65086_gpio *gpio = platform_get_drvdata(pdev); - - gpiochip_remove(&gpio->chip); - - return 0; -} - static const struct platform_device_id tps65086_gpio_id_table[] = { { "tps65086-gpio", }, { /* sentinel */ } @@ -121,11 +110,10 @@ static struct platform_driver tps65086_gpio_driver = { .name = "tps65086-gpio", }, .probe = tps65086_gpio_probe, - .remove = tps65086_gpio_remove, .id_table = tps65086_gpio_id_table, }; module_platform_driver(tps65086_gpio_driver); -MODULE_AUTHOR("Andrew F. Davis "); +MODULE_AUTHOR("Andrew Davis "); MODULE_DESCRIPTION("TPS65086 GPIO driver"); MODULE_LICENSE("GPL v2");