From patchwork Mon May 15 17:45:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 94260 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp7096652vqo; Mon, 15 May 2023 11:00:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ76meCxLZ4TRwi8Lk5/aVCvuPsxORYXs/XrwbJMHzoJBrosgYzV7o5ALjaYKB434o1d3/6u X-Received: by 2002:a9d:76d4:0:b0:6a5:deae:f572 with SMTP id p20-20020a9d76d4000000b006a5deaef572mr10555316otl.32.1684173653634; Mon, 15 May 2023 11:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684173653; cv=none; d=google.com; s=arc-20160816; b=QaN+tAana7DzjJOR2EIZoq+LQZ/Q5TWUnWk643sjyfiv0sZhmiPFV3UL2jQg0VFoZh y9GBchMMLg9jtosjmWwD8KQtqrXFjKlFT0gBZRTbzWZkcgv7N1DjA++nfHEDWZu+nktC jz6IEwUT8NiStC9zJbDeljHTnl7B8cqvQ7J1M3Pd+wSw1gWYoBh0lCIYkN8uSxc6vfG7 ddpeNcoPOPtdKTZRD1UIrc3LtkrpO5FKWqWUK+8jc/lmp70vyTg8BRXfAFAiaNCl3xUI ZdBq76W7O3rsU9mGCa3sDHMhAud7jVRbKHrrLxehOanT4lKDTLuU4Nc1IkrCzWdSnqyp whBw== 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=V9tiruoX9ztjEFpmdpDyiAFpY7IRTPlA8j2mNpdmPkU=; b=e4n4vkC97hMPfDKiHTtpKmsCsDQ/qg/21EZ8fairvs7WNZYGYxHnm+ZsFAnzndnY55 oDT7czf++zmpMz5Hlbcx0wa6WCBZwBQ+VfN5KPqyLwBi5wo87zZf0skcVCestvBQAsT6 yI1JqvhAfvFcEpJltT2BFmEoV7WeZTeStg41J5HYi2BZdb/8UOdBeTzXDRft0I5jLT9N QG4Rcy9lUNe+SGPz9ydtMYyTCcUyx5cb+6Vhsj4wySdQGqAVOULdoePTAAx0ppU40b09 jzqSGBca6m4UVOFGXd9eqM/L/IxhVqoSdi74CbEnC7r43MZYuTqjuQsvcmdlnXuDZBqn V13Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=CYL4s58w; 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 dx20-20020a056830487400b006adc7cc1c55si2146119otb.117.2023.05.15.11.00.38; 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=CYL4s58w; 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 S244732AbjEORq5 (ORCPT + 99 others); Mon, 15 May 2023 13:46:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242536AbjEORqk (ORCPT ); Mon, 15 May 2023 13:46:40 -0400 Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92AAB16EBD; Mon, 15 May 2023 10:45:24 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 34FHjKHo009760; Mon, 15 May 2023 12:45:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1684172720; bh=V9tiruoX9ztjEFpmdpDyiAFpY7IRTPlA8j2mNpdmPkU=; h=From:To:CC:Subject:Date; b=CYL4s58w8JTFaCB/8ZtAFJ3BSdSPv2Wn5OQDk0q7SiC6GFJJ+t0d0A3YV3p+Qn4Qg oh6I+OwbPfC+ncW+FhY03wew/yPFTrT+r4FK3O//D37kog/87IJeH3RQlVIKNwMsWf GYA8agU5k9Js5Q7WUkyfQQ9FV+eF/UISvSc/9+J0= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 34FHjKpa121378 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 15 May 2023 12:45:20 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) 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.23; Mon, 15 May 2023 12:45:19 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE104.ent.ti.com (157.170.170.34) 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:45:19 -0500 Received: from lelv0326.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 34FHjJxR098698; Mon, 15 May 2023 12:45:19 -0500 From: Andrew Davis To: Peter Tyser , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski CC: , , Andrew Davis Subject: [PATCH v3] gpio: tps65086: Use devm_gpiochip_add_data() to simplify remove path Date: Mon, 15 May 2023 12:45:18 -0500 Message-ID: <20230515174518.494907-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?1765984072216020910?= X-GMAIL-MSGID: =?utf-8?q?1765984072216020910?= 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-tps65086.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/gpio/gpio-tps65086.c b/drivers/gpio/gpio-tps65086.c index 1e9d8262d0ff..8f5827554e1e 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 */ @@ -80,34 +80,16 @@ static const struct gpio_chip template_chip = { static int tps65086_gpio_probe(struct platform_device *pdev) { struct tps65086_gpio *gpio; - int ret; gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); 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); - if (ret < 0) { - dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret); - return ret; - } - - 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; + return devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio); } static const struct platform_device_id tps65086_gpio_id_table[] = { @@ -121,11 +103,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");