From patchwork Wed Jan 22 09:30:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233381 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.7 required=3.0 tests=DATE_IN_PAST_03_06, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77B0DC33CAF for ; Wed, 22 Jan 2020 13:29:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F72A205F4 for ; Wed, 22 Jan 2020 13:29:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579699742; bh=ja63mQTeTWmf6LIxLrZKkAvOkCsQUOyH+pMv6e6ZBNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=byMaOxui32x/sZXVkPxaM5XEljlfdz+D0cW4z8OetxonHPhf32Q1qN0KYC0Zn9PG+ vB7GJwVoV+0kC7u3mc5BsYM1F492GwWoYh1ShDsd9sPn7l1ZDH7Zomofup9YzuK/v/ PFE98vmQK2enLa/ZKBuzUAzQkwBqDocnW5680dno= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726796AbgAVN2S (ORCPT ); Wed, 22 Jan 2020 08:28:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:50452 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730266AbgAVN2S (ORCPT ); Wed, 22 Jan 2020 08:28:18 -0500 Received: from localhost (unknown [84.241.205.26]) (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 D48512071E; Wed, 22 Jan 2020 13:28:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579699697; bh=ja63mQTeTWmf6LIxLrZKkAvOkCsQUOyH+pMv6e6ZBNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hyVxTOQ3CKJL5U4BLWdFOoleYWKvii4bHUSLrAdksUvZLRSOd5DOEIUr2N0y5mhAm QNompD6di7xzMwyrK25Gq+Zod9xQf6sF6hqJlvhsxpLdvVnX5BJSgH0l6tRU/2hO3E m/p0w9zALNUc2o/iEpBDRXXnnSeGjgHK4wTM8SIM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eddie James , Guenter Roeck Subject: [PATCH 5.4 221/222] hwmon: (pmbus/ibm-cffps) Switch LEDs to blocking brightness call Date: Wed, 22 Jan 2020 10:30:07 +0100 Message-Id: <20200122092849.507081748@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200122092833.339495161@linuxfoundation.org> References: <20200122092833.339495161@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Eddie James commit 9861ff954c7e83e2f738ce16fbe15f8a1e121771 upstream. 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 Link: https://lore.kernel.org/r/20191106200106.29519-2-eajames@linux.ibm.com Fixes: ef9e1cdf419a3 ("hwmon: (pmbus/cffps) Add led class device for power supply fault led") Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/pmbus/ibm-cffps.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/hwmon/pmbus/ibm-cffps.c +++ b/drivers/hwmon/pmbus/ibm-cffps.c @@ -292,8 +292,8 @@ static int ibm_cffps_read_word_data(stru 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); @@ -311,9 +311,11 @@ static void ibm_cffps_led_brightness_set 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, @@ -351,7 +353,7 @@ static void ibm_cffps_create_led_class(s 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);