Message ID | 20231025130737.2015468-2-gnstark@salutedevices.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp2586962vqx; Wed, 25 Oct 2023 06:08:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHt1liOg5cm6G7F/Ghe+RDSSr3m/R43eMtSt9vluokODTu5PvrcIWb3bZVsXFzap+t9LLkj X-Received: by 2002:a5b:710:0:b0:da0:514a:8f42 with SMTP id g16-20020a5b0710000000b00da0514a8f42mr4421711ybq.32.1698239301013; Wed, 25 Oct 2023 06:08:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698239300; cv=none; d=google.com; s=arc-20160816; b=tC+vc85YU0rPmQdIdnorPqKZ90hIfWl5KvY1baLPIcrPSorLg+Nn5bvmi1HjH2CdG3 4/qtLQR744pzciHNJ192rIXLr7mOppII3FRCC84sr9CJvvtj2Q46bMbA1B07uuMax2x3 m2EpTyg7wSGgbH2Y88Qyp/qq4+WAZpaA2kozo6UlAAO/cR0bJZsO2WPOe5+Ta68K3EwB gWWiLNuufbn2K/LoeGsUp8+rLn6BXaeWYeNu3egEa07mT/9vNmzXJpD0d2J4XTaPk6mC B0I94y4ZysstJaAdMcasqAZ8JeoDsbTf64TZ+8xMbPXxnPAWLvnViMXDkkwIjLEobe4r gUEg== 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=QI0eEMit4cRAk0dzmRcmJgiC5EDe0H7Kqy7+mSGTVrU=; fh=TH/KyKkXF5LipyBG9stysnOYaFHGBRYytRmnm4H0CpA=; b=IEqq/ot5lKPEERnyBR3DNcHz5XEpwdODNIt07Ae9JquJuSBmhyGVKcWaSvitTjM5ws 2MaYaMCkF3aCFf0R3UnYnNdEtGSHvKCj/UOGJSrrX6PYKnEB9shqesfFAtRHvLipfkks V2/S/WtuzQAtNsFWBED5Mw6l8Qwlf1B2Wt4EW0eQQtCtPZAWcbtivgxXnzlGeoNQaQ5K FGGTYt5EDW8YUEsBWtrtTC3LHI25HX8V5cgFY5bFoiMJzXluXn2vdUKXfsZ4sLNjiEF+ CFQOTiFFLf+WY4E8V5VGAvTbpCn52+bzmn9DavpHfyyxgqr4Q5XluRZid7qqxFCo4vqf E4rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=EmYuRvSh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id x67-20020a25a049000000b00d800da62efcsi10728350ybh.63.2023.10.25.06.08.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 06:08:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=EmYuRvSh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id D508B80FA9C6; Wed, 25 Oct 2023 06:08:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234963AbjJYNIC (ORCPT <rfc822;aposhian.dev@gmail.com> + 26 others); Wed, 25 Oct 2023 09:08:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234926AbjJYNHx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); 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 0B5BC130; Wed, 25 Oct 2023 06:07:48 -0700 (PDT) Received: from p-infra-ksmg-sc-msk01 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id 8E872100043; Wed, 25 Oct 2023 16:07:44 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru 8E872100043 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salutedevices.com; s=mail; t=1698239264; bh=QI0eEMit4cRAk0dzmRcmJgiC5EDe0H7Kqy7+mSGTVrU=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=EmYuRvSh8MROTQg+CWmVIV3ikaw4wqLxA7YespJ51Vt90wv4OJBBVdF+A5bM2O+Ba xt2+No1w8iIhvvbU5n2TEQAIQYAcJMnAhYhjOx9JLMTz+KvRmWNDTkFhsIVeHS15FX kFcvkjVZyJdhPO7MLDC+1DlRcdY/ab9UH9b07OjAxJzT7FcihnWqKC7njeuiOZiu0s dGG9otRgt3xpTKhii8rk7Hf5c2WpFtWR7RloZynI1NYjVRB0QniDtYs6JssC4m75SN DP+ROqDLgC3vJW3qJrzHnHAvhngpAEgcn8eKIZ5x08gylzWBzvkkVv713uOWrfqwHr Z1G9FXd3eeORw== 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 <gnstark@salutedevices.com> To: <pavel@ucw.cz>, <lee@kernel.org>, <vadimp@nvidia.com>, <mpe@ellerman.id.au>, <npiggin@gmail.com>, <christophe.leroy@csgroup.eu>, <gnstark@salutedevices.com> CC: <linux-leds@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linuxppc-dev@lists.ozlabs.org>, <kernel@sberdevices.ru> Subject: [PATCH 1/8] leds: powernv: explicitly unregister LEDs at module's shutdown Date: Wed, 25 Oct 2023 16:07:30 +0300 Message-ID: <20231025130737.2015468-2-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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 25 Oct 2023 06:08:08 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780732973036905392 X-GMAIL-MSGID: 1780732973036905392 |
Series |
devm_led_classdev_register() usage problem
|
|
Commit Message
George Stark
Oct. 25, 2023, 1:07 p.m. UTC
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 <gnstark@salutedevices.com>
---
drivers/leds/leds-powernv.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/leds/leds-powernv.c b/drivers/leds/leds-powernv.c index 743e2cdd0891..7c7f696c8265 100644 --- a/drivers/leds/leds-powernv.c +++ b/drivers/leds/leds-powernv.c @@ -302,7 +302,12 @@ static int powernv_led_probe(struct platform_device *pdev) platform_set_drvdata(pdev, powernv_led_common); + if (!devres_open_group(&pdev->dev, priv, GFP_KERNEL)) + return -ENOMEM; + rc = powernv_led_classdev(pdev, led_node, powernv_led_common); + if (rc) + devres_remove_group(dev, priv); out: of_node_put(led_node); return rc; @@ -313,6 +318,8 @@ static int powernv_led_remove(struct platform_device *pdev) { struct powernv_led_common *powernv_led_common; + devres_release_group(&pdev->dev, powernv_led_common); + /* Disable LED operation */ powernv_led_common = platform_get_drvdata(pdev); powernv_led_common->led_disabled = true;