]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
Bluetooth: Use str_enable_disable-like helpers
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tue, 14 Jan 2025 10:56:41 +0000 (11:56 +0100)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 15 Jan 2025 15:36:11 +0000 (10:36 -0500)
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 <krzysztof.kozlowski@linaro.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
drivers/bluetooth/btintel.c
drivers/bluetooth/btmrvl_main.c
drivers/bluetooth/hci_qca.c

index d496cf2c34111fc7f90aa1dcb9f6a2cfd9a5cd13..d2540b28bc7ae70adbd6574fda944f7a263926b3 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/module.h>
 #include <linux/firmware.h>
 #include <linux/regmap.h>
+#include <linux/string_choices.h>
 #include <linux/acpi.h>
 #include <acpi/acpi_bus.h>
 #include <linux/unaligned.h>
@@ -506,13 +507,13 @@ int btintel_version_info_tlv(struct hci_dev *hdev,
 
                bt_dev_info(hdev, "Device revision is %u", version->dev_rev_id);
                bt_dev_info(hdev, "Secure boot is %s",
-                           version->secure_boot ? "enabled" : "disabled");
+                           str_enabled_disabled(version->secure_boot));
                bt_dev_info(hdev, "OTP lock is %s",
-                           version->otp_lock ? "enabled" : "disabled");
+                           str_enabled_disabled(version->otp_lock));
                bt_dev_info(hdev, "API lock is %s",
-                           version->api_lock ? "enabled" : "disabled");
+                           str_enabled_disabled(version->api_lock));
                bt_dev_info(hdev, "Debug lock is %s",
-                           version->debug_lock ? "enabled" : "disabled");
+                           str_enabled_disabled(version->debug_lock));
                bt_dev_info(hdev, "Minimum firmware build %u week %u %u",
                            version->min_fw_build_nn, version->min_fw_build_cw,
                            2000 + version->min_fw_build_yy);
@@ -927,16 +928,16 @@ int btintel_read_boot_params(struct hci_dev *hdev,
                    le16_to_cpu(params->dev_revid));
 
        bt_dev_info(hdev, "Secure boot is %s",
-                   params->secure_boot ? "enabled" : "disabled");
+                   str_enabled_disabled(params->secure_boot));
 
        bt_dev_info(hdev, "OTP lock is %s",
-                   params->otp_lock ? "enabled" : "disabled");
+                   str_enabled_disabled(params->otp_lock));
 
        bt_dev_info(hdev, "API lock is %s",
-                   params->api_lock ? "enabled" : "disabled");
+                   str_enabled_disabled(params->api_lock));
 
        bt_dev_info(hdev, "Debug lock is %s",
-                   params->debug_lock ? "enabled" : "disabled");
+                   str_enabled_disabled(params->debug_lock));
 
        bt_dev_info(hdev, "Minimum firmware build %u week %u %u",
                    params->min_fw_build_nn, params->min_fw_build_cw,
index 18f34998a1204a3bf94ecae8a19bed5155a7e42f..e26b07a9387da77863a3f6df5e9b147e354a0e70 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/string_choices.h>
 #include <net/bluetooth/bluetooth.h>
 #include <net/bluetooth/hci_core.h>
 #include <linux/mmc/sdio_func.h>
@@ -88,7 +89,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
                        else
                                adapter->psmode = 0;
                        BT_DBG("PS Mode:%s",
-                               (adapter->psmode) ? "Enable" : "Disable");
+                              str_enable_disable(adapter->psmode));
                } else {
                        BT_DBG("PS Mode command failed");
                }
index 5d75087cca9981774eeff8115ce261bbd29508f9..0cfe40393600d50c0e49dbcff102ff31b9f9461a 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/pwrseq/consumer.h>
 #include <linux/regulator/consumer.h>
 #include <linux/serdev.h>
+#include <linux/string_choices.h>
 #include <linux/mutex.h>
 #include <linux/unaligned.h>
 
@@ -343,8 +344,8 @@ static void serial_clock_vote(unsigned long vote, struct hci_uart *hu)
                else
                        __serial_clock_off(hu->tty);
 
-               BT_DBG("Vote serial clock %s(%s)", new_vote ? "true" : "false",
-                      vote ? "true" : "false");
+               BT_DBG("Vote serial clock %s(%s)", str_true_false(new_vote),
+                      str_true_false(vote));
 
                diff = jiffies_to_msecs(jiffies - qca->vote_last_jif);