From nobody Tue Dec 16 05:58:58 2025 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (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 A173828EC65 for ; Tue, 14 Jan 2025 10:56:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736852170; cv=none; b=ZajNaXDrXRy6GiQiouxqTfGhiHgk2msB/6V2FaY+yEwXVhbcTC1whE+OiN4nF9qtG5wfGFZM5y5IUk8JCVasLg45veM90GAZU/X7XHQcArP8KrO71ktJITrXB3/wLoSv7AXivdTbtpNfSo4pIh9dvboWn2LOCBbDJ8IiocPw6xM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736852170; c=relaxed/simple; bh=5iLy2hS7XOaApDudXBmJDbTDRFkhrr67i5YCTiK8Olo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=AcIG/L0AUc8PtptcSzX3M89GfeX75XWaWahVJqQMtgSCCMNKWP8Skb5YnBggS8DaT2a0ayOlUy/lH7IkKktQ9owsNbT9EdFIths3FWOTuumoFOV1YCHBBrh6n1QmXFsHoaGX6pKe8XkdGG2n191DG6pjBxW8BbbrnXxKLEQvfFk= 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=YyOJGFB7; arc=none smtp.client-ip=209.85.218.54 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="YyOJGFB7" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-aa6965ad2a5so76542766b.3 for ; Tue, 14 Jan 2025 02:56:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736852167; x=1737456967; 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=8MfSYP+zHL+pnuiJhgBQ6vL5nCjPi7bURf1tspTScy8=; b=YyOJGFB7i58IkC0skJ+dc7y87kf+uvEMjAXKNvlvJnA7mTYw5gLnO3QjjaxyG6FFDq kO7NjGzyBBO+qv+sawqLtOALAAjh+AhBf4ph2d43nFG1ApY8N0gxOYMF+DwdqoFcK9f/ hlXuYuQtZ1jwdTK+1D9D1NtBGTfKEJ8Lp5IzarDKYClBoxg+vr9O8ydLKo+LbxlyRpDH 0rW+YxnUDTLROFUYUsW7iR3S4JZP7pw1HEU1gn5VLVkEfxgworeDGSiiSHaiuyzSOasn XP4+Alov0HFK1DwUtNy5gf+UYy7Ka/vA8hUfFf2VraRUeCrw1DwniM/6f0GfyF0KG8mX 066w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736852167; x=1737456967; 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=8MfSYP+zHL+pnuiJhgBQ6vL5nCjPi7bURf1tspTScy8=; b=NJPLx1FNHbBaT3/zk/QsUpcz3ImQlxLlTbEJYWFLdtRgFjxnr5mG8pOrr9u+GL5bRM WIpb0YJizmQtkYzB9XasRG+ZN0JKt8AeAIoYA7qVFBARiOqNERf0ukDBFTJjRGFozNeK rohdC99QguYQ+GKX12jX421wWyvmjS3L6DZRuAlb8Pzzh/8Mf8NKnxT3BvCDxLOTiFQv XC89GQ0v16UXs4mfuBdpG315ybyaFStgaNwgECszeur+8ncEycTbt2omLh4I4XTf2toz wp3jlU/J5Pp5NcXqZ1Mgc9Y6YIsUUNCB7M7vBlfE6TWQjUVrWd27BCorsHfMAple8HZi de7w== X-Forwarded-Encrypted: i=1; AJvYcCUb6EILSY1UeOsHEJ+GCZXeSQ0Osr6uGMBX4haP5lMLKy08kXQ1Qdffx5aRe5yB4nwWRL6kY2VKXc73ZGQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxwVJwLPVndeLIS9MgtPd0wPDKP2iDVEHvHJ4ealJGgMeN+jUZh 4HdonpGrl4qtF7SgfAf+EdgAVDGEuEU1nTkG8xKzYwY1F0K/qKsLzF5kYh9toUs= X-Gm-Gg: ASbGnctWueabxS4KftSHGYQ7R3jhHHGFAn7GbZU7G9OXUHnDpCadameUBbK3u582EbC 37JIXCZuNvL1GPztpU94b+TEgXBEe/8l/U1jFWYZKNtHL3JTWLB70WdgEDvSv8uncAcj25Jh9FF ZPNwMi0M1fugfuIm1mel+LM7gPgQvRY3rHZdFwATS0hGNk9/ih/R79vxCAZuzF9JVXWy1Vquao3 p8JjIrD7kFfeY0kyqBP1WH+RUgfyn3ZipE0uaLQ/fYUldQweC5bisbVG5Re+hJme3Ms83o= X-Google-Smtp-Source: AGHT+IEGacWavSt1ZemW96X2/5CF52o/Rb8UF/rMn9Kj0ERefG3jnd1ifdAhMXGxA87TqYevuWfBVA== X-Received: by 2002:a17:907:3f95:b0:aae:b259:ef5c with SMTP id a640c23a62f3a-ab2aad0b170mr894511266b.0.1736852166981; Tue, 14 Jan 2025 02:56:06 -0800 (PST) Received: from krzk-bin.. ([178.197.223.165]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab2c913804esm610170966b.84.2025.01.14.02.56.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 02:56:06 -0800 (PST) From: Krzysztof Kozlowski To: Herbert Xu , "David S. Miller" , Giovanni Cabiddu , Boris Brezillon , Arnaud Ebalard , Srujana Challa , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, qat-linux@intel.com Cc: Krzysztof Kozlowski Subject: [PATCH] crypto: Use str_enable_disable-like helpers Date: Tue, 14 Jan 2025 11:56:03 +0100 Message-ID: <20250114105603.273161-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 Acked-by: Giovanni Cabiddu --- drivers/crypto/bcm/cipher.c | 3 ++- drivers/crypto/bcm/spu2.c | 3 ++- drivers/crypto/intel/qat/qat_common/adf_sysfs.c | 10 +++------- drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c | 5 +++-- drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c | 3 ++- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c index 9e6798efbfb7..66accd8e08f6 100644 --- a/drivers/crypto/bcm/cipher.c +++ b/drivers/crypto/bcm/cipher.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -2687,7 +2688,7 @@ static int aead_enqueue(struct aead_request *req, boo= l is_encrypt) flow_log(" iv_ctr_len:%u\n", rctx->iv_ctr_len); flow_dump(" iv: ", req->iv, rctx->iv_ctr_len); flow_log(" authkeylen:%u\n", ctx->authkeylen); - flow_log(" is_esp: %s\n", ctx->is_esp ? "yes" : "no"); + flow_log(" is_esp: %s\n", str_yes_no(ctx->is_esp)); =20 if (ctx->max_payload =3D=3D SPU_MAX_PAYLOAD_INF) flow_log(" max_payload infinite"); diff --git a/drivers/crypto/bcm/spu2.c b/drivers/crypto/bcm/spu2.c index 3fdc64b5a65e..ce322cf1baa5 100644 --- a/drivers/crypto/bcm/spu2.c +++ b/drivers/crypto/bcm/spu2.c @@ -11,6 +11,7 @@ =20 #include #include +#include =20 #include "util.h" #include "spu.h" @@ -999,7 +1000,7 @@ u32 spu2_create_request(u8 *spu_hdr, req_opts->is_inbound, req_opts->auth_first); flow_log(" cipher alg:%u mode:%u type %u\n", cipher_parms->alg, cipher_parms->mode, cipher_parms->type); - flow_log(" is_esp: %s\n", req_opts->is_esp ? "yes" : "no"); + flow_log(" is_esp: %s\n", str_yes_no(req_opts->is_esp)); flow_log(" key: %d\n", cipher_parms->key_len); flow_dump(" key: ", cipher_parms->key_buf, cipher_parms->key_len); flow_log(" iv: %d\n", cipher_parms->iv_len); diff --git a/drivers/crypto/intel/qat/qat_common/adf_sysfs.c b/drivers/cryp= to/intel/qat/qat_common/adf_sysfs.c index 4fcd61ff70d1..84450bffacb6 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_sysfs.c +++ b/drivers/crypto/intel/qat/qat_common/adf_sysfs.c @@ -3,6 +3,7 @@ #include #include #include +#include #include "adf_accel_devices.h" #include "adf_cfg.h" #include "adf_cfg_services.h" @@ -19,14 +20,12 @@ static ssize_t state_show(struct device *dev, struct de= vice_attribute *attr, char *buf) { struct adf_accel_dev *accel_dev; - char *state; =20 accel_dev =3D adf_devmgr_pci_to_accel_dev(to_pci_dev(dev)); if (!accel_dev) return -EINVAL; =20 - state =3D adf_dev_started(accel_dev) ? "up" : "down"; - return sysfs_emit(buf, "%s\n", state); + return sysfs_emit(buf, "%s\n", str_up_down(adf_dev_started(accel_dev))); } =20 static ssize_t state_store(struct device *dev, struct device_attribute *at= tr, @@ -207,16 +206,13 @@ static DEVICE_ATTR_RW(pm_idle_enabled); static ssize_t auto_reset_show(struct device *dev, struct device_attribute= *attr, char *buf) { - char *auto_reset; struct adf_accel_dev *accel_dev; =20 accel_dev =3D adf_devmgr_pci_to_accel_dev(to_pci_dev(dev)); if (!accel_dev) return -EINVAL; =20 - auto_reset =3D accel_dev->autoreset_on_error ? "on" : "off"; - - return sysfs_emit(buf, "%s\n", auto_reset); + return sysfs_emit(buf, "%s\n", str_on_off(accel_dev->autoreset_on_error)); } =20 static ssize_t auto_reset_store(struct device *dev, struct device_attribut= e *attr, diff --git a/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c b/drivers/cr= ypto/marvell/octeontx/otx_cptpf_ucode.c index c4250e5fcf8f..2c08e928e44e 100644 --- a/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c +++ b/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c @@ -10,6 +10,7 @@ =20 #include #include +#include #include "otx_cpt_common.h" #include "otx_cptpf_ucode.h" #include "otx_cptpf.h" @@ -614,8 +615,8 @@ static void print_dbg_info(struct device *dev, =20 for (i =3D 0; i < OTX_CPT_MAX_ENGINE_GROUPS; i++) { grp =3D &eng_grps->grp[i]; - pr_debug("engine_group%d, state %s\n", i, grp->is_enabled ? - "enabled" : "disabled"); + pr_debug("engine_group%d, state %s\n", i, + str_enabled_disabled(grp->is_enabled)); if (grp->is_enabled) { mirrored_grp =3D &eng_grps->grp[grp->mirror.idx]; pr_debug("Ucode0 filename %s, version %s\n", diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c b/drivers/= crypto/marvell/octeontx2/otx2_cptpf_ucode.c index 5c9484646172..881fce53e369 100644 --- a/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c +++ b/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c @@ -3,6 +3,7 @@ =20 #include #include +#include #include "otx2_cptpf_ucode.h" #include "otx2_cpt_common.h" #include "otx2_cptpf.h" @@ -1835,7 +1836,7 @@ void otx2_cpt_print_uc_dbg_info(struct otx2_cptpf_dev= *cptpf) for (i =3D 0; i < OTX2_CPT_MAX_ENGINE_GROUPS; i++) { grp =3D &eng_grps->grp[i]; pr_debug("engine_group%d, state %s", i, - grp->is_enabled ? "enabled" : "disabled"); + str_enabled_disabled(grp->is_enabled)); if (grp->is_enabled) { mirrored_grp =3D &eng_grps->grp[grp->mirror.idx]; pr_debug("Ucode0 filename %s, version %s", --=20 2.43.0