linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Luka Kovacic <luka.kovacic@sartura.hr>
Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-leds@vger.kernel.org,
	lee.jones@linaro.org, dmurphy@ti.com, robh+dt@kernel.org,
	jdelvare@suse.com, linux@roeck-us.net, andrew@lunn.ch,
	jason@lakedaemon.net, gregory.clement@bootlin.com,
	marek.behun@nic.cz, luka.perkov@sartura.hr,
	robert.marko@sartura.hr
Subject: Re: [PATCH v3 4/7] drivers: leds: Add the iEi WT61P803 PUZZLE LED driver
Date: Wed, 30 Sep 2020 21:48:00 +0200	[thread overview]
Message-ID: <20200930194759.GA24378@amd> (raw)
In-Reply-To: <20200930014058.44460-5-luka.kovacic@sartura.hr>

[-- Attachment #1: Type: text/plain, Size: 1291 bytes --]

Hi!

> +static int iei_wt61p803_puzzle_led_brightness_set_blocking(struct led_classdev *cdev,
> +		enum led_brightness brightness)
> +{
> +	struct iei_wt61p803_puzzle_led *priv = cdev_to_iei_wt61p803_puzzle_led(cdev);
> +	unsigned char *resp_buf = priv->response_buffer;
> +	unsigned char led_power_cmd[5] = {
> +		IEI_WT61P803_PUZZLE_CMD_HEADER_START,
> +		IEI_WT61P803_PUZZLE_CMD_LED,
> +		IEI_WT61P803_PUZZLE_CMD_LED_POWER,
> +		(char)IEI_LED_OFF
> +	};
> +	size_t reply_size;
> +
> +	mutex_lock(&priv->lock);
> +	if (brightness == LED_OFF) {
> +		led_power_cmd[3] = (char)IEI_LED_OFF;
> +		priv->led_power_state = LED_OFF;
> +	} else {
> +		led_power_cmd[3] = (char)IEI_LED_ON;
> +		priv->led_power_state = LED_ON;
> +	}
> +	mutex_unlock(&priv->lock);
> +
> +	return iei_wt61p803_puzzle_write_command(priv->mcu, led_power_cmd,
> +			sizeof(led_power_cmd), resp_buf, &reply_size);
> +}

Is the mutex needed? If so, should it include the
iei_wt61p803_puzzle_write_command()? Does
iei_wt61p803_puzzle_write_command() have internal locking to prevent
two messages from being mingled?

Best regards,
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  reply	other threads:[~2020-09-30 19:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-30  1:40 [PATCH v3 0/7] Add support for the iEi Puzzle-M801 board Luka Kovacic
2020-09-30  1:40 ` [PATCH v3 1/7] dt-bindings: Add iEi vendor prefix and iEi WT61P803 PUZZLE driver bindings Luka Kovacic
2020-09-30  1:40 ` [PATCH v3 2/7] drivers: mfd: Add a driver for iEi WT61P803 PUZZLE MCU Luka Kovacic
2020-09-30  8:40   ` kernel test robot
2020-09-30  1:40 ` [PATCH v3 3/7] drivers: hwmon: Add the iEi WT61P803 PUZZLE HWMON driver Luka Kovacic
2020-09-30  1:40 ` [PATCH v3 4/7] drivers: leds: Add the iEi WT61P803 PUZZLE LED driver Luka Kovacic
2020-09-30 19:48   ` Pavel Machek [this message]
2020-10-06  6:41     ` Luka Kovacic
2020-10-07  1:10       ` Luka Kovacic
2020-09-30  1:40 ` [PATCH v3 5/7] Documentation/ABI: Add iei-wt61p803-puzzle driver sysfs interface documentation Luka Kovacic
2020-09-30  1:40 ` [PATCH v3 6/7] MAINTAINERS: Add an entry for the iEi WT61P803 PUZZLE driver Luka Kovacic
2020-09-30  1:40 ` [PATCH v3 7/7] arm64: dts: marvell: Add a device tree for the iEi Puzzle-M801 board Luka Kovacic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200930194759.GA24378@amd \
    --to=pavel@ucw.cz \
    --cc=andrew@lunn.ch \
    --cc=dmurphy@ti.com \
    --cc=gregory.clement@bootlin.com \
    --cc=jason@lakedaemon.net \
    --cc=jdelvare@suse.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=luka.kovacic@sartura.hr \
    --cc=luka.perkov@sartura.hr \
    --cc=marek.behun@nic.cz \
    --cc=robert.marko@sartura.hr \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).