From patchwork Wed Oct 25 13:07:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Stark X-Patchwork-Id: 158073 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp2587084vqx; Wed, 25 Oct 2023 06:08:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHKZjzahZxTQKbAvM/AtnzpOhI/PWg+NVxQ7KocOCyvW293nieXxygbIP9SWNhlxRmAI8SZ X-Received: by 2002:a25:3489:0:b0:d7a:d716:233c with SMTP id b131-20020a253489000000b00d7ad716233cmr14377680yba.41.1698239309100; Wed, 25 Oct 2023 06:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698239309; cv=none; d=google.com; s=arc-20160816; b=xz9XyZD16koWwSxMmj2nhmHUrjOzUSQxi0C/A3haYPRKIZ1FrM/GxmqIKgHmLx2efK spqR/1uCDvSMvzZ5A8HP/bI5nbsvnZFQupK4M4frI/nGG8+jBH1orTyQaQmsL/yKpVZ+ rUxgOOA8Ui8WKzm/VUv/rg9rOBzBYMXSRjVhXn8PGpyAQZxBxbz83rMXEC0Cg192wEsI R/1Rah8biByAT/4UcB0Sr70oQ7/k3hcPNNk9dTqo6i4ewzec2KpVic1hiI7+tEHR5ySe 9LcssrV1S2THScRtQsfOHafPaHnnInLVnARYOcbNT0wp3Nn9HXUkBTiugiZYAL01chmm AfUg== 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:dkim-filter; bh=X7h6QnvXdm+wS50Idwxv0nNdXJ9bCTp96VnMyQNCCwg=; fh=TH/KyKkXF5LipyBG9stysnOYaFHGBRYytRmnm4H0CpA=; b=z174fAMZDH2FUIju8BPDlHwjWZGlsJUQ1udzd8U4UFV2PzCLlW5kISitJsJzM6303o WxwGqF5JQ76hhtNwu5l+uW5lwHSi3RPMueuxs7gUDOLwWgE6JEdpP0JPRbqshRg4g2J5 XqMLLbnjVkpGuSLz6TqWGX1wlij69uKAK+HXr9jnPmR4tMA9NmWTTg8m4zrNpRLAT04n 9PER2vKkpj2fDosE6jOJEqyCYfTICT4A6GGvO4UDIneskGWJ6kZQ+xSZIjgfj5eiqXmx idnx4sEcQMofQyhGMBYa8EBZ8RCgftAb4RUW3RNUcSSzhsC9ShonIwWihv2RDf15cHJ8 5fnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=ZZ1auFEM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=salutedevices.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id p20-20020a257414000000b00d9a3596a13csi10641796ybc.100.2023.10.25.06.08.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 06:08:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=ZZ1auFEM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=salutedevices.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 52FCF80202FB; Wed, 25 Oct 2023 06:08:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344370AbjJYNHz (ORCPT + 26 others); Wed, 25 Oct 2023 09:07:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233837AbjJYNHx (ORCPT ); Wed, 25 Oct 2023 09:07:53 -0400 Received: from mx1.sberdevices.ru (mx1.sberdevices.ru [37.18.73.165]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70D2F111; Wed, 25 Oct 2023 06:07:47 -0700 (PDT) Received: from p-infra-ksmg-sc-msk01 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id DF1B0100045; Wed, 25 Oct 2023 16:07:44 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru DF1B0100045 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salutedevices.com; s=mail; t=1698239264; bh=X7h6QnvXdm+wS50Idwxv0nNdXJ9bCTp96VnMyQNCCwg=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=ZZ1auFEMuagcIDSYOZM/p5o94oG1+t8GC7IJ14Leiu0ddlm09XDkHDT3TgDXNQ00q XOLfr/sfvTfSzhqe8LZwosH/6Q6VrYqXH/o2mZT/rnaUi51g0pdkx9oncCeHeFQFEz BgLrj2isnzciMZFHXWL+qQMrGstMnQnT0eG1B32GvApOH47JEHQnBvleUyUVan2XUH 6nkEpdI9Qx3KEYgpUqBIFtLZyeLS2fMReyNVPP5IwWgmkuediQZHa+k0s44PqvSGK4 2m4j3UQDR3nqY6WRjdqSM7W9+XAiRfoAdXRNgwbijhbg4sYDOWHznKjCAW7B0csw1z fXEjPXLAQDgOw== Received: from p-i-exch-sc-m01.sberdevices.ru (p-i-exch-sc-m01.sberdevices.ru [172.16.192.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Wed, 25 Oct 2023 16:07:44 +0300 (MSK) Received: from localhost.localdomain (100.64.160.123) by p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.37; Wed, 25 Oct 2023 16:07:44 +0300 From: George Stark To: , , , , , , CC: , , , Subject: [PATCH 3/8] leds: an30259a: explicitly unregister LEDs at module's shutdown Date: Wed, 25 Oct 2023 16:07:32 +0300 Message-ID: <20231025130737.2015468-4-gnstark@salutedevices.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231025130737.2015468-1-gnstark@salutedevices.com> References: <20231025130737.2015468-1-gnstark@salutedevices.com> MIME-Version: 1.0 X-Originating-IP: [100.64.160.123] X-ClientProxiedBy: p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) To p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 180883 [Oct 25 2023] X-KSMG-AntiSpam-Version: 6.0.0.2 X-KSMG-AntiSpam-Envelope-From: gnstark@salutedevices.com X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 543 543 1e3516af5cdd92079dfeb0e292c8747a62cb1ee4, {Tracking_from_domain_doesnt_match_to}, 127.0.0.199:7.1.2;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;100.64.160.123:7.1.2;p-i-exch-sc-m01.sberdevices.ru:7.1.1,5.0.1;salutedevices.com:7.1.1, FromAlignment: s, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean X-KSMG-LinksScanning: Clean X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2023/10/25 11:29:00 #22291710 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Wed, 25 Oct 2023 06:08:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780732981472267564 X-GMAIL-MSGID: 1780732981472267564 LEDs are registered using devm_led_classdev_register() and automatically unregistered after module's remove(). led_classdev_unregister() calls led_set_brightness() to turn off the LEDs and module's appropriate callback uses resources those were destroyed already in module's remove(). So explicitly unregister LEDs at module shutdown. Signed-off-by: George Stark --- drivers/leds/leds-an30259a.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/leds/leds-an30259a.c b/drivers/leds/leds-an30259a.c index 24b1041213c2..4209a407d802 100644 --- a/drivers/leds/leds-an30259a.c +++ b/drivers/leds/leds-an30259a.c @@ -324,6 +324,10 @@ static int an30259a_probe(struct i2c_client *client) static void an30259a_remove(struct i2c_client *client) { struct an30259a *chip = i2c_get_clientdata(client); + int i; + + for (i = 0; i < chip->num_leds; i++) + devm_led_classdev_unregister(&client->dev, &chip->leds[i].cdev); mutex_destroy(&chip->mutex); }