Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2536918yba; Mon, 6 May 2019 07:40:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwSN3OvyOvl0P0XsTM3NTDjFbo4H75+FyD9dsZF5tV9swYPEneDb0qHaIkKgupu2hI1RLbw X-Received: by 2002:a17:902:6b8b:: with SMTP id p11mr32106104plk.225.1557153613280; Mon, 06 May 2019 07:40:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557153613; cv=none; d=google.com; s=arc-20160816; b=SLhSwnzc712X6lDB7jfNiKFJdBKDcsCfcjatFUOrfUsLwVvJfn7l/EHGcBsFOqWVny 1qJB2+JBpyKX5ypkEm/i5xGv42slT3OUnGjJk2a1xyetqd1FeDi8Yn/WLPyLONko7lMT pdN+N8H7cpHAwRUDpnFQZK8TxyCjv3JKQOryYzDLwRb6g3sTO9ZU4V48SJHpoUKRrTpq qaGnb4cDJWdqyHMpQjjNNqjFsbeb7tqdoFFOMTBKVxL+56WMxOSSynD8hKH9tCKPsCBi DLgNBoW0e+di5mGGWFknf/pt7IU43R9CeodkWMCgIGXNj7eaBNIEXjOhyS2uXl9ZCBMf II6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dI9SZAoq1OJ8lCqbpwBnQXXOPzHnfM0oX3OmoJze41U=; b=wg46aZWQv/PO1JlicgK2lJGEMdJgykphtir4oy8Ajv3v9u4qkjvSd273KuYBjUDsFP 6R35t+hwFZze5tSWMb4OnI+IlJmePMU/DrfiCD5tOiGfTDqUdV8DmORD7blQ1701E12q BL4hoS0EncfCxvKLpoKpPk+10u7MKt3IbEuMuk/UQQk6nVITR3v5wmV0Cve/tEWOXtLv 4F4IInqnh07j//n7eCe5RCM2kWie9YIye98GEx/pnPeiokfwC8+lLOUxFj0KxbGyiz5t mjmZRDhk25Z0IUGtuqx9WsSCtxzXqptpfD2bKXDB9YLA0ptVU5aMcdX/zyLwbHugitFo ws0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=186lQK+v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e3si14497470pfn.164.2019.05.06.07.39.57; Mon, 06 May 2019 07:40:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=186lQK+v; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727549AbfEFOiP (ORCPT + 99 others); Mon, 6 May 2019 10:38:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:59246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727527AbfEFOiN (ORCPT ); Mon, 6 May 2019 10:38:13 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 0596C206A3; Mon, 6 May 2019 14:38:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557153492; bh=b1+zedKg8zdeP7otKTiu/0hB8d4eiwI693m/aSnw4sM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=186lQK+vZpFLosDEf54Tb0CSOdWSr0ra7vwHAZBRIFdNIQDEutcaurpOJnQmXYxwt QFv5FljhVLGxsw0MsrtdWvtWwA9URHyRCgk9XI6BX8H3Zcz7j2mM7IpIUsFlHqKtPJ tbUTJQaRGjsIq5ykfUpZMELi0L/mYgMld3HGibpQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andi Shyti , Dmitry Torokhov Subject: [PATCH 5.0 110/122] Input: stmfts - acknowledge that setting brightness is a blocking call Date: Mon, 6 May 2019 16:32:48 +0200 Message-Id: <20190506143104.376228859@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190506143054.670334917@linuxfoundation.org> References: <20190506143054.670334917@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Torokhov commit 937c4e552fd1174784045684740edfcea536159d upstream. We need to turn regulators on and off when switching brightness, and that may block, therefore we have to set stmfts_brightness_set() as LED's brightness_set_blocking() method. Fixes: 78bcac7b2ae1 ("Input: add support for the STMicroelectronics FingerTip touchscreen") Acked-by: Andi Shyti Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/touchscreen/stmfts.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) --- a/drivers/input/touchscreen/stmfts.c +++ b/drivers/input/touchscreen/stmfts.c @@ -106,27 +106,29 @@ struct stmfts_data { bool running; }; -static void stmfts_brightness_set(struct led_classdev *led_cdev, +static int stmfts_brightness_set(struct led_classdev *led_cdev, enum led_brightness value) { struct stmfts_data *sdata = container_of(led_cdev, struct stmfts_data, led_cdev); int err; - if (value == sdata->led_status || !sdata->ledvdd) - return; - - if (!value) { - regulator_disable(sdata->ledvdd); - } else { - err = regulator_enable(sdata->ledvdd); - if (err) - dev_warn(&sdata->client->dev, - "failed to disable ledvdd regulator: %d\n", - err); + if (value != sdata->led_status && sdata->ledvdd) { + if (!value) { + regulator_disable(sdata->ledvdd); + } else { + err = regulator_enable(sdata->ledvdd); + if (err) { + dev_warn(&sdata->client->dev, + "failed to disable ledvdd regulator: %d\n", + err); + return err; + } + } + sdata->led_status = value; } - sdata->led_status = value; + return 0; } static enum led_brightness stmfts_brightness_get(struct led_classdev *led_cdev) @@ -608,7 +610,7 @@ static int stmfts_enable_led(struct stmf sdata->led_cdev.name = STMFTS_DEV_NAME; sdata->led_cdev.max_brightness = LED_ON; sdata->led_cdev.brightness = LED_OFF; - sdata->led_cdev.brightness_set = stmfts_brightness_set; + sdata->led_cdev.brightness_set_blocking = stmfts_brightness_set; sdata->led_cdev.brightness_get = stmfts_brightness_get; err = devm_led_classdev_register(&sdata->client->dev, &sdata->led_cdev);