From patchwork Mon May 15 17:44:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 94259 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp7096616vqo; Mon, 15 May 2023 11:00:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5YSjN3dNrnHiIsLVEAhDpXigI28euhhLQB1DFgAd1qn5Gn9BheR1H34ja856AfPyPdhWe6 X-Received: by 2002:a05:6a00:189a:b0:646:7234:cbfc with SMTP id x26-20020a056a00189a00b006467234cbfcmr37772159pfh.27.1684173652656; Mon, 15 May 2023 11:00:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684173652; cv=none; d=google.com; s=arc-20160816; b=aC/mk1OpgW60XSbQoOzIB6HZWpZTnMv5KrpzOvY1ThtOTbILxkjJ9sdcT9KM1NuCjD isSS5Y9VmGe2pJHbXvxH3JI0GdtAWT6/22WnsTIMDRvSeaSm17pzaJwcQqGxVEjAedeq 0l7javE3VS650iqUVm9qLIsrV4BCIyR8LijRCAHZpeiJU09pQkC8+muNgMNNLFIA9sTg YBBcvZIthSY+r9/2mDApsLInc2YbptR8Xsy5/5ycgH/ROuXRNGKuCHlfwygoT19BKqXx mq6Xatw/0HBMNGuandYO6YRC8J0sm7AGfyd1SsDpLEzHmo7qWt7AjNelJmUa7bBbozOG 7elg== 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=oj7d3cRmVnICSKrHBOY8BVdU7GVxrr7m1scZoQUbyy4=; b=tk29T7lAO353iJBOIlrmQc8BHqIy1tMS3/4X1H6fsfvlCY8D53RnQTH7t+j4DPjZb9 xcySWiyY4KJr0U7HjJRAYb43VuSPPOKBe6Z4ToCV2yN0GL3/hgVp4Grh7XyFMPCxyz6X 5dh9MY/e7hP9b/e5j7STpkb9agBLxxZtwpHb+J2G4aQ52HmF1s2pcm6KTiqXUMgz1Jhz o7b/z2X1LO2Zd1ZwtQ+MONppzMT4FDNi/jP6UZ9goXb1+DTIFncI4bPcxwVSkhWIxl7M qxClEQFx/eIJ81YQ3Zghogyq+4eX3mKlP/bHF12jk2j5k8bC72fJu1gv9fCc5TR6aBtK NnhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=JxWT45Kp; 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 w5-20020aa79545000000b0063b652ff9cdsi17307529pfq.404.2023.05.15.11.00.34; Mon, 15 May 2023 11:00:52 -0700 (PDT) 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=JxWT45Kp; 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 S244674AbjEORq3 (ORCPT + 99 others); Mon, 15 May 2023 13:46:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244581AbjEORqJ (ORCPT ); Mon, 15 May 2023 13:46:09 -0400 Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3527110A02; Mon, 15 May 2023 10:44:14 -0700 (PDT) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 34FHiAxw009335; Mon, 15 May 2023 12:44:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1684172650; bh=oj7d3cRmVnICSKrHBOY8BVdU7GVxrr7m1scZoQUbyy4=; h=From:To:CC:Subject:Date; b=JxWT45KpEfhuKZ3RLwn8oYfIexStHs4G1GjwBhAhsAlueJesDQ0zpsvZ72Na6Zjsc tjwIFYj3XvpbDXoPg39jQsRcLRq/vHYW1krpnRaHeogP+jW++OozX9gxIdLKqscqBh JOAH8/nNiqI4M7bWau2+0xUYb+KJyoiAnjPss+MI= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 34FHiAcT095799 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 15 May 2023 12:44:10 -0500 Received: from DLEE103.ent.ti.com (157.170.170.33) 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.23; Mon, 15 May 2023 12:44:09 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE103.ent.ti.com (157.170.170.33) 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; Mon, 15 May 2023 12:44:09 -0500 Received: from fllv0040.itg.ti.com (ileaxei01-snat.itg.ti.com [10.180.69.5]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 34FHi9uj097394; Mon, 15 May 2023 12:44:09 -0500 From: Andrew Davis To: Peter Tyser , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski CC: , , Andrew Davis Subject: [PATCH v3] gpio: tpic2810: Use devm_gpiochip_add_data() to simplify remove path Date: Mon, 15 May 2023 12:44:08 -0500 Message-ID: <20230515174408.494811-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,T_SCC_BODY_TEXT_LINE 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?1765984072133918903?= X-GMAIL-MSGID: =?utf-8?q?1765984072133918903?= Use devm version of gpiochip add function to handle removal for us. While here update copyright and module author. Signed-off-by: Andrew Davis Reviewed-by: Linus Walleij --- Changes from v2: - Remove unused var "ret" drivers/gpio/gpio-tpic2810.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/drivers/gpio/gpio-tpic2810.c b/drivers/gpio/gpio-tpic2810.c index 349c5fbd9b02..642ed82b9de2 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 @@ -101,14 +101,11 @@ MODULE_DEVICE_TABLE(of, tpic2810_of_match_table); static int tpic2810_probe(struct i2c_client *client) { struct tpic2810 *gpio; - int ret; gpio = devm_kzalloc(&client->dev, sizeof(*gpio), GFP_KERNEL); if (!gpio) return -ENOMEM; - i2c_set_clientdata(client, gpio); - gpio->chip = template_chip; gpio->chip.parent = &client->dev; @@ -116,20 +113,7 @@ static int tpic2810_probe(struct i2c_client *client) mutex_init(&gpio->lock); - ret = gpiochip_add_data(&gpio->chip, gpio); - if (ret < 0) { - dev_err(&client->dev, "Unable to register gpiochip\n"); - return ret; - } - - return 0; -} - -static void tpic2810_remove(struct i2c_client *client) -{ - struct tpic2810 *gpio = i2c_get_clientdata(client); - - gpiochip_remove(&gpio->chip); + return devm_gpiochip_add_data(&client->dev, &gpio->chip, gpio); } static const struct i2c_device_id tpic2810_id_table[] = { @@ -144,11 +128,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");