From patchwork Mon Aug 17 15:12:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 266497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D126C433E3 for ; Mon, 17 Aug 2020 15:29:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 36EC323B5D for ; Mon, 17 Aug 2020 15:29:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597678189; bh=oX7lTzGgeXonwrNUvKojEuRglaFg/4flqmCnB8GgwlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=wrAoEM2GOK4KAZee5kibl+edhm6p5cGRXU8h4LjlbqxhyIsQHeEfh7f3j4wPfzSnL 44CKNFeFxb6oINUznPmIRnxBGotp+BsgjZVCGQUAvVifkW/IiJnN/5doEsSaGBarvb GatE7DoLe8UO1qJhctUOkrV9CF6SSEoqnBYD2pwE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729827AbgHQP3s (ORCPT ); Mon, 17 Aug 2020 11:29:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:49348 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729695AbgHQP3r (ORCPT ); Mon, 17 Aug 2020 11:29:47 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 025AF23BC7; Mon, 17 Aug 2020 15:29:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597678186; bh=oX7lTzGgeXonwrNUvKojEuRglaFg/4flqmCnB8GgwlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sofXjED3GGAUJlAwDzfLwuZhtwAMJ0IGLEKJGoxq+/rdWESjlKPkcHKLDuGIyeLRW KOYHCqQhgT7AjXtG39pX5vkOiYzFiwoPIG6b4zytSxHg4cmZV+93E3z6xodezwNh82 dnoMRt5nVTCNjlC7wUVp2CevPkU1AQ2NQ/+Mls+s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai-Heng Feng , Jacek Anaszewski , Pavel Machek , Sasha Levin Subject: [PATCH 5.8 220/464] leds: core: Flush scheduled work for system suspend Date: Mon, 17 Aug 2020 17:12:53 +0200 Message-Id: <20200817143844.342356105@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143833.737102804@linuxfoundation.org> References: <20200817143833.737102804@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kai-Heng Feng [ Upstream commit 302a085c20194bfa7df52e0fe684ee0c41da02e6 ] Sometimes LED won't be turned off by LED_CORE_SUSPENDRESUME flag upon system suspend. led_set_brightness_nopm() uses schedule_work() to set LED brightness. However, there's no guarantee that the scheduled work gets executed because no one flushes the work. So flush the scheduled work to make sure LED gets turned off. Signed-off-by: Kai-Heng Feng Acked-by: Jacek Anaszewski Fixes: 81fe8e5b73e3 ("leds: core: Add led_set_brightness_nosleep{nopm} functions") Signed-off-by: Pavel Machek Signed-off-by: Sasha Levin --- drivers/leds/led-class.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 3363a6551a708..cc3929f858b68 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -173,6 +173,7 @@ void led_classdev_suspend(struct led_classdev *led_cdev) { led_cdev->flags |= LED_SUSPENDED; led_set_brightness_nopm(led_cdev, 0); + flush_work(&led_cdev->set_brightness_work); } EXPORT_SYMBOL_GPL(led_classdev_suspend);