From patchwork Tue Mar 7 16:54:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 65724 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2542853wrd; Tue, 7 Mar 2023 09:02:18 -0800 (PST) X-Google-Smtp-Source: AK7set852/URXKpxtTSx7/UeMEdbVjGuICp6Re3pCev/cKwxjnu1Z9DAq3WUbbnfP/mBuILMTBpd X-Received: by 2002:aa7:d989:0:b0:4a3:43c1:8441 with SMTP id u9-20020aa7d989000000b004a343c18441mr17384896eds.21.1678208538405; Tue, 07 Mar 2023 09:02:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678208538; cv=none; d=google.com; s=arc-20160816; b=S8TdkCo+yDJCDGNcT7FOKNApl1+JFJ0bgqeT5ZotljWXaADfFmqxGgzbZy6lPhqSIf WnEuXRevC6rAmRM++4B0UwRY3jHENYA+XfXuswUb0eNkVutAMasYGn17dEb8NqDfprV7 J267rmWAZDb4M0IIisn2gKF3qhuzsp4YxCkXC2LB2O1a0wj4jmuDlbVWYSJVrog+HAHY UkvRsp80PyS0dsB4wsjx/vhA5VNNwbeUOhPjUTcWk6ZysVVSutgG4AcxE48v5C+sc4db 7BZO4nmnjYzFFYrPJWB1FKwfdMhbJhwdK/xsdv3jJd5l9H5rgw6qzHUnKGGdm09PhMRg j+2Q== 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=qlpLd5N5JiiEeLevQMwsCJPnigVJ1oAXpTh/PZIT/wibTPJzqDZM8ZBwGIXwtNa+vq O/DLLZpQB2FQgnSV9QtxM1ISnRHObTDXhB0WxvF/mA24KyjVAJgheJUtEQG0EvTKTi2e r/FcLcBZ8kq2pvr8+krIaog/tTOYTJYPgSE8qAnGm00QZMbi+0+0Mz0K/XuYc5wIys2h KnxTgQkr71y6Y/ySad/RVZ03R0DYmsLAndxRCtHN5Fec/g+Nkr/VUnApz0SZ51t5Cd6P WcknIt5B1VOLEox7gCgLyS6wAJ0Y8lWRO9n7OiHX3QR1bC4AU8VgWKjs8iHwUTzrrabt tsgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Vw6YFdmG; 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 l21-20020a170906645500b008b239eda129si13048047ejn.314.2023.03.07.09.01.52; Tue, 07 Mar 2023 09:02:18 -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=Vw6YFdmG; 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 S231138AbjCGQ7W (ORCPT + 99 others); Tue, 7 Mar 2023 11:59:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbjCGQ6I (ORCPT ); Tue, 7 Mar 2023 11:58:08 -0500 Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B65B893137; Tue, 7 Mar 2023 08:54:37 -0800 (PST) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 327GsXr7035079; Tue, 7 Mar 2023 10:54:33 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1678208073; bh=MjozjsM7oc2HrtgkTcGYDiESorMVaDXnh/A+VTPqizc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Vw6YFdmGzKxXPek7Eam0A8IyjM6Bio0bug4jr1z2ixBYY98q6APibUNXZwl2pWlqt uOfl4TTFs9y0dUP8TaJkJeKaJRhU4Z3LPrL+QNMtJCj5Bj2EM+emnzirXAmFC+aHfc JJVLadp1+PQEjk8PUWznh9JENcyPbfflP+yd2uOU= 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 327GsXQE000962 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 7 Mar 2023 10:54:33 -0600 Received: from DFLE108.ent.ti.com (10.64.6.29) 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 10:54:33 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE108.ent.ti.com (10.64.6.29) 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 10:54:33 -0600 Received: from ula0226330.dal.design.ti.com (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 327GsWdW084852; Tue, 7 Mar 2023 10:54:33 -0600 From: Andrew Davis To: Peter Tyser , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski CC: , , Andrew Davis Subject: [PATCH 5/6] gpio: tpic2810: Use devm_gpiochip_add_data() to simplify remove path Date: Tue, 7 Mar 2023 10:54:31 -0600 Message-ID: <20230307165432.25484-5-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307165432.25484-1-afd@ti.com> References: <20230307165432.25484-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?1759729196249491586?= X-GMAIL-MSGID: =?utf-8?q?1759729196249491586?= 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");