[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200930194759.GA24378@amd>
Date: Wed, 30 Sep 2020 21:48:00 +0200
From: Pavel Machek <pavel@....cz>
To: Luka Kovacic <luka.kovacic@...tura.hr>
Cc: linux-kernel@...r.kernel.org, linux-hwmon@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-leds@...r.kernel.org,
lee.jones@...aro.org, dmurphy@...com, robh+dt@...nel.org,
jdelvare@...e.com, linux@...ck-us.net, andrew@...n.ch,
jason@...edaemon.net, gregory.clement@...tlin.com,
marek.behun@....cz, luka.perkov@...tura.hr, robert.marko@...tura.hr
Subject: Re: [PATCH v3 4/7] drivers: leds: Add the iEi WT61P803 PUZZLE LED
driver
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
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists