Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp147245rdb; Thu, 16 Nov 2023 14:41:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IHdcrjM0G0MRbCpSjB/3ph/PxxfKVgcNxQbfXSsyK5ZpWIC4RMVJZYgURWhqL13OjAhBdXA X-Received: by 2002:a05:6a00:10c8:b0:690:fe13:1d28 with SMTP id d8-20020a056a0010c800b00690fe131d28mr20823440pfu.33.1700174513999; Thu, 16 Nov 2023 14:41:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700174513; cv=none; d=google.com; s=arc-20160816; b=IwfUbLD0HJdePbYykz+jdgfFRynaoHnTdY+eTk7rghO8rk6TbB6nPIRQc0lPza4tqM Rb4dIvcCD3yR61xqbgq+ghqJmE/oh+mekjA8jfyucuatqxqRzeoTJlhG8t8LNf7nHgIW x9fQ3r8rzDk5tKEAChuqyviveUIPMa33UBVVyUvvErYBBBnd8Ir4cfLIz0AZyeHso9kF 58597d5DUTRG5HKDKnD9A3ArAaU2RjibhkuccRCmLWBW6c1DH4x7l4clqaVB138B4saU TJFEE2O6FmlFuNzKYPdNqkRsAZaxLU2Wiiwg05N3Tzz2T+fwjlnWME0yrLw+pw2963NH MDQQ== 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=4thN27hHqejhmVMCyJ7ddgFMYernFuj5amqf/33WzVk=; fh=oB09tO5xRJdmoiiENPAgMkAsOtUEDUy/ab4GLLy7mqU=; b=mzb3gRxSQGMpIpu8h6tb9emyT6legb5Z7fQnfmPDhdweFinvMs8Y25Wga3LrmLIeWx fDA3naoQshv5uTi474jVXftFAQS3pNGa5ERm8Vmd8e6v68VT3jvnj6FdnDpFIlwS96C9 u0y2NYLo1BSZUEtlrZdO7trq1cpN5RgcYIfJ/F5aN8iigsJyOVH8P90o8ZfGGQCDtffr tJgx0vDgBA5iKEN45n9/hgQ0LC8OjkDztCKmUyNksQFRX3i4GHRxh9yaYNK4DTEetp3i x3gHPrOBhxSG9b/GVkXlpGY8e/g6LMuzmvZ6FqTPSELoaN7AffhrHizKvGPMh5r66+Ej Oyug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=PmOJMRQR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id k9-20020aa79d09000000b006be04dec663si461452pfp.311.2023.11.16.14.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 14:41:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=PmOJMRQR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 58EB3803FCC8; Thu, 16 Nov 2023 14:41:51 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229787AbjKPWle (ORCPT + 99 others); Thu, 16 Nov 2023 17:41:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229745AbjKPWld (ORCPT ); Thu, 16 Nov 2023 17:41:33 -0500 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F883130; Thu, 16 Nov 2023 14:41:30 -0800 (PST) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3AGMfNnH025370; Thu, 16 Nov 2023 16:41:23 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1700174483; bh=4thN27hHqejhmVMCyJ7ddgFMYernFuj5amqf/33WzVk=; h=From:To:CC:Subject:Date; b=PmOJMRQRTOv4KZnchBRD2bkWIebguHeQj+d91ERCq4mT925dyH+WgPG3iJ/H+9R26 GPGz5JALVYYNIxiCz2W5r3iZpGGsMWnlgDDzdHQjgp9JhVpsyIV7oQmDo9tdXbFpmt 1rghKIwHvSAb7ua51NhYLgjcTnTWrijGTX5T0mrE= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3AGMfNR9128084 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 16 Nov 2023 16:41:23 -0600 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE114.ent.ti.com (10.64.6.35) 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:41:23 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE106.ent.ti.com (10.64.6.27) 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:41:23 -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 3AGMfMAW002939; Thu, 16 Nov 2023 16:41:23 -0600 From: Andrew Davis To: Pavel Machek , Lee Jones CC: , , Andrew Davis Subject: [PATCH 1/2] leds: tca6507: Use devm_gpiochip_add_data() to simplify remove path Date: Thu, 16 Nov 2023 16:41:20 -0600 Message-ID: <20231116224121.302150-1-afd@ti.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 16 Nov 2023 14:41:51 -0800 (PST) Use devm version of gpiochip add function to handle removal for us. Signed-off-by: Andrew Davis --- drivers/leds/leds-tca6507.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/leds/leds-tca6507.c b/drivers/leds/leds-tca6507.c index e190746140959..9a6af6d8b5b5d 100644 --- a/drivers/leds/leds-tca6507.c +++ b/drivers/leds/leds-tca6507.c @@ -638,19 +638,13 @@ static int tca6507_probe_gpios(struct device *dev, tca->gpio.direction_output = tca6507_gpio_direction_output; tca->gpio.set = tca6507_gpio_set_value; tca->gpio.parent = dev; - err = gpiochip_add_data(&tca->gpio, tca); + err = devm_gpiochip_add_data(dev, &tca->gpio, tca); if (err) { tca->gpio.ngpio = 0; return err; } return 0; } - -static void tca6507_remove_gpio(struct tca6507_chip *tca) -{ - if (tca->gpio.ngpio) - gpiochip_remove(&tca->gpio); -} #else /* CONFIG_GPIOLIB */ static int tca6507_probe_gpios(struct device *dev, struct tca6507_chip *tca, @@ -658,9 +652,6 @@ static int tca6507_probe_gpios(struct device *dev, { return 0; } -static void tca6507_remove_gpio(struct tca6507_chip *tca) -{ -} #endif /* CONFIG_GPIOLIB */ static struct tca6507_platform_data * @@ -793,7 +784,6 @@ static void tca6507_remove(struct i2c_client *client) if (tca_leds[i].led_cdev.name) led_classdev_unregister(&tca_leds[i].led_cdev); } - tca6507_remove_gpio(tca); cancel_work_sync(&tca->work); } -- 2.39.2