Received: by 2002:ab2:5c0e:0:b0:1ef:a325:1205 with SMTP id i14csp250802lqk; Thu, 14 Mar 2024 01:54:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVKNCIfJTETexDp9o89v9yPH1H38eewqz1/4JdBhUisbP15K8vFGYSAL2CqW6AyPQQM6COssUff+VV2E7i68fu6SsIqCdyLs6YU4TLXwg== X-Google-Smtp-Source: AGHT+IEjgXTlM9QNxhKr8z2PZzxc0uErf3mJmh4s3kN60irgadKLwIF0OG6Ghd2ZqCbf3u4QNV2m X-Received: by 2002:a05:6a00:4f96:b0:6e6:9a11:ccec with SMTP id ld22-20020a056a004f9600b006e69a11ccecmr1307111pfb.17.1710406450335; Thu, 14 Mar 2024 01:54:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710406450; cv=pass; d=google.com; s=arc-20160816; b=sh/wq0s3fJA4bw4wSmkSANHfQK3Yzuq/IwcVqlpGscZtvlr/lZgu2+k1XrtvbZGO0o Riz5IxsknL4gRb5bcSWkU6SUfVw1Zlw5IgjO49bG15H+iqw3kXqQxvMKpMY0QcMHu8Pk ESICtwW5TXdKCcY5VcxZccFdU0I2O3IPI8ZI/RxsBdF8DadA/LG2QagKDzuw4XJJw3sn U1VCgigznnAyqZb/1N07yQJaN4qCfO8mODG0ku5eoc/S5pF8mEXFb77cZ5a/4l8Kfv7y tc54CAAniLDqS5j4j9m1fabJNnho87f8xT87vS0a6Qt5ClOYJuJf1nFPaXRMCK5gB5Z1 x6eg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter; bh=kK6WfysHnoHnPx6m7g6/YcvxmY15e9MkbOzMlx2Ecms=; fh=s1kWXXOKODOg8bNscCzUOYq9ohPIXtgB+6qODgig4jg=; b=ZSTjZzoTjJaQfD3pRqzoJJAaKkEhDRtZyF4rJsFYBir4yGV+I3yOqYXFbn9628DYf7 Okz7i9nyX12jHmcK1piuGHZYTdKC8qrtfkKaqFhrZekShop7iOgDak9MisZMhYDh+x4z ZPCy2iSvwikqiyefbsA4+KBUrwSOlUNFVD3eXdI/JotKhP0Np6vD18Yg+CrNdTrgGgfZ iGNPSjOA5KTdEmJzLPK9mDyIZSTD6fzKMjqhy+ktllPjPrO0N4Z+edHEp8hvKfnuMOmE CNOW3qOzDgrQWH90Fd5tb9qPVkQYg81+GMVBkeDDySFd0agz3+A0iogaobcIV+7R3Xwi vzGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=FVYF3nyJ; arc=pass (i=1 spf=pass spfdomain=salutedevices.com dkim=pass dkdomain=salutedevices.com dmarc=pass fromdomain=salutedevices.com); spf=pass (google.com: domain of linux-kernel+bounces-102998-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102998-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=salutedevices.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id y19-20020a634953000000b005c600ffa335si167161pgk.217.2024.03.14.01.54.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 01:54:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102998-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=FVYF3nyJ; arc=pass (i=1 spf=pass spfdomain=salutedevices.com dkim=pass dkdomain=salutedevices.com dmarc=pass fromdomain=salutedevices.com); spf=pass (google.com: domain of linux-kernel+bounces-102998-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102998-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=salutedevices.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 33FA2B25149 for ; Thu, 14 Mar 2024 08:48:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 376736EB55; Thu, 14 Mar 2024 08:46:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=salutedevices.com header.i=@salutedevices.com header.b="FVYF3nyJ" Received: from mx1.sberdevices.ru (mx2.sberdevices.ru [45.89.224.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B2FD6BB46; Thu, 14 Mar 2024 08:46:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.89.224.132 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710405985; cv=none; b=T1jR1GMlFjDBewblNg0DvE0LBM/JhlptkxFU1eognE0XjQbEq/oP0LK3ju3K3Qf7F/aiCTLgo5yIO+YgCc/0WD0O9CEgIugV2RLeVVMsBemQn5z0Efau08GlB6fwaF5ee8J6QdfnSCs61J9dbzR1VI0gzHYr/nVI/9kNd9EUhjw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710405985; c=relaxed/simple; bh=vUFUEsCwm/+WnjI8Fz9CnNUsoSwU+TtLeBEcKA5W7mk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bf8Od1wncmEPY20zAtbggmhaTfawIIxevDirUR97AZ9SrQvpY3EK5IoT7n00mY5ZGQ9E9fpJ/m/+cRnqPqinN/HsasCT7n7swVsMMi4/UKdJJL6/m0ml504iZz8RyA8qroZq1iyMZoSWpvhChikJdvfr306gg6yYZejQokMS6SE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=salutedevices.com; spf=pass smtp.mailfrom=salutedevices.com; dkim=pass (2048-bit key) header.d=salutedevices.com header.i=@salutedevices.com header.b=FVYF3nyJ; arc=none smtp.client-ip=45.89.224.132 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=salutedevices.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=salutedevices.com Received: from p-infra-ksmg-sc-msk02 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id B4321120017; Thu, 14 Mar 2024 11:46:15 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru B4321120017 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salutedevices.com; s=mail; t=1710405975; bh=kK6WfysHnoHnPx6m7g6/YcvxmY15e9MkbOzMlx2Ecms=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=FVYF3nyJFVV8nqcHI1kM0ThJpq2TvXKVhERwcShPVUnyXw85/EPQPFF6AusH6DKjN Y6lu3+hVjI+RjS7nMswAQKVWxvkYBJfI+CyQuB+Dm4OhkKHA7/AdfoszjABQEEEt8R 8kDHRNB/XWd/IUgzh2eX0bUj+bqWftT0RNRJONNnhvUBvtlaudDEIA8XOKD3gDjlwL WGghUGf22kf4Np1AVi3Dbh277kn2fVQqKgzkx/v27iTeV0IIwmtexOXcMe4XhuGXif FjmDWeNiBbv0Y/f6g3A/plsdI5o+NoHlq/TBWABhL67QN/5foA3w5imRuCQhPrcEYs SQ12W1jYMvucg== Received: from smtp.sberdevices.ru (p-i-exch-sc-m02.sberdevices.ru [172.16.192.103]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Thu, 14 Mar 2024 11:46:15 +0300 (MSK) Received: from localhost.localdomain (100.64.160.123) by p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Thu, 14 Mar 2024 11:46:15 +0300 From: George Stark To: , , , , , , , , , , , , , , , , CC: , , , , George Stark Subject: [PATCH v6 9/9] leds: powernv: use LED_RETAIN_AT_SHUTDOWN flag for leds Date: Thu, 14 Mar 2024 11:45:31 +0300 Message-ID: <20240314084531.1935545-10-gnstark@salutedevices.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240314084531.1935545-1-gnstark@salutedevices.com> References: <20240314084531.1935545-1-gnstark@salutedevices.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) To p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 183875 [Feb 29 2024] X-KSMG-AntiSpam-Version: 6.1.0.3 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: 7 0.3.7 6d6bf5bd8eea7373134f756a2fd73e9456bb7d1a, {Tracking_from_domain_doesnt_match_to}, 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: 2024/02/29 19:21:00 #23899999 X-KSMG-AntiVirus-Status: Clean, skipped This driver wants to keep its LEDs state after module is removed and implemented it in its own way. LED subsystem supports dedicated flag LED_RETAIN_AT_SHUTDOWN for the same purpose so use the flag instead of custom implementation. Signed-off-by: George Stark --- drivers/leds/leds-powernv.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/leds/leds-powernv.c b/drivers/leds/leds-powernv.c index 4f01acb75727..9c6fb7d6e0e7 100644 --- a/drivers/leds/leds-powernv.c +++ b/drivers/leds/leds-powernv.c @@ -30,15 +30,6 @@ static const struct led_type_map led_type_map[] = { }; struct powernv_led_common { - /* - * By default unload path resets all the LEDs. But on PowerNV - * platform we want to retain LED state across reboot as these - * are controlled by firmware. Also service processor can modify - * the LEDs independent of OS. Hence avoid resetting LEDs in - * unload path. - */ - bool led_disabled; - /* Max supported LED type */ __be64 max_led_type; @@ -178,10 +169,6 @@ static int powernv_brightness_set(struct led_classdev *led_cdev, struct powernv_led_common *powernv_led_common = powernv_led->common; int rc; - /* Do not modify LED in unload path */ - if (powernv_led_common->led_disabled) - return 0; - mutex_lock(&powernv_led_common->lock); rc = powernv_led_set(powernv_led, value); mutex_unlock(&powernv_led_common->lock); @@ -225,6 +212,14 @@ static int powernv_led_create(struct device *dev, powernv_led->cdev.brightness_set_blocking = powernv_brightness_set; powernv_led->cdev.brightness_get = powernv_brightness_get; + /* + * By default unload path resets all the LEDs. But on PowerNV + * platform we want to retain LED state across reboot as these + * are controlled by firmware. Also service processor can modify + * the LEDs independent of OS. Hence avoid resetting LEDs in + * unload path. + */ + powernv_led->cdev.flags = LED_RETAIN_AT_SHUTDOWN; powernv_led->cdev.brightness = LED_OFF; powernv_led->cdev.max_brightness = LED_FULL; @@ -313,9 +308,7 @@ static void powernv_led_remove(struct platform_device *pdev) { struct powernv_led_common *powernv_led_common; - /* Disable LED operation */ powernv_led_common = platform_get_drvdata(pdev); - powernv_led_common->led_disabled = true; /* Destroy lock */ mutex_destroy(&powernv_led_common->lock); -- 2.25.1