Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2653883pxa; Mon, 17 Aug 2020 15:36:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoQceJGCoCIzx8YRb9gKjxt3ed2dEu3MnrOI1vTG9fVuLuJLAuotYjvfo/qvVsurpDKnMr X-Received: by 2002:a05:6402:1e5:: with SMTP id i5mr16603421edy.194.1597703805677; Mon, 17 Aug 2020 15:36:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597703805; cv=none; d=google.com; s=arc-20160816; b=Vq4B143LLr5VfxuWWSVHT1UK02Ul0fZUZ5T9Zipf52S/E7tS2uD4n+4m1KGrLLz8hf btf5P6dzCxZpaIOP6x/AFp95uyuRoVwvxmFFELcftZSHk5eSzrSwXJN5b9hbOhi2DQT/ jE9b4t+oU4IELlsDxAyzP1BqeSGr1mku2n+gLGdrrgJrY5aVLdKz5QZzK8O7Xn8aiYSo THGhUpsUO6zBXztT/K38iI2AA2G1h3WsrB6/PsNC1TrRFjw+iA4BdxE684lDLQa7X2B6 zBuiOjYMFI1dB+YzL8DnS8lh7qSI/XgHkWtISsJU+kBEqf/rYETnH8xN+9N3XjCF30mF vRyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gKfqFZqgq5N4NM4UBjHq9ib5m2CTRrUXZ2yRm33Og9U=; b=nKZqw9Df4FGucm9fVWgJ1/tEkv9g4CgJjpLO+hcgPiIYXRzL9SOVuiJ5rqYMerDWGw ezEdzuObVF1utdeuTqGf42g8DtwmYw/7ErkDvYnzeFhVP09OLGfBhr+lOUHZWMw102cr j/bPUM8E++pmpiHcWxygJLkbqIgZnibvINqvt/zLKcgRHMbSohMEcoFp5qkTKJ28EvQ7 iEykJHQKIwebd3Ls8uWnv5z7D4HE9E6S6yNYI1MEKUOUnyy2Kar1FScy/WJV+/VQRieY s3qgkOJE2s05Sf6JSs5YKO7RnVn/6QqonKyzVBMOu2yimWeqKnSmRU7/yUswuQeOirHQ Brvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q10emzGF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qw24si11866020ejb.416.2020.08.17.15.36.22; Mon, 17 Aug 2020 15:36:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q10emzGF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389199AbgHQRQm (ORCPT + 99 others); Mon, 17 Aug 2020 13:16:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:48602 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388774AbgHQQOK (ORCPT ); Mon, 17 Aug 2020 12:14:10 -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 665D320772; Mon, 17 Aug 2020 16:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680840; bh=4l7MNG17BMIzhPTKb3rZXjSglBEavRFY51CPupNXRxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q10emzGFaiQzDVSZ3KuZLN2GsV0F/dbY7ACgFLRNEGuK9hq5GFfw8TwJeA0PLKchW 9YZgjKqIyY8xmlizvOxCKnKNwkNlgOinAs+A4mdxq8z+7hhqk5jr+E/+GBfikHR6Qa gqueq+WrE4wpanOyKMPgVu5Ducu5PSz6tcRNKg+E= 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.19 079/168] leds: core: Flush scheduled work for system suspend Date: Mon, 17 Aug 2020 17:16:50 +0200 Message-Id: <20200817143737.649338980@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143733.692105228@linuxfoundation.org> References: <20200817143733.692105228@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 3c7e3487b373b..4e63dd2bfcf87 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); -- 2.25.1