Linux-Hwmon Archive on lore.kernel.org
 help / color / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Eddie James <eajames@linux.ibm.com>
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
	jdelvare@suse.com
Subject: Re: [PATCH 1/2] hwmon: (pmbus/ibm-cffps) Switch LEDs to blocking brightness call
Date: Wed, 6 Nov 2019 14:35:35 -0800
Message-ID: <20191106223535.GA20168@roeck-us.net> (raw)
In-Reply-To: <20191106200106.29519-2-eajames@linux.ibm.com>

On Wed, Nov 06, 2019 at 02:01:05PM -0600, Eddie James wrote:
> Since i2c_smbus functions can sleep, the brightness setting function
> for this driver must be the blocking version to avoid scheduling while
> atomic.
> 
> Signed-off-by: Eddie James <eajames@linux.ibm.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/pmbus/ibm-cffps.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hwmon/pmbus/ibm-cffps.c b/drivers/hwmon/pmbus/ibm-cffps.c
> index d61547ed0da0..c6a00e83aac6 100644
> --- a/drivers/hwmon/pmbus/ibm-cffps.c
> +++ b/drivers/hwmon/pmbus/ibm-cffps.c
> @@ -297,8 +297,8 @@ static int ibm_cffps_read_word_data(struct i2c_client *client, int page,
>  	return rc;
>  }
>  
> -static void ibm_cffps_led_brightness_set(struct led_classdev *led_cdev,
> -					 enum led_brightness brightness)
> +static int ibm_cffps_led_brightness_set(struct led_classdev *led_cdev,
> +					enum led_brightness brightness)
>  {
>  	int rc;
>  	struct ibm_cffps *psu = container_of(led_cdev, struct ibm_cffps, led);
> @@ -316,9 +316,11 @@ static void ibm_cffps_led_brightness_set(struct led_classdev *led_cdev,
>  	rc = i2c_smbus_write_byte_data(psu->client, CFFPS_SYS_CONFIG_CMD,
>  				       psu->led_state);
>  	if (rc < 0)
> -		return;
> +		return rc;
>  
>  	led_cdev->brightness = brightness;
> +
> +	return 0;
>  }
>  
>  static int ibm_cffps_led_blink_set(struct led_classdev *led_cdev,
> @@ -356,7 +358,7 @@ static void ibm_cffps_create_led_class(struct ibm_cffps *psu)
>  		 client->addr);
>  	psu->led.name = psu->led_name;
>  	psu->led.max_brightness = LED_FULL;
> -	psu->led.brightness_set = ibm_cffps_led_brightness_set;
> +	psu->led.brightness_set_blocking = ibm_cffps_led_brightness_set;
>  	psu->led.blink_set = ibm_cffps_led_blink_set;
>  
>  	rc = devm_led_classdev_register(dev, &psu->led);

  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-06 20:01 [PATCH 0/2] hwmon: (pmbus/ibm-cffps) Fixes for the LED subsystem Eddie James
2019-11-06 20:01 ` [PATCH 1/2] hwmon: (pmbus/ibm-cffps) Switch LEDs to blocking brightness call Eddie James
2019-11-06 22:35   ` Guenter Roeck [this message]
2019-11-06 20:01 ` [PATCH 2/2] hwmon: (pmbus/ibm-cffps) Fix LED blink behavior Eddie James
2019-11-06 22:38   ` Guenter Roeck

Reply instructions:

You may reply publically 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=20191106223535.GA20168@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=eajames@linux.ibm.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.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

Linux-Hwmon Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-hwmon/0 linux-hwmon/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hwmon linux-hwmon/ https://lore.kernel.org/linux-hwmon \
		linux-hwmon@vger.kernel.org
	public-inbox-index linux-hwmon

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-hwmon


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git