From patchwork Thu Aug 20 09:21:16 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: 265734 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, URIBL_BLOCKED, 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 64198C433DF for ; Thu, 20 Aug 2020 10:10:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 21A172075E for ; Thu, 20 Aug 2020 10:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597918245; bh=zYmbF1svz0vGuYuoBEP2HnGYbOrvKKytpnTgg51xvlQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=2eDJLCgdlqWppMJBuCrGrmnvRU1rsku6COzpnsJF27D5RtloPt0gTO3Ik7BlEdwID 7SKMcbP92yz3kjIaLC84DXZFbA3ZxHUZwjtsCqeuojL1Tvrjo0hR10DMfX0DFEmMLb rpm0d/iSk0lzfvrp9iRI7L4Insah/ETcAxfMeaOY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730152AbgHTKKo (ORCPT ); Thu, 20 Aug 2020 06:10:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:47620 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730912AbgHTKKj (ORCPT ); Thu, 20 Aug 2020 06:10:39 -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 74AA520724; Thu, 20 Aug 2020 10:10:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597918239; bh=zYmbF1svz0vGuYuoBEP2HnGYbOrvKKytpnTgg51xvlQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WUm2uiafpJ+6aB8FCCsq205j1iTaUYvAH9VyC9Y0d78SO+GrIf15+dTomD3CY+KN4 Qh1TESCCApxoTdAexo9gPyF/Qkv6ZzBbIMhF6HZv45eNxm3LiiPmWj2jUaky012m/W wRzAxzS6pZzdur5kNUaFW2/NzlU7bOROrcX9wrDY= 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 4.14 101/228] leds: core: Flush scheduled work for system suspend Date: Thu, 20 Aug 2020 11:21:16 +0200 Message-Id: <20200820091612.664431163@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091607.532711107@linuxfoundation.org> References: <20200820091607.532711107@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 b0e2d55acbd6f..6c7269fcfa77c 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);