Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8ff1c7c authored by Fenglin Wu's avatar Fenglin Wu
Browse files

leds: qti-tri-led: Cancel set_brightness_work before setting breath



Currently, the driver uses brightness_set_blocking() which is called
asynchronously in the set_brightness_work of LED class device. It can
cause issues when multiple set_brightness() requests coming along with
breath_store() requests and if any of the set_brightness() requests
are blocked.

To overcome this, cancel set_brightness_work of LED class device
to make sure all the previous set_brightness() requests have been
served or cancelled before setting breath.

Change-Id: Ib9a8527867ab1adf2b034642f5efda72df30aea0
Signed-off-by: default avatarFenglin Wu <fenglinw@codeaurora.org>
parent 6fa1fd50
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-License-Identifier: GPL-2.0-only
/*
/*
 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 */
 */


#include <linux/bitops.h>
#include <linux/bitops.h>
@@ -371,6 +371,8 @@ static ssize_t breath_store(struct device *dev, struct device_attribute *attr,
	if (rc < 0)
	if (rc < 0)
		return rc;
		return rc;


	cancel_work_sync(&led_cdev->set_brightness_work);

	mutex_lock(&led->lock);
	mutex_lock(&led->lock);
	if (led->breathing == breath)
	if (led->breathing == breath)
		goto unlock;
		goto unlock;