Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4626182pxj; Wed, 12 May 2021 09:31:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLBwUi8zt8pez7NETxrRZimS7fLiVwW9/Ua3aOOI+y7Ia8pjZ6li7jUT93BK21nUZvYuY2 X-Received: by 2002:a17:906:5285:: with SMTP id c5mr38088275ejm.282.1620837075026; Wed, 12 May 2021 09:31:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620837075; cv=none; d=google.com; s=arc-20160816; b=AssUEoGkmrv+C7p0HpcwPi2WinUuLK9sKC25AIojzk2whnjWurl/7TAkZzdB1grebJ YE+/VKCLpE2W3sW8ItI+F1RZGckisYbj69OYqCGZouZED91A6FhSxIeURgNEuyAd+K/p mk+xn2412JAl9wFHweOZOEHm3uGnIzoVleWmqZ5wX8r4UCvTidzikeCos1wK2+5+XnnC sYuiywArIQwBmx6Dakl/rapdexGrDEZIC9CAO2vzWM5z3uK3bHeMJvbx9iaCf8QdXs9i 9UwGR3CrW0E3BOw+h8rNOYx5JrHfIhI9NJ0F+UHEUcRzqqkiJBa0aTo9O9S0IJiU8Dg/ +hXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NZL/QAZjop7xg80I6SEtppCF9qKf4HXtjyr5aCVwBgM=; b=MYuyLyfVbIcQppIbyfHDjIiQVEk4PpCjYh3S2y6/twraQ2EokSNkTXmsLucSYukGzM 3hRcgOwtzegOYQIKhHg17D6C29zaq+b1GBmlet4+0asWTYgAjayYMfh74p3vo4sgcI+h 8ljtwUBjxBK9vEzDRWYa6zrtl0z4X145BYdrHEe9tKsKXNHnnW4+7fxxbPo3VNv9CVFI Jz5Z5nLl2HZwVuYGMibgk/+L9guRwUdXlFlOe8BO4W6gWoCzACOMVKvimfrshwuDrByA 560i+Nl9uu54/ck7bCvSku65SfhTq8drgq+qqbHBqUu+2NpuYIShuqtviTMr0awVKyX8 oWog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Rx2xb/NU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mh7si373848ejb.585.2021.05.12.09.30.48; Wed, 12 May 2021 09:31:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Rx2xb/NU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237075AbhELQYN (ORCPT + 99 others); Wed, 12 May 2021 12:24:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:55166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236213AbhELPhU (ORCPT ); Wed, 12 May 2021 11:37:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 70BC461C53; Wed, 12 May 2021 15:18:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832725; bh=2oFtuUTODshxbFHwas6/hd2zei2d7kLtiLCkPMAHtto=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rx2xb/NUYtBhp51weEuX4pqlWcg+Uw7gOQRXBHj7SBhq7H3pJtJIHGySJBJZtvANU eNmmvLb0IoRX8ThJqiEz4fPaSyV9S1eczRdTNyUhsD5ZSza7F44Ia5M6kxYD2NbkhM sAZHvLA6cayrXx2rnZr6U8T3JHf0J4fI72NVdO6k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Marek=20Beh=C3=BAn?= , Pavel Machek , Hans de Goede , Jiri Kosina , Sasha Levin Subject: [PATCH 5.10 396/530] HID: lenovo: Use brightness_set_blocking callback for setting LEDs brightness Date: Wed, 12 May 2021 16:48:26 +0200 Message-Id: <20210512144832.785870919@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede [ Upstream commit bbf62645255f120bc2e7488c237e3f04da42ec70 ] The lenovo_led_brightness_set function may sleep, so we should have the the led_class_dev's brightness_set_blocking callback point to it, rather then the regular brightness_set callback. When toggled through sysfs this is not a problem, but the brightness_set callback may be called from atomic context when using LED-triggers. Fixes: bc04b37ea0ec ("HID: lenovo: Add ThinkPad 10 Ultrabook Keyboard support") Reviewed-by: Marek BehĂșn Acked-by: Pavel Machek Signed-off-by: Hans de Goede Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-lenovo.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c index c6c8e20f3e8d..4dc5e5f932ed 100644 --- a/drivers/hid/hid-lenovo.c +++ b/drivers/hid/hid-lenovo.c @@ -777,7 +777,7 @@ static enum led_brightness lenovo_led_brightness_get( : LED_OFF; } -static void lenovo_led_brightness_set(struct led_classdev *led_cdev, +static int lenovo_led_brightness_set(struct led_classdev *led_cdev, enum led_brightness value) { struct device *dev = led_cdev->dev->parent; @@ -802,6 +802,8 @@ static void lenovo_led_brightness_set(struct led_classdev *led_cdev, lenovo_led_set_tp10ubkbd(hdev, tp10ubkbd_led[led_nr], value); break; } + + return 0; } static int lenovo_register_leds(struct hid_device *hdev) @@ -822,7 +824,7 @@ static int lenovo_register_leds(struct hid_device *hdev) data->led_mute.name = name_mute; data->led_mute.brightness_get = lenovo_led_brightness_get; - data->led_mute.brightness_set = lenovo_led_brightness_set; + data->led_mute.brightness_set_blocking = lenovo_led_brightness_set; data->led_mute.dev = &hdev->dev; ret = led_classdev_register(&hdev->dev, &data->led_mute); if (ret < 0) @@ -830,7 +832,7 @@ static int lenovo_register_leds(struct hid_device *hdev) data->led_micmute.name = name_micm; data->led_micmute.brightness_get = lenovo_led_brightness_get; - data->led_micmute.brightness_set = lenovo_led_brightness_set; + data->led_micmute.brightness_set_blocking = lenovo_led_brightness_set; data->led_micmute.dev = &hdev->dev; ret = led_classdev_register(&hdev->dev, &data->led_micmute); if (ret < 0) { -- 2.30.2