From nobody Mon Dec 15 21:47:14 2025 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 CECF91459FD for ; Tue, 14 Jan 2025 20:35:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736886946; cv=none; b=L29tila/qK+QAJueKBBox9I7bd627YWr/BgodFCjCFdwuGbK2mptcmvos61UPtyoKdbS9wocttqt+snRAXinHG6i0RyRxePLhSntUmwFyXKlcczbTkCJ9YGqOHmC/iKvmQBILN+RI0CdSAd26Uhdt6POBD6qmP5FWMBbgxQ0vpA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736886946; c=relaxed/simple; bh=plkHG2b3pikzp2brKrBMsmLwq4p3mj5P3BWw3lWgn/M=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=q7UKPoaJ0cOA9rfGAG/rig39D9E7hPV6pZbJj438YfnbJFXamhH//CIThvMPcApgxoQeUwwnuWwC+umJYR9/yJN8CXl9SbJ5Pu4YOjeGYFa80LMFS4vGv4jcA3dbYo93jWdmv2vNe7aXn1d024LIisrEDSdByAwFefikVslhKHs= 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=WdGsIrFa; arc=none smtp.client-ip=209.85.128.45 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="WdGsIrFa" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-436230de7a3so7535975e9.0 for ; Tue, 14 Jan 2025 12:35:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736886943; x=1737491743; 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=Ig/5LxUL10bhBFW0xWHuz8rUT0GzUhM//SEgmnsWbuo=; b=WdGsIrFafDqrQzPog2g/xrMkECrca7giQTxDcJVO7pvxwXNyc/8uaZUXoQkcWtgLRg hkMpv8qy0V4EYAMBXbxTymTkUyo/jZ/JK+ztNRDUhZoU2uLy9w7tZcrrJnB4ARp1gHCu 0a95fjwSfOJgrtAWsmSKla39xznKgzcS7A2kV1WDYPGOqrjDu3Wd4ZZDdVlThWrfxJFn fBRqiiKFrOl9OIc/O08kbmrk5RBenTFqkMgNvbjTHt27TJV/a3dClLFFTV5swycZ+qXp KmDt0eRnJ7iydAP1WLKvbT8OJqn6QPHE2AsfYcfliJaRJvUvlp7JpQ6U+SaWXCVqlnTF mmwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736886943; x=1737491743; 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=Ig/5LxUL10bhBFW0xWHuz8rUT0GzUhM//SEgmnsWbuo=; b=QzlqQ9TeVxp0ukbxaWQsao8e1AwkOel9bmslrFTYRJi2F0NPW6GwxULq2rxfqEkYnt 94jILnPM6LvV3IeRfX30JrvYUOnlRxQxzg2UQHW5iTpIU/1rGiL/Zz4/CIQxSQT64nwb MsjyxbcVJTac26xq63PT2XHD1xlRtnHEu2eSm6qKZXvGWQZA6RLYkq+aPW59O2J+DdfO 4kSGqGovqu/4AlHpiqC2ZmLeiyEWQ8RvGylEU9ZakgV+5dkHWPv0gx/Yg7BOqPalabJf pbJXy5AL5i3e1RyobQ5xnPNza0ZYrXEpF/PzpExEOFOo3f+IpfdAuzduxnzEOyoN+rEN 2CAw== X-Forwarded-Encrypted: i=1; AJvYcCU2RzzD8B/N9N0afWX768vP9uApzUOu8bidB8D+gJX+nOuA/1eZqKTPbz7rdBj0MEsGiIHeBtoNoG5m2V8=@vger.kernel.org X-Gm-Message-State: AOJu0YwNqNBovWJO3wRFX4hv7Ly6BVKrcbDnxiSrd59MSWcf4rhiPIJ4 dPUXvRjzM7L4hCyl5flpCdCDIOJW6JnuNl7g8Qk1y5chaEE52tJidS7BKSM4Cis= X-Gm-Gg: ASbGncvyIQMcyQBLXn+Nl7xcj6kj39EcJwj1fhcF/0bDHchOHe0dSeEAd6tIX+5e79y 8XoJLsOrzh00pyUHYpCT+kZJxjzXcB5mzNXHts6/leJVXWF0NYlPbcQWHMn1JpgbMEoq02MX/aq apZ58aEveMYHm7ZnchjuKnRJK7Mx7+RnROK+/agZeW58D2HpsrKQ/KC3qZRejHK+zIYjhmA8P6J SqzInE47GUN80XM6Pc/BLKt6eLcQmZl8278Oslpq1Z0zAMipiVlqRuB2jOeqNc5sI8VHGA= X-Google-Smtp-Source: AGHT+IHWF7xnFpcXGXKNjhHTEjsUJ8iHcCbcevP7fJYnt+RuxU+qwF0tnnycUSXbl2RWpTG3C68iZw== X-Received: by 2002:a05:600c:1c88:b0:434:f22e:a5be with SMTP id 5b1f17b1804b1-436e270621emr94885475e9.8.1736886942974; Tue, 14 Jan 2025 12:35:42 -0800 (PST) Received: from krzk-bin.. ([178.197.223.165]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e9d8fc81sm189284205e9.5.2025.01.14.12.35.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 12:35:42 -0800 (PST) From: Krzysztof Kozlowski To: Vinod Koul , Kishon Vijay Abraham I , Ray Jui , Scott Branden , Broadcom internal kernel review list , Laurent Pinchart , Michal Simek , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH] phy: Use str_enable_disable-like helpers Date: Tue, 14 Jan 2025 21:35:37 +0100 Message-ID: <20250114203537.1012955-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 Reviewed-by: Florian Fainelli --- drivers/phy/broadcom/phy-bcm-cygnus-pcie.c | 3 ++- drivers/phy/realtek/phy-rtk-usb2.c | 15 ++++++++------- drivers/phy/realtek/phy-rtk-usb3.c | 9 +++++---- drivers/phy/ti/phy-twl4030-usb.c | 4 ++-- drivers/phy/xilinx/phy-zynqmp.c | 3 ++- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/phy/broadcom/phy-bcm-cygnus-pcie.c b/drivers/phy/broad= com/phy-bcm-cygnus-pcie.c index 462c61a24ec5..562d7d7151c5 100644 --- a/drivers/phy/broadcom/phy-bcm-cygnus-pcie.c +++ b/drivers/phy/broadcom/phy-bcm-cygnus-pcie.c @@ -7,6 +7,7 @@ #include #include #include +#include =20 #define PCIE_CFG_OFFSET 0x00 #define PCIE1_PHY_IDDQ_SHIFT 10 @@ -86,7 +87,7 @@ static int cygnus_pcie_power_config(struct cygnus_pcie_ph= y *phy, bool enable) =20 mutex_unlock(&core->lock); dev_dbg(core->dev, "PCIe PHY %d %s\n", phy->id, - enable ? "enabled" : "disabled"); + str_enabled_disabled(enable)); return 0; } =20 diff --git a/drivers/phy/realtek/phy-rtk-usb2.c b/drivers/phy/realtek/phy-r= tk-usb2.c index 248550ef98ca..14543636796d 100644 --- a/drivers/phy/realtek/phy-rtk-usb2.c +++ b/drivers/phy/realtek/phy-rtk-usb2.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -729,7 +730,7 @@ static int rtk_usb2_parameter_show(struct seq_file *s, = void *unused) =20 seq_puts(s, "Property:\n"); seq_printf(s, " check_efuse: %s\n", - phy_cfg->check_efuse ? "Enable" : "Disable"); + str_enable_disable(phy_cfg->check_efuse)); seq_printf(s, " check_efuse_version: %d\n", phy_cfg->check_efuse_version); seq_printf(s, " efuse_dc_driving_rate: %d\n", @@ -741,17 +742,17 @@ static int rtk_usb2_parameter_show(struct seq_file *s= , void *unused) seq_printf(s, " dc_disconnect_mask: 0x%x\n", phy_cfg->dc_disconnect_mask); seq_printf(s, " usb_dc_disconnect_at_page0: %s\n", - phy_cfg->usb_dc_disconnect_at_page0 ? "true" : "false"); + str_true_false(phy_cfg->usb_dc_disconnect_at_page0)); seq_printf(s, " do_toggle: %s\n", - phy_cfg->do_toggle ? "Enable" : "Disable"); + str_enable_disable(phy_cfg->do_toggle)); seq_printf(s, " do_toggle_driving: %s\n", - phy_cfg->do_toggle_driving ? "Enable" : "Disable"); + str_enable_disable(phy_cfg->do_toggle_driving)); seq_printf(s, " driving_updated_for_dev_dis: 0x%x\n", phy_cfg->driving_updated_for_dev_dis); seq_printf(s, " use_default_parameter: %s\n", - phy_cfg->use_default_parameter ? "Enable" : "Disable"); + str_enable_disable(phy_cfg->use_default_parameter)); seq_printf(s, " is_double_sensitivity_mode: %s\n", - phy_cfg->is_double_sensitivity_mode ? "Enable" : "Disable"); + str_enable_disable(phy_cfg->is_double_sensitivity_mode)); =20 for (index =3D 0; index < rtk_phy->num_phy; index++) { struct phy_parameter *phy_parameter; @@ -830,7 +831,7 @@ static int rtk_usb2_parameter_show(struct seq_file *s, = void *unused) seq_printf(s, " efuse_usb_dc_dis: %d\n", (int)phy_parameter->efuse_usb_dc_dis); seq_printf(s, " inverse_hstx_sync_clock: %s\n", - phy_parameter->inverse_hstx_sync_clock ? "Enable" : "Disable"); + str_enable_disable(phy_parameter->inverse_hstx_sync_clock)); seq_printf(s, " driving_level: %d\n", phy_parameter->driving_level); seq_printf(s, " driving_level_compensate: %d\n", diff --git a/drivers/phy/realtek/phy-rtk-usb3.c b/drivers/phy/realtek/phy-r= tk-usb3.c index cce453686db2..77ce58f98302 100644 --- a/drivers/phy/realtek/phy-rtk-usb3.c +++ b/drivers/phy/realtek/phy-rtk-usb3.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -363,13 +364,13 @@ static int rtk_usb3_parameter_show(struct seq_file *s= , void *unused) =20 seq_puts(s, "Property:\n"); seq_printf(s, " check_efuse: %s\n", - phy_cfg->check_efuse ? "Enable" : "Disable"); + str_enable_disable(phy_cfg->check_efuse)); seq_printf(s, " do_toggle: %s\n", - phy_cfg->do_toggle ? "Enable" : "Disable"); + str_enable_disable(phy_cfg->do_toggle)); seq_printf(s, " do_toggle_once: %s\n", - phy_cfg->do_toggle_once ? "Enable" : "Disable"); + str_enable_disable(phy_cfg->do_toggle_once)); seq_printf(s, " use_default_parameter: %s\n", - phy_cfg->use_default_parameter ? "Enable" : "Disable"); + str_enable_disable(phy_cfg->use_default_parameter)); =20 for (index =3D 0; index < rtk_phy->num_phy; index++) { struct phy_reg *phy_reg; diff --git a/drivers/phy/ti/phy-twl4030-usb.c b/drivers/phy/ti/phy-twl4030-= usb.c index 6f12b38cd894..4bf4c4f93b4c 100644 --- a/drivers/phy/ti/phy-twl4030-usb.c +++ b/drivers/phy/ti/phy-twl4030-usb.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include =20 @@ -567,8 +568,7 @@ static ssize_t vbus_show(struct device *dev, int ret =3D -EINVAL; =20 mutex_lock(&twl->lock); - ret =3D sprintf(buf, "%s\n", - twl->vbus_supplied ? "on" : "off"); + ret =3D sprintf(buf, "%s\n", str_on_off(twl->vbus_supplied)); mutex_unlock(&twl->lock); =20 return ret; diff --git a/drivers/phy/xilinx/phy-zynqmp.c b/drivers/phy/xilinx/phy-zynqm= p.c index 05a4a59f7c40..b96bdc39bcc7 100644 --- a/drivers/phy/xilinx/phy-zynqmp.c +++ b/drivers/phy/xilinx/phy-zynqmp.c @@ -23,6 +23,7 @@ #include #include #include +#include =20 #include =20 @@ -865,7 +866,7 @@ static int xpsgtr_status_read(struct seq_file *seq, voi= d *data) seq_printf(seq, "Reference clock: %u (%pC)\n", gtr_phy->refclk, clk); seq_printf(seq, "Reference rate: %lu\n", clk_get_rate(clk)); seq_printf(seq, "PLL locked: %s\n", - pll_status & PLL_STATUS_LOCKED ? "yes" : "no"); + str_yes_no(pll_status & PLL_STATUS_LOCKED)); =20 mutex_unlock(>r_phy->phy->mutex); return 0; --=20 2.43.0