From patchwork Tue Mar 7 16:54:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 65726 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2542915wrd; Tue, 7 Mar 2023 09:02:24 -0800 (PST) X-Google-Smtp-Source: AK7set/lrmSlVTIrZSMcP/si9lTNUdHGqUa43rxJci72AIKcfax6X2ajb8nKsZQmqevPC7Rmo6Ok X-Received: by 2002:a17:906:1c0a:b0:8b1:79ce:a629 with SMTP id k10-20020a1709061c0a00b008b179cea629mr15244223ejg.18.1678208543868; Tue, 07 Mar 2023 09:02:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678208543; cv=none; d=google.com; s=arc-20160816; b=IdQTjaaFMLRwlZkSL4JApj8JG2BlK1AVQ7B3EuO2PfuZ74/LxVj5HrBNdAKOVxQVpA qHYLyC7lFU9k5HOp3x1muY4HBoYoB3gwDZdc49JRJ9Ea1FBYgt+wi4N3EHKlW/ceDzIG TPkdHxqG0DTsAT4ZZwvfkZt0rS22I1BbQzLMv7fUg2APCG7XXIP3nNFdQTUCd2ZL+6ox FwY86sLqJwekV6QzNx112O8vWN1FCKodmOFDt/67WdzOLpG1w2/rjpfStU3fS+qjl8qZ 03NpsoHTIYvlHRCW2yAzBwEzRuNua/7lqqB9nw3VVSjWe6mxa6M4OLBR8Upkl77e8hv6 29Cw== 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=3mZeuBv+KHlgKSK9toGY2kGnCo4J2rlgKrh4etaAP9w=; b=nvldmq792JY+T1D1LaKrG9adB4tngbMoGsrZ11dZyaNNiHifD4oZpgwU0P1nRX5tlu 7hheM+oxqTJ79NIGAacC80mKFtoCSwBTklz0Ntdxg5QKGfJfcMhMYZfXpBnx69CLh3tE cf/AVNBwD1OexrFb8dpO6PBaudv6nZqVtnwbidn1m8np4MMQ/ItYgSSbor852ukBH7fQ VCGNjUhabkRmBvvYLxb7QMxNMKi/rJ89bMLIJuMIIE4J1UnR/kwRafL0o5VjAwdTD+jw JW+yN7bnmBHRJNWwFbB7w8S0QnyqDCPOy4XIsgIb0ezTeuTMrE8f3tevnISgEq4h/yfb qukA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=X4aeWevl; 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 b17-20020a170906491100b008e6a5c547d1si12713589ejq.125.2023.03.07.09.01.58; Tue, 07 Mar 2023 09:02:23 -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=X4aeWevl; 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 S229754AbjCGQ73 (ORCPT + 99 others); Tue, 7 Mar 2023 11:59:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230336AbjCGQ6J (ORCPT ); Tue, 7 Mar 2023 11:58:09 -0500 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 501003B3E5; Tue, 7 Mar 2023 08:54:40 -0800 (PST) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 327GsXlq094197; 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=3mZeuBv+KHlgKSK9toGY2kGnCo4J2rlgKrh4etaAP9w=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=X4aeWevlBO7RlsEr5p49WIa3wpXbbNk0jO7hvB1+PxBKanKH+6RX6hehV07REPRNj Njsp5ZggNpBekbJtN1nk7IrrRwMalehS1q/AeH2PMligrDxq7Qyo+NGDy0rUCK5lS6 /wa8oItGQseKp3JdD1qlETgTdaWI6H8tU0Aozb2k= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 327GsXka052512 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 7 Mar 2023 10:54:33 -0600 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE109.ent.ti.com (157.170.170.41) 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 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 10:54:32 -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 327GsWdV084852; Tue, 7 Mar 2023 10:54:32 -0600 From: Andrew Davis To: Peter Tyser , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski CC: , , Andrew Davis Subject: [PATCH 4/6] gpio: pisosr: Use devm_gpiochip_add_data() to simplify remove path Date: Tue, 7 Mar 2023 10:54:30 -0600 Message-ID: <20230307165432.25484-4-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?1759729202372706788?= X-GMAIL-MSGID: =?utf-8?q?1759729202372706788?= 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-pisosr.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/gpio/gpio-pisosr.c b/drivers/gpio/gpio-pisosr.c index 67071bea08c2..eaf65606035d 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 @@ -126,8 +126,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); @@ -146,7 +144,7 @@ static int pisosr_gpio_probe(struct spi_device *spi) mutex_init(&gpio->lock); - 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 +153,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 +171,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");