From nobody Tue Dec 16 07:11:29 2025 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52ED31FCFE1 for ; Tue, 14 Jan 2025 19:27:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736882829; cv=none; b=iHrQzhkoa7I4jXu3aostpd4nSwaQztcE/m4qz0oMSOXN+uHrvgJqJCv4gOeBn0zL019plEtOqDQtIAsNuSRKd1aXTgzNA21KmHWlDcGXjmZj5bduVbTPcjpb8zCpqwwUsR6SSdi/Ql61i4hzBqC737zl2eQS2BypwA9HvI26u/8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736882829; c=relaxed/simple; bh=gVJP5Jg81qGZKKRUEwfmgfnWVlw734FUnPO1b91n00Q=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=tWs78MpV/EgWQwOMA4+ywnFCUk9gZo7egg9LcRkrEebQI0v5n2z5Yi0xMAPYjFvhrOL0a7Jt5fnrl3HcKy7SstUf3djQvC8bMMZlGAw9dprO5lNFQBuIh3SgBTSdLEn3ExUpjxamtJOubmMy45m1pVX2GYlMN5RA4Xcvf8vjDtw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=c34Gvt11; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="c34Gvt11" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-436230de7a3so7442285e9.0 for ; Tue, 14 Jan 2025 11:27:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736882825; x=1737487625; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+bATdNNm6oROH7DmGPi86a2d525hCzDgyz+yfNCQAV8=; b=c34Gvt11xT0pyUOV0QiYYkuuEHvkFSx9lVLvehWeqLkq40H8NcZaz9Jw4xyLlNKY2z v9HB4DETDiJB/M2iU2NpyQ5+vTK8aRff97Cyb60jx6/ePDOlsWXWluoUcUMbeS6c6pgU cWiopWQhQooOTvIPdA/cPiUSyPSNjGBDlpX+WtJKd+b3DpLNVxdSfmaDdDt/aYvOKsg7 IcIBk3h540cv2zyPiE+0fbQHsy92E1nmTWaJwd7bvd6MuC5B0L3bq9VgJDDXjl3JK4tg vAXY+RzAWvHx0XaqE/0NJcikT5HpOvfyzRgT3fuR2ZTyfsIiqJquEYWYh8DScqt/e8U8 eITA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736882825; x=1737487625; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+bATdNNm6oROH7DmGPi86a2d525hCzDgyz+yfNCQAV8=; b=qI29GLb8Gu/0G68siR5eSEEtyieFvwn2V8SmwTtoy+syrXth6TKSm2calsLz+7Dn2A NDjt3kIDABNSn+MFs3NXul9AInPgqFZhu6OtapX1Hay5R9MiPJL0jiNQLVyNBrFAozwe zZ4eEfFQUu8r+i7BN3Y4Aqz6e/fnvgRV1gaQ1sB8lC0ixUzWarKWeIfZoVo0d+u1s16z ZlurDjaUZ3GmeC+RShGD6Yl2OQG8bSnUSRtFoc2LxM0ObmJanPkxUrpZdiuBJAOkFaWT FnwBCrGqY0IW25lTsOL036qNd5WkXAI7coAbArs2Tg0iWIhv6qEj5JkrSpKS/wTehTBf 3ljQ== X-Forwarded-Encrypted: i=1; AJvYcCUEyJll++40oRuLsRWH/J0ht7FltdiHHjZQpqujdJkAONVKExJdMcw7+vvvCuLAOjSzc5yw3U34XnFyO/4=@vger.kernel.org X-Gm-Message-State: AOJu0YxmIrD6a0NBY/grxvHs7a/tDJK5ThZAr93Gkdmp6ff1omarhh30 xbDQzcP+7a/3eBXwshzuq4aqRSWifUWLFMoFucHiyN+/94Y2fTN97BBRckiteM8= X-Gm-Gg: ASbGncsh1imgQFpUp5pDeM0JVvmpzT/O1vjKwSi4PFxy2QaxmA2gRFzEIVHpxMFIH9z 32Pjcw8nm5zSEcaApBhOwLlh9lyadVnxkZMqEQSKJulW8+9mzfUw/9J490ekRsfrlYP12QItO1w ndLKZFxh1I3KMt8OhriOQuN+h6YT1y6Tj/bH/Oah/iS/Fr1ej8wgXObFB9nz322le9Ro3OwJDZ1 UzOTQIda5DshDiHFsVWzoilQL0NdhxtRzAiZCucPXyeg9WexQ9qOXd7CTI8o1k3uKGUriM= X-Google-Smtp-Source: AGHT+IGb8aq00KxoF5vxDMZtXfYyxv0xsd0RB8pv4GDq4SzRtVE48lDFpnjuIxIeZoA6YQ2UxGGtBA== X-Received: by 2002:a5d:47a6:0:b0:385:faec:d93d with SMTP id ffacd0b85a97d-38a8731c585mr8176695f8f.13.1736882825551; Tue, 14 Jan 2025 11:27:05 -0800 (PST) Received: from krzk-bin.. ([178.197.223.165]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e4b82ddsm15555179f8f.71.2025.01.14.11.27.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 11:27:04 -0800 (PST) From: Krzysztof Kozlowski To: Linus Walleij , Dmitry Torokhov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH] Input: Use str_enable_disable-like helpers Date: Tue, 14 Jan 2025 20:27:01 +0100 Message-ID: <20250114192701.912430-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace ternary (condition ? "enable" : "disable") syntax with helpers from string_choices.h because: 1. Simple function call with one argument is easier to read. Ternary operator has three arguments and with wrapping might lead to quite long code. 2. Is slightly shorter thus also easier to read. 3. It brings uniformity in the text - same string. 4. Allows deduping by the linker, which results in a smaller binary file. Signed-off-by: Krzysztof Kozlowski --- drivers/input/keyboard/dlink-dir685-touchkeys.c | 3 ++- drivers/input/keyboard/lm8323.c | 3 ++- drivers/input/misc/max77693-haptic.c | 3 ++- drivers/input/misc/regulator-haptic.c | 3 ++- drivers/input/mouse/elan_i2c_core.c | 3 ++- drivers/input/touchscreen/egalax_ts.c | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/input/keyboard/dlink-dir685-touchkeys.c b/drivers/inpu= t/keyboard/dlink-dir685-touchkeys.c index 993cdbda509e..4184dd2eaeeb 100644 --- a/drivers/input/keyboard/dlink-dir685-touchkeys.c +++ b/drivers/input/keyboard/dlink-dir685-touchkeys.c @@ -14,6 +14,7 @@ #include #include #include +#include #include =20 struct dir685_touchkeys { @@ -48,7 +49,7 @@ static irqreturn_t dir685_tk_irq_thread(int irq, void *da= ta) changed =3D tk->cur_key ^ key; for_each_set_bit(i, &changed, num_bits) { dev_dbg(tk->dev, "key %d is %s\n", i, - test_bit(i, &key) ? "down" : "up"); + str_down_up(test_bit(i, &key))); input_report_key(tk->input, tk->codes[i], test_bit(i, &key)); } =20 diff --git a/drivers/input/keyboard/lm8323.c b/drivers/input/keyboard/lm832= 3.c index e26bf2956344..e19442c6f80f 100644 --- a/drivers/input/keyboard/lm8323.c +++ b/drivers/input/keyboard/lm8323.c @@ -21,6 +21,7 @@ #include #include #include +#include =20 /* Commands to send to the chip. */ #define LM8323_CMD_READ_ID 0x80 /* Read chip ID. */ @@ -269,7 +270,7 @@ static void process_keys(struct lm8323_chip *lm) unsigned short keycode =3D lm->keymap[key]; =20 dev_vdbg(&lm->client->dev, "key 0x%02x %s\n", - key, isdown ? "down" : "up"); + key, str_down_up(isdown)); =20 if (lm->kp_enabled) { input_event(lm->idev, EV_MSC, MSC_SCAN, key); diff --git a/drivers/input/misc/max77693-haptic.c b/drivers/input/misc/max7= 7693-haptic.c index 0e646f1b257b..cdb9be737e48 100644 --- a/drivers/input/misc/max77693-haptic.c +++ b/drivers/input/misc/max77693-haptic.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -94,7 +95,7 @@ static int max77843_haptic_bias(struct max77693_haptic *h= aptic, bool on) on << MAINCTRL1_BIASEN_SHIFT); if (error) { dev_err(haptic->dev, "failed to %s bias: %d\n", - on ? "enable" : "disable", error); + str_enable_disable(on), error); return error; } =20 diff --git a/drivers/input/misc/regulator-haptic.c b/drivers/input/misc/reg= ulator-haptic.c index 3666ba6d1f30..9711f5c7c78a 100644 --- a/drivers/input/misc/regulator-haptic.c +++ b/drivers/input/misc/regulator-haptic.c @@ -14,6 +14,7 @@ #include #include #include +#include =20 #define MAX_MAGNITUDE_SHIFT 16 =20 @@ -44,7 +45,7 @@ static int regulator_haptic_toggle(struct regulator_hapti= c *haptic, bool on) if (error) { dev_err(haptic->dev, "failed to switch regulator %s: %d\n", - on ? "on" : "off", error); + str_on_off(on), error); return error; } =20 diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan= _i2c_core.c index a841883660fb..fee1796da3d0 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -199,7 +200,7 @@ static int elan_set_power(struct elan_tp_data *data, bo= ol on) } while (--repeat > 0); =20 dev_err(&data->client->dev, "failed to set power %s: %d\n", - on ? "on" : "off", error); + str_on_off(on), error); return error; } =20 diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscr= een/egalax_ts.c index f4e950920e84..eb3cc2befcdf 100644 --- a/drivers/input/touchscreen/egalax_ts.c +++ b/drivers/input/touchscreen/egalax_ts.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include =20 @@ -102,7 +103,7 @@ static irqreturn_t egalax_ts_interrupt(int irq, void *d= ev_id) input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, down); =20 dev_dbg(&client->dev, "%s id:%d x:%d y:%d z:%d", - down ? "down" : "up", id, x, y, z); + str_down_up(down), id, x, y, z); =20 if (down) { input_report_abs(input_dev, ABS_MT_POSITION_X, x); --=20 2.43.0