From patchwork Fri Jan 21 16:54:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Sampaio X-Patchwork-Id: 12719962 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34A4BC433F5 for ; Fri, 21 Jan 2022 16:54:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379240AbiAUQyZ (ORCPT ); Fri, 21 Jan 2022 11:54:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379008AbiAUQyV (ORCPT ); Fri, 21 Jan 2022 11:54:21 -0500 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0622EC06173D; Fri, 21 Jan 2022 08:54:21 -0800 (PST) Received: by mail-oi1-x234.google.com with SMTP id t9so14290844oie.12; Fri, 21 Jan 2022 08:54:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W6q2GvKgFmLMSEA3uVGLoy2Js4lfhFob5eKXqXL9wS0=; b=V80sEKCJ7CvnStxN8YoKYOwNYeczaLRhIjom+agXBX2hAYX0UqJNjEiP2Al+h+Mjgw oPX5Zlj1ftCCLNXZ2Qqqi7Zp6Y7oYFQBuGldLvYmnZ6yZSQGN16TAYAs2vv0rZc9H9mr g/S9b1+gABjVgoN2Q7+n3ISkE8tvMSYNRQgaC1hsgWsfG3q122/BjXtfIx+RxqEDpmup fiOZFqsGkp1ZgD9UNnuaiAMSjhDsTHmGmO26mVqEY18jOTui9yMgobi45DcusBteF2p+ 7QPnogKz4cAQrRqJbj0KElKi6ujDsNiJgHYNClWGVLgkkvO3GfVdyRZ0hrcfhvHqw0op E2WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W6q2GvKgFmLMSEA3uVGLoy2Js4lfhFob5eKXqXL9wS0=; b=2F36GXUspEeoUtuQ5Quj1sWlNPlegPM1IUtShh+313OviZuyWy9yen0yIxzf1r96CN 967CcF9Jtl1DKRcZBfT7iVAYY9ogo3PIUZFhV2PFMaBegnSJbAtkMxCV9BqUJ2PD3atf x5+p38/+2a6qBYUp/7MqlZvKR9GEinogaixJ+e0B9toQHThR5ZX7w5y+5TmYM71uI6uL MZaQmW8x3BzOWdwWVREtKAR0sBcVkzo7CCgvucOF2yRwoYAJQPA0tivKocjzff1icwFS kIs7wWlBtKksCtIKvsghQCCI305XdCLByK50455wn2Eyq9ImjYmTVCD8ezBRCgrnmtl2 FCow== X-Gm-Message-State: AOAM533Nduok8J4fveu1J52ixaELtlY6T2gpPABQ4UViPJ72qqBUHUIv TqSC0BMR/ujKcwPUp4LjNAc= X-Google-Smtp-Source: ABdhPJxfuo+LWu20AiZhd5QEX3IL1Gxj5Jtadphle0HxWIMb8yHSIZs3cLopupLv0yVDm7K3ObMPjA== X-Received: by 2002:a54:4191:: with SMTP id 17mr1222572oiy.39.1642784060271; Fri, 21 Jan 2022 08:54:20 -0800 (PST) Received: from thinkpad.localdomain ([2804:14d:5cd1:5d03:cf72:4317:3105:f6e5]) by smtp.gmail.com with ESMTPSA id y8sm1089271oou.23.2022.01.21.08.54.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jan 2022 08:54:20 -0800 (PST) From: Luiz Sampaio To: Jiri Kosina , Benjamin Tissoires , =?utf-8?q?Bruno_Pr?= =?utf-8?q?=C3=A9mont?= , Roderick Colenbrander , David Rheinsberg Cc: linux-kernel@vger.kernel.org, Luiz Sampaio , linux-input@vger.kernel.org Subject: [PATCH 02/31] hid: changing LED_* from enum led_brightness to actual value Date: Fri, 21 Jan 2022 13:54:07 -0300 Message-Id: <20220121165436.30956-3-sampaio.ime@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220121165436.30956-1-sampaio.ime@gmail.com> References: <20220121165436.30956-1-sampaio.ime@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The enum led_brightness, which contains the declaration of LED_OFF, LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports max_brightness. --- drivers/hid/hid-bigbenff.c | 10 +++++----- drivers/hid/hid-elan.c | 2 +- drivers/hid/hid-lenovo.c | 2 +- drivers/hid/hid-lg4ff.c | 10 +++++----- drivers/hid/hid-picolcd_leds.c | 6 +++--- drivers/hid/hid-playstation.c | 2 +- drivers/hid/hid-sony.c | 4 ++-- drivers/hid/hid-steelseries.c | 14 +++++++------- drivers/hid/hid-u2fzero.c | 4 ++-- drivers/hid/hid-wiimote-modules.c | 4 ++-- drivers/hid/wacom_sys.c | 16 ++++++++-------- drivers/hid/wacom_wac.c | 2 +- 12 files changed, 38 insertions(+), 38 deletions(-) diff --git a/drivers/hid/hid-bigbenff.c b/drivers/hid/hid-bigbenff.c index 74ad8bf98bfd..3882b514f581 100644 --- a/drivers/hid/hid-bigbenff.c +++ b/drivers/hid/hid-bigbenff.c @@ -267,7 +267,7 @@ static void bigben_set_led(struct led_classdev *led, for (n = 0; n < NUM_LEDS; n++) { if (led == bigben->leds[n]) { - if (value == LED_OFF) { + if (value == 0) { work = (bigben->led_state & BIT(n)); bigben->led_state &= ~BIT(n); } else { @@ -293,15 +293,15 @@ static enum led_brightness bigben_get_led(struct led_classdev *led) if (!bigben) { hid_err(hid, "no device data\n"); - return LED_OFF; + return 0; } for (n = 0; n < NUM_LEDS; n++) { if (led == bigben->leds[n]) - return (bigben->led_state & BIT(n)) ? LED_ON : LED_OFF; + return (bigben->led_state & BIT(n)) ? 1 : 0; } - return LED_OFF; + return 0; } static void bigben_remove(struct hid_device *hid) @@ -375,7 +375,7 @@ static int bigben_probe(struct hid_device *hid, dev_name(&hid->dev), n + 1 ); led->name = name; - led->brightness = (n == 0) ? LED_ON : LED_OFF; + led->brightness = (n == 0) ? 1 : 0; led->max_brightness = 1; led->brightness_get = bigben_get_led; led->brightness_set = bigben_set_led; diff --git a/drivers/hid/hid-elan.c b/drivers/hid/hid-elan.c index 3091355d48df..44c20b60ba3e 100644 --- a/drivers/hid/hid-elan.c +++ b/drivers/hid/hid-elan.c @@ -453,7 +453,7 @@ static int elan_init_mute_led(struct hid_device *hdev) mute_led->name = "elan:red:mute"; mute_led->default_trigger = "audio-mute"; mute_led->brightness_set_blocking = elan_mute_led_set_brigtness; - mute_led->max_brightness = LED_ON; + mute_led->max_brightness = 1; mute_led->flags = LED_HW_PLUGGABLE; mute_led->dev = &hdev->dev; diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c index 93b1f935e526..b65d3a5175d5 100644 --- a/drivers/hid/hid-lenovo.c +++ b/drivers/hid/hid-lenovo.c @@ -842,7 +842,7 @@ static int lenovo_led_brightness_set(struct led_classdev *led_cdev, if (led_cdev == &data_pointer->led_micmute) led_nr = 1; - if (value == LED_OFF) + if (value == 0) data_pointer->led_state &= ~(1 << led_nr); else data_pointer->led_state |= 1 << led_nr; diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c index 5e6a0cef2a06..6e65f92e6aec 100644 --- a/drivers/hid/hid-lg4ff.c +++ b/drivers/hid/hid-lg4ff.c @@ -1136,10 +1136,10 @@ static void lg4ff_led_set_brightness(struct led_classdev *led_cdev, if (led_cdev != entry->wdata.led[i]) continue; state = (entry->wdata.led_state >> i) & 1; - if (value == LED_OFF && state) { + if (value == 0 && state) { entry->wdata.led_state &= ~(1 << i); lg4ff_set_leds(hid, entry->wdata.led_state); - } else if (value != LED_OFF && !state) { + } else if (value != 0 && !state) { entry->wdata.led_state |= 1 << i; lg4ff_set_leds(hid, entry->wdata.led_state); } @@ -1157,14 +1157,14 @@ static enum led_brightness lg4ff_led_get_brightness(struct led_classdev *led_cde if (!drv_data) { hid_err(hid, "Device data not found."); - return LED_OFF; + return 0; } entry = drv_data->device_props; if (!entry) { hid_err(hid, "Device properties not found."); - return LED_OFF; + return 0; } for (i = 0; i < 5; i++) @@ -1173,7 +1173,7 @@ static enum led_brightness lg4ff_led_get_brightness(struct led_classdev *led_cde break; } - return value ? LED_FULL : LED_OFF; + return value ? 255 : 0; } #endif diff --git a/drivers/hid/hid-picolcd_leds.c b/drivers/hid/hid-picolcd_leds.c index 6b505a753511..b000ee63b1c9 100644 --- a/drivers/hid/hid-picolcd_leds.c +++ b/drivers/hid/hid-picolcd_leds.c @@ -64,10 +64,10 @@ static void picolcd_led_set_brightness(struct led_classdev *led_cdev, if (led_cdev != data->led[i]) continue; state = (data->led_state >> i) & 1; - if (value == LED_OFF && state) { + if (value == 0 && state) { data->led_state &= ~(1 << i); picolcd_leds_set(data); - } else if (value != LED_OFF && !state) { + } else if (value != 0 && !state) { data->led_state |= 1 << i; picolcd_leds_set(data); } @@ -90,7 +90,7 @@ static enum led_brightness picolcd_led_get_brightness(struct led_classdev *led_c value = (data->led_state >> i) & 1; break; } - return value ? LED_FULL : LED_OFF; + return value ? 255 : 0; } int picolcd_init_leds(struct picolcd_data *data, struct hid_report *report) diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c index b1b5721b5d8f..95ed22a533ec 100644 --- a/drivers/hid/hid-playstation.c +++ b/drivers/hid/hid-playstation.c @@ -873,7 +873,7 @@ static int dualsense_player_led_set_brightness(struct led_classdev *led, enum le spin_lock_irqsave(&ds->base.lock, flags); led_index = led - ds->player_leds; - if (value == LED_OFF) + if (value == 0) ds->player_leds_state &= ~BIT(led_index); else ds->player_leds_state |= BIT(led_index); diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 60ec2b29d54d..f4198cd8b94d 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -2048,7 +2048,7 @@ static enum led_brightness sony_led_get_brightness(struct led_classdev *led) drv_data = hid_get_drvdata(hdev); if (!drv_data) { hid_err(hdev, "No device data\n"); - return LED_OFF; + return 0; } for (n = 0; n < drv_data->led_count; n++) { @@ -2056,7 +2056,7 @@ static enum led_brightness sony_led_get_brightness(struct led_classdev *led) return drv_data->led_state[n]; } - return LED_OFF; + return 0; } static int sony_led_blink_set(struct led_classdev *led, unsigned long *delay_on, diff --git a/drivers/hid/hid-steelseries.c b/drivers/hid/hid-steelseries.c index 37353c41cba7..b53587891b32 100644 --- a/drivers/hid/hid-steelseries.c +++ b/drivers/hid/hid-steelseries.c @@ -146,7 +146,7 @@ static void steelseries_srws1_led_all_set_brightness(struct led_classdev *led_cd return; } - if (value == LED_OFF) + if (value == 0) drv_data->led_state = 0; else drv_data->led_state = (1 << (SRWS1_NUMBER_LEDS + 1)) - 1; @@ -164,10 +164,10 @@ static enum led_brightness steelseries_srws1_led_all_get_brightness(struct led_c if (!drv_data) { hid_err(hid, "Device data not found."); - return LED_OFF; + return 0; } - return (drv_data->led_state >> SRWS1_NUMBER_LEDS) ? LED_FULL : LED_OFF; + return (drv_data->led_state >> SRWS1_NUMBER_LEDS) ? 255 : 0; } static void steelseries_srws1_led_set_brightness(struct led_classdev *led_cdev, @@ -188,10 +188,10 @@ static void steelseries_srws1_led_set_brightness(struct led_classdev *led_cdev, continue; state = (drv_data->led_state >> i) & 1; - if (value == LED_OFF && state) { + if (value == 0 && state) { drv_data->led_state &= ~(1 << i); steelseries_srws1_set_leds(hid, drv_data->led_state); - } else if (value != LED_OFF && !state) { + } else if (value != 0 && !state) { drv_data->led_state |= 1 << i; steelseries_srws1_set_leds(hid, drv_data->led_state); } @@ -210,7 +210,7 @@ static enum led_brightness steelseries_srws1_led_get_brightness(struct led_class if (!drv_data) { hid_err(hid, "Device data not found."); - return LED_OFF; + return 0; } for (i = 0; i < SRWS1_NUMBER_LEDS; i++) @@ -219,7 +219,7 @@ static enum led_brightness steelseries_srws1_led_get_brightness(struct led_class break; } - return value ? LED_FULL : LED_OFF; + return value ? 255 : 0; } static int steelseries_srws1_probe(struct hid_device *hdev, diff --git a/drivers/hid/hid-u2fzero.c b/drivers/hid/hid-u2fzero.c index ad489caf53ad..1e73bd85b9b7 100644 --- a/drivers/hid/hid-u2fzero.c +++ b/drivers/hid/hid-u2fzero.c @@ -187,7 +187,7 @@ static int u2fzero_blink(struct led_classdev *ldev) static int u2fzero_brightness_set(struct led_classdev *ldev, enum led_brightness brightness) { - ldev->brightness = LED_OFF; + ldev->brightness = 0; if (brightness) return u2fzero_blink(ldev); else @@ -244,7 +244,7 @@ static int u2fzero_init_led(struct u2fzero_device *dev, return -ENOMEM; dev->ldev.name = dev->led_name; - dev->ldev.max_brightness = LED_ON; + dev->ldev.max_brightness = 1; dev->ldev.flags = LED_HW_PLUGGABLE; dev->ldev.brightness_set_blocking = u2fzero_brightness_set; diff --git a/drivers/hid/hid-wiimote-modules.c b/drivers/hid/hid-wiimote-modules.c index 213c58bf2495..9416f0e2a092 100644 --- a/drivers/hid/hid-wiimote-modules.c +++ b/drivers/hid/hid-wiimote-modules.c @@ -308,7 +308,7 @@ static enum led_brightness wiimod_led_get(struct led_classdev *led_dev) } } - return value ? LED_FULL : LED_OFF; + return value ? 255 : 0; } static void wiimod_led_set(struct led_classdev *led_dev, @@ -325,7 +325,7 @@ static void wiimod_led_set(struct led_classdev *led_dev, flag = WIIPROTO_FLAG_LED(i + 1); spin_lock_irqsave(&wdata->state.lock, flags); state = wdata->state.flags; - if (value == LED_OFF) + if (value == 0) wiiproto_req_leds(wdata, state & ~flag); else wiiproto_req_leds(wdata, state | flag); diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 066c567dbaa2..9b0786f48867 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -1304,13 +1304,13 @@ enum led_brightness wacom_leds_brightness_get(struct wacom_led *led) struct wacom *wacom = led->wacom; if (wacom->led.max_hlv) - return led->hlv * LED_FULL / wacom->led.max_hlv; + return led->hlv * 255 / wacom->led.max_hlv; if (wacom->led.max_llv) - return led->llv * LED_FULL / wacom->led.max_llv; + return led->llv * 255 / wacom->led.max_llv; /* device doesn't support brightness tuning */ - return LED_FULL; + return 255; } static enum led_brightness __wacom_led_brightness_get(struct led_classdev *cdev) @@ -1319,7 +1319,7 @@ static enum led_brightness __wacom_led_brightness_get(struct led_classdev *cdev) struct wacom *wacom = led->wacom; if (wacom->led.groups[led->group].select != led->id) - return LED_OFF; + return 0; return wacom_leds_brightness_get(led); } @@ -1333,14 +1333,14 @@ static int wacom_led_brightness_set(struct led_classdev *cdev, mutex_lock(&wacom->lock); - if (!wacom->led.groups || (brightness == LED_OFF && + if (!wacom->led.groups || (brightness == 0 && wacom->led.groups[led->group].select != led->id)) { error = 0; goto out; } - led->llv = wacom->led.llv = wacom->led.max_llv * brightness / LED_FULL; - led->hlv = wacom->led.hlv = wacom->led.max_hlv * brightness / LED_FULL; + led->llv = wacom->led.llv = wacom->led.max_llv * brightness / 255; + led->hlv = wacom->led.hlv = wacom->led.max_hlv * brightness / 255; wacom->led.groups[led->group].select = led->id; @@ -1389,7 +1389,7 @@ static int wacom_led_register_one(struct device *dev, struct wacom *wacom, led->llv = wacom->led.llv; led->hlv = wacom->led.hlv; led->cdev.name = name; - led->cdev.max_brightness = LED_FULL; + led->cdev.max_brightness = 255; led->cdev.flags = LED_HW_PLUGGABLE; led->cdev.brightness_get = __wacom_led_brightness_get; if (!read_only) { diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 2a4cc39962e7..d47e8c59aa4d 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -3958,7 +3958,7 @@ static void wacom_24hd_update_leds(struct wacom *wacom, int mask, int group) } if (!updated && mask & BIT(i)) { led->held = true; - led_trigger_event(&led->trigger, LED_FULL); + led_trigger_event(&led->trigger, 255); } else { led->held = false; } From patchwork Fri Jan 21 16:54:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Sampaio X-Patchwork-Id: 12719963 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08BE2C433EF for ; Fri, 21 Jan 2022 16:54:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379148AbiAUQya (ORCPT ); Fri, 21 Jan 2022 11:54:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378945AbiAUQy3 (ORCPT ); Fri, 21 Jan 2022 11:54:29 -0500 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA9F3C06173B; Fri, 21 Jan 2022 08:54:28 -0800 (PST) Received: by mail-ot1-x32c.google.com with SMTP id a10-20020a9d260a000000b005991bd6ae3eso12458581otb.11; Fri, 21 Jan 2022 08:54:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Je4Vg4olpeQt3YYgiuDinqh8u3SDDMhhHec3zR+vbpw=; b=eyCdocg3/BwFXfNB6Ra58X0zGei6GdzjOGAdVx7J3EZnQTgNGumoi5fmYK2Za3iy/V jN4KcidqxXKzrCkljB4x44HUo0uALqPUK43TPmRzhAvbqRJMFkRqo6GK8HHgOmkpkYMb VH5XLEj6enzXbw4Y5gnI7kzbDKx7XjMl5ewZlxJ9g7HHghQjUU1V24v+fC1CwCfIzFWn JrgLaglsFFu6zmi604vr/azRkUrGkI+B1oTVYYKJki6GU/uzAgmPq6SNxHH12lnQSmDy kuNuIvUTd6OO79GVAqblQz1rJXzXKW6npRKdtuI63j3qmOr8EXqz8PDpQiksyusBI/L6 m+Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Je4Vg4olpeQt3YYgiuDinqh8u3SDDMhhHec3zR+vbpw=; b=GBjo9k+eK9gUAmpwzDlTlMIAUGW7/xZxJXLidH9GSBbbh/JyKlOys7PDhMo5ryyuK+ RRbHmcEUR0SCUzEJU3t17XWc1oOq9tPG/W5Y7LgDilly4q+94+vWUTEBbYd98C30Vwu0 /JZyPLBW5MgimB9Y10I12KkuBZEx5asvXVT9mECbu3UCISporkP/+GgkHZ6Pug6kIhiy 2/JmCTlfT+jkQJzo8QnxAU1gVz913HOaIae4Hr0cU2MFomWwDe3SqTGa1WWkstCqTdBS vLqAMwlH88RH0zDDDgwOHWSWPvYWcUtVcKmFakzQRl7nckoFCyErvlnxGNKgHb7BMzFv GJWA== X-Gm-Message-State: AOAM530VAR8UaLVIojQ5oT1qVwMm8Sp41wmU0qFxBYzCUrVF3isAQUv2 oRKFajr+yXDdZOyw/g+L9IxKQzFnNkQ= X-Google-Smtp-Source: ABdhPJy2nNfP2/sQ5pcqgIqsWk02rQQ3m1RbWO9oJ+ZEbEFN7V0EXWGwjzgsJulb5byjReHdhGwo3A== X-Received: by 2002:a05:6830:40c6:: with SMTP id h6mr3263411otu.247.1642784068274; Fri, 21 Jan 2022 08:54:28 -0800 (PST) Received: from thinkpad.localdomain ([2804:14d:5cd1:5d03:cf72:4317:3105:f6e5]) by smtp.gmail.com with ESMTPSA id y8sm1089271oou.23.2022.01.21.08.54.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jan 2022 08:54:27 -0800 (PST) From: Luiz Sampaio To: Dmitry Torokhov Cc: linux-kernel@vger.kernel.org, Luiz Sampaio , linux-input@vger.kernel.org Subject: [PATCH 05/31] input: keyboard: changing LED_* from enum led_brightness to actual value Date: Fri, 21 Jan 2022 13:54:10 -0300 Message-Id: <20220121165436.30956-6-sampaio.ime@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220121165436.30956-1-sampaio.ime@gmail.com> References: <20220121165436.30956-1-sampaio.ime@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The enum led_brightness, which contains the declaration of LED_OFF, LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports max_brightness. --- drivers/input/keyboard/cap11xx.c | 2 +- drivers/input/keyboard/qt2160.c | 6 +++--- drivers/input/keyboard/tm2-touchkey.c | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c index 7c85343cd32f..04c03157ef8a 100644 --- a/drivers/input/keyboard/cap11xx.c +++ b/drivers/input/keyboard/cap11xx.c @@ -290,7 +290,7 @@ static int cap11xx_init_leds(struct device *dev, led->cdev.flags = 0; led->cdev.brightness_set_blocking = cap11xx_led_set; led->cdev.max_brightness = 1; - led->cdev.brightness = LED_OFF; + led->cdev.brightness = 0; error = of_property_read_u32(child, "reg", ®); if (error != 0 || reg >= num_leds) { diff --git a/drivers/input/keyboard/qt2160.c b/drivers/input/keyboard/qt2160.c index 32d4a076eaa3..b80c2195dabb 100644 --- a/drivers/input/keyboard/qt2160.c +++ b/drivers/input/keyboard/qt2160.c @@ -78,7 +78,7 @@ static int qt2160_led_set(struct led_classdev *cdev, if (value != led->brightness) { drive = qt2160_read(client, QT2160_CMD_DRIVE_X); pwmen = qt2160_read(client, QT2160_CMD_PWMEN_X); - if (value != LED_OFF) { + if (value != 0) { drive |= BIT(led->id); pwmen |= BIT(led->id); @@ -93,7 +93,7 @@ static int qt2160_led_set(struct led_classdev *cdev, * Changing this register will change the brightness * of every LED in the qt2160. It's a HW limitation. */ - if (value != LED_OFF) + if (value != 0) qt2160_write(client, QT2160_CMD_PWM_DUTY, value); led->brightness = value; @@ -269,7 +269,7 @@ static int qt2160_register_leds(struct qt2160_data *qt2160) snprintf(led->name, sizeof(led->name), "qt2160:x%d", i); led->cdev.name = led->name; led->cdev.brightness_set_blocking = qt2160_led_set; - led->cdev.brightness = LED_OFF; + led->cdev.brightness = 0; led->id = i; led->qt2160 = qt2160; diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c index 632cd6c1c8d4..b28ebbc75d11 100644 --- a/drivers/input/keyboard/tm2-touchkey.c +++ b/drivers/input/keyboard/tm2-touchkey.c @@ -91,7 +91,7 @@ static int tm2_touchkey_led_brightness_set(struct led_classdev *led_dev, u32 volt; u8 data; - if (brightness == LED_OFF) { + if (brightness == 0) { volt = TM2_TOUCHKEY_LED_VOLTAGE_MIN; data = touchkey->variant->cmd_led_off; } else { @@ -173,9 +173,9 @@ static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid) if (touchkey->variant->fixed_regulator && data & TM2_TOUCHKEY_BIT_PRESS_EV) { /* touch turns backlight on, so make sure we're in sync */ - if (touchkey->led_dev.brightness == LED_OFF) + if (touchkey->led_dev.brightness == 0) tm2_touchkey_led_brightness_set(&touchkey->led_dev, - LED_OFF); + 0); } return IRQ_HANDLED; @@ -280,8 +280,8 @@ static int tm2_touchkey_probe(struct i2c_client *client, /* led device */ touchkey->led_dev.name = TM2_TOUCHKEY_DEV_NAME; - touchkey->led_dev.brightness = LED_ON; - touchkey->led_dev.max_brightness = LED_ON; + touchkey->led_dev.brightness = 1; + touchkey->led_dev.max_brightness = 1; touchkey->led_dev.brightness_set_blocking = tm2_touchkey_led_brightness_set; @@ -293,7 +293,7 @@ static int tm2_touchkey_probe(struct i2c_client *client, } if (touchkey->variant->fixed_regulator) - tm2_touchkey_led_brightness_set(&touchkey->led_dev, LED_ON); + tm2_touchkey_led_brightness_set(&touchkey->led_dev, 1); return 0; } From patchwork Fri Jan 21 16:54:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Sampaio X-Patchwork-Id: 12719964 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54F4EC433F5 for ; Fri, 21 Jan 2022 16:54:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379181AbiAUQyc (ORCPT ); Fri, 21 Jan 2022 11:54:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379036AbiAUQyb (ORCPT ); Fri, 21 Jan 2022 11:54:31 -0500 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88D01C06173D; Fri, 21 Jan 2022 08:54:31 -0800 (PST) Received: by mail-oi1-x235.google.com with SMTP id q186so14347706oih.8; Fri, 21 Jan 2022 08:54:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5s5UbzjGtCWz5IFAAJ8W73hj4zFXrrDystMmQJgy/K0=; b=fSDTz17GP1ENZ9TNg++fhuNarE5aoMJy71DtoGonwd2QtSCqntLqDPoSo9iC4DLF2H 4pbJ+SCNGlyzBVTN4L/32SyjESoCM+qQ6jaB9RVpb79aZJplW0zuj4TJHO0H6qL3RTFf 1zwGf8QO4wXLwDO5HatBgBKCGjcZRkFjf5KXxcpcXuiIw4N5PoJQoXbL836v3ECgfluM 30gNkB+pVZ1vRTU2FlYFRBH0jQl7QemGvOJzeKODlI9aPRnWlJSOJ+UYzaqgS3oznNSs uk75Wohu9H5pNRdEMgG/ZNY4nhu4S05fvlAKPlSRXjIg1ztqG3W+4RwISw2K8VV2fXNx lktQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5s5UbzjGtCWz5IFAAJ8W73hj4zFXrrDystMmQJgy/K0=; b=EYV4HNs8k1CA6tdPm7MBgdKM2fkk9/VxF3nLvvlD68lGMjkgR12f0HZCihQEh73NbZ icRNfNPVoLJhQvaducXiX4JXKlV3hsgxjMFhRvxhsrY0/sQ8of1TtDYtyoZ+cARgu1Fp 7nu2lfqj4gs6qvupCva3RMU0nVy7xPDrlHf2WYM83smIcGoPcmJtLmTEhN2ky+sxECV5 ki60/sAgfgPlaztdp7A6edm02xF+z1AhVOelJEI3bPPI3fR0HojhGmBacW2iTTNDJ4nF zV6L9yXSE6WNZfTqHJosIGoLtpQm15c1sryAdWcn/y7uzIGPIZP8VmolimUBj6nfxedV I0TQ== X-Gm-Message-State: AOAM531VRKKB9z9PjPUjh7xCeSugCj/tXhbS+BgWI7V2V19IusAj0fZS eiYDTjLVR1Tw4D3WkPe2FGk= X-Google-Smtp-Source: ABdhPJxvBuBxMuXHNeqQqmpPiBGLgjWTEw0bKwOXqMg3pK9cWTM3CNpmQojh7ca/Kw7mYV+BxY9+ww== X-Received: by 2002:a05:6808:1b07:: with SMTP id bx7mr1267018oib.38.1642784070933; Fri, 21 Jan 2022 08:54:30 -0800 (PST) Received: from thinkpad.localdomain ([2804:14d:5cd1:5d03:cf72:4317:3105:f6e5]) by smtp.gmail.com with ESMTPSA id y8sm1089271oou.23.2022.01.21.08.54.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jan 2022 08:54:30 -0800 (PST) From: Luiz Sampaio To: Dmitry Torokhov , Miloslav Trmac Cc: linux-kernel@vger.kernel.org, Luiz Sampaio , linux-input@vger.kernel.org Subject: [PATCH 06/31] input: misc: changing LED_* from enum led_brightness to actual value Date: Fri, 21 Jan 2022 13:54:11 -0300 Message-Id: <20220121165436.30956-7-sampaio.ime@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220121165436.30956-1-sampaio.ime@gmail.com> References: <20220121165436.30956-1-sampaio.ime@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The enum led_brightness, which contains the declaration of LED_OFF, LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports max_brightness. --- drivers/input/misc/apanel.c | 4 ++-- drivers/input/misc/ims-pcu.c | 2 +- drivers/input/misc/wistron_btns.c | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/input/misc/apanel.c b/drivers/input/misc/apanel.c index 7276657ad7ca..3b7e2f032f33 100644 --- a/drivers/input/misc/apanel.c +++ b/drivers/input/misc/apanel.c @@ -115,7 +115,7 @@ static int mail_led_set(struct led_classdev *led, enum led_brightness value) { struct apanel *ap = container_of(led, struct apanel, mail_led); - u16 led_bits = value != LED_OFF ? 0x8000 : 0x0000; + u16 led_bits = value != 0 ? 0x8000 : 0x0000; return i2c_smbus_write_word_data(ap->client, 0x10, led_bits); } @@ -189,7 +189,7 @@ static void apanel_shutdown(struct i2c_client *client) struct apanel *ap = i2c_get_clientdata(client); if (device_chip[APANEL_DEV_LED] != CHIP_NONE) - led_set_brightness(&ap->mail_led, LED_OFF); + led_set_brightness(&ap->mail_led, 0); } static const struct i2c_device_id apanel_id[] = { diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c index 6f38aa23a1ff..9665f371837d 100644 --- a/drivers/input/misc/ims-pcu.c +++ b/drivers/input/misc/ims-pcu.c @@ -986,7 +986,7 @@ ims_pcu_backlight_get_brightness(struct led_classdev *cdev) "Failed to get current brightness, error: %d\n", error); /* Assume the LED is OFF */ - brightness = LED_OFF; + brightness = 0; } else { brightness = get_unaligned_le16(&pcu->cmd_buf[IMS_PCU_DATA_OFFSET]); diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index 80dfd72a02d3..cd290722a389 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c @@ -1039,14 +1039,14 @@ static bool bluetooth_enabled; static void wistron_mail_led_set(struct led_classdev *led_cdev, enum led_brightness value) { - bios_set_state(MAIL_LED, (value != LED_OFF) ? 1 : 0); + bios_set_state(MAIL_LED, (value != 0) ? 1 : 0); } /* same as setting up wifi card, but for laptops on which the led is managed */ static void wistron_wifi_led_set(struct led_classdev *led_cdev, enum led_brightness value) { - bios_set_state(WIFI, (value != LED_OFF) ? 1 : 0); + bios_set_state(WIFI, (value != 0) ? 1 : 0); } static struct led_classdev wistron_mail_led = { @@ -1064,7 +1064,7 @@ static void wistron_led_init(struct device *parent) if (leds_present & FE_WIFI_LED) { u16 wifi = bios_get_default_setting(WIFI); if (wifi & 1) { - wistron_wifi_led.brightness = (wifi & 2) ? LED_FULL : LED_OFF; + wistron_wifi_led.brightness = (wifi & 2) ? LED_FULL : 0; if (led_classdev_register(parent, &wistron_wifi_led)) leds_present &= ~FE_WIFI_LED; else @@ -1076,7 +1076,7 @@ static void wistron_led_init(struct device *parent) if (leds_present & FE_MAIL_LED) { /* bios_get_default_setting(MAIL) always retuns 0, so just turn the led off */ - wistron_mail_led.brightness = LED_OFF; + wistron_mail_led.brightness = 0; if (led_classdev_register(parent, &wistron_mail_led)) leds_present &= ~FE_MAIL_LED; else From patchwork Fri Jan 21 16:54:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Sampaio X-Patchwork-Id: 12719965 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FFB3C433F5 for ; Fri, 21 Jan 2022 16:54:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379151AbiAUQyo (ORCPT ); Fri, 21 Jan 2022 11:54:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379312AbiAUQye (ORCPT ); Fri, 21 Jan 2022 11:54:34 -0500 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 862E3C06173B; Fri, 21 Jan 2022 08:54:34 -0800 (PST) Received: by mail-oi1-x234.google.com with SMTP id s127so14381111oig.2; Fri, 21 Jan 2022 08:54:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gMvwDdKHz8SxD4XNsSXi0ifYKZbrqBGSjCLlHvwqADI=; b=bFxWZzsGiGVdBe5x6szZZuz5pjdNt6E15NqjGO8IZpJRKXyU1CUVtQfiS7nQ85w9Hr a2F1y2md9h0rVZQajdIrclWiJ+nPA3vP/ZbKGqY1iQ5LhRK5axOYZFH1PI5vO/zWWhHl Eor7nYxkOYgUmAvJXNbqMrfjOckjduoYsdX4Y6JNRzNb3G1lgccNCs7Y980we11ot3UN XHQSZwNj5VD7/nnNJ8r4qN9vTm6Bj+G85IZM4HPdO+1G2RHVJXmzMRqb+7g60TcsjCK4 wuMh1c/1/kQbcrDd8GS8Jj8JzJYBPQdU0Ypn6G0fz+xx25Wr4xWQNsmqWf1XxJQQbtiZ KVQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gMvwDdKHz8SxD4XNsSXi0ifYKZbrqBGSjCLlHvwqADI=; b=v6NZrRcc03i/LAx1MtmQH/zsI3ox74a08ew4B2sK0zop3ll94wwmMr8qkDKWbac48/ Gjl1DtXTn5shBeK3f4HEWrHBfeU4xiX89XpGk3ZQAU/btCgvLptYNLFv7J7iEkRBrcdh wN2hNE/F4r9FOOl4OWCgurdXtiS9VTk9LAVsSJGBbsGSNSdhSZ/iM0HQhLheho9cyzFd gY/AxgMuzSCfLxL+Lsc+91TNrNZz4rWjeGJy5QGDfZRiCQTuJlxfCH1yP/WqyByOrNnu VSCxhljM7hHWIQnSCCg/be+/5q1Raq2MiD5w5BmnOg47bs3bvPZX0Q+u6vSq3GKnPENr hizg== X-Gm-Message-State: AOAM533X99YDAl/Qj01E6p/xeeJiHtdw471z2LKx/RV/11aWKu72DYdS O+glebWAECoSg1ZFgzJN1e0= X-Google-Smtp-Source: ABdhPJynqGcrSez4vywi3ZAwZ9c1EdrO57Z15fp5aZAFGlBkrVlL1jMCkHBNN5fSrWBvd5Uebtem0g== X-Received: by 2002:a05:6808:171c:: with SMTP id bc28mr1273461oib.102.1642784073967; Fri, 21 Jan 2022 08:54:33 -0800 (PST) Received: from thinkpad.localdomain ([2804:14d:5cd1:5d03:cf72:4317:3105:f6e5]) by smtp.gmail.com with ESMTPSA id y8sm1089271oou.23.2022.01.21.08.54.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jan 2022 08:54:33 -0800 (PST) From: Luiz Sampaio To: Dmitry Torokhov , Maxime Coquelin , Alexandre Torgue Cc: linux-kernel@vger.kernel.org, Luiz Sampaio , linux-input@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH 07/31] input: touchscreen: changing LED_* from enum led_brightness to actual value Date: Fri, 21 Jan 2022 13:54:12 -0300 Message-Id: <20220121165436.30956-8-sampaio.ime@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220121165436.30956-1-sampaio.ime@gmail.com> References: <20220121165436.30956-1-sampaio.ime@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The enum led_brightness, which contains the declaration of LED_OFF, LED_ON, LED_HALF and LED_FULL is obsolete, as the led class now supports max_brightness. --- drivers/input/touchscreen/stmfts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c index bc11203c9cf7..7e7cb5f4d6d3 100644 --- a/drivers/input/touchscreen/stmfts.c +++ b/drivers/input/touchscreen/stmfts.c @@ -608,8 +608,8 @@ static int stmfts_enable_led(struct stmfts_data *sdata) return PTR_ERR(sdata->ledvdd); sdata->led_cdev.name = STMFTS_DEV_NAME; - sdata->led_cdev.max_brightness = LED_ON; - sdata->led_cdev.brightness = LED_OFF; + sdata->led_cdev.max_brightness = 1; + sdata->led_cdev.brightness = 0; sdata->led_cdev.brightness_set_blocking = stmfts_brightness_set; sdata->led_cdev.brightness_get = stmfts_brightness_get;