From nobody Tue Dec 2 02:31:06 2025 Received: from mailtransmit05.runbox.com (mailtransmit05.runbox.com [185.226.149.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92B3C2F83A1 for ; Wed, 19 Nov 2025 22:42:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.226.149.38 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763592159; cv=none; b=nUrUm4W7lCi7sb0V9iiabwJiNPSyFcV1k6+n0VAPbqvFJ08JpEUCf6AtBdr7C95NyU8hkZpNpqWOOKCKudk5bsbR+u1sSr3wcOX9ymimeSvAVlib9LT3c/On35QlQYPRPp3eRgakhWXoGy1qTmqQ+O2fsu88s9ISC+nVsTxQg2E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763592159; c=relaxed/simple; bh=OFaVoQDDWiVDx4c2WXlL8vnBK1/eYof2473GrDd+z20=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Fnctzm3g9cMW8w7bo3eG18nolkWtm7Ma5uyFViIDSsPJdhrJmWyiEDfPD4mN9QO2e+MQQCoXFQpWQ8Rs4oCCnRyXoQD4xPoZfRcV2osm51u5iGNV+zq6YIlI5ptABN3KU0pu9hKRKVa8ngR3M9DNYdhZ+ktYgaTvD4+DQjUQhO0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=runbox.com; dkim=pass (2048-bit key) header.d=runbox.com header.i=@runbox.com header.b=mF/O4SqD; arc=none smtp.client-ip=185.226.149.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=runbox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=runbox.com header.i=@runbox.com header.b="mF/O4SqD" Received: from mailtransmit03.runbox ([10.9.9.163] helo=aibo.runbox.com) by mailtransmit05.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1vLqsk-006ks3-BL; Wed, 19 Nov 2025 23:42:34 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector1; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To :Message-Id:Date:Subject:Cc:To:From; bh=ROLxgtuAVt/BzKpbOFcQBVPVvKjXAYO6Mvo+kOdOmhM=; b=mF/O4SqDl18pINjtwUQmsPxwog liVwA+IGYpf3a28aKbL6BjgyfeRcXGnt2zSfggukEe147xoFkC1NvTaRupwBJ62DV+pQitFnZGSE4 pG6B0KjgYV6e1u/QX/xS9j5AgzUr0fqXZEqmVQCzoUqNg+NR3INRR2z9H2c3x75U5VI2haDmIN1gu cwDqdUAvWnPZ4lbd2CNY19vx52egwEvxLZ6MIEGqrlT13pQ96tkgA4X0hguJlcDYg7hji2X4s1QFg yERus/EPM+YSBDe+bA3uof3SQ82hOK6Zsp23Pu+0EiAPHhPWQerPMrjFORepRSVvALpeqRTPoN1HE Oh7ySs4w==; Received: from [10.9.9.74] (helo=submission03.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1vLqsk-000051-2O; Wed, 19 Nov 2025 23:42:34 +0100 Received: by submission03.runbox with esmtpsa [Authenticated ID (1493616)] (TLS1.2:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) id 1vLqsX-00Fos6-RO; Wed, 19 Nov 2025 23:42:21 +0100 From: david.laight.linux@gmail.com To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Laight Subject: [PATCH 08/44] net: ethtool: Use min3() instead of nested min_t(u16,...) Date: Wed, 19 Nov 2025 22:41:04 +0000 Message-Id: <20251119224140.8616-9-david.laight.linux@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20251119224140.8616-1-david.laight.linux@gmail.com> References: <20251119224140.8616-1-david.laight.linux@gmail.com> 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" From: David Laight In ethtool_cmis_cdb_execute_epl_cmd() change space_left and bytes_to_write from u16 to u32. Although the values may fit in 16 bits, 32bit variables will generate better code. Replace the nested min_t(u16, bytes_left, min_t(u16, space_left, x)) with a call to min3(). Signed-off-by: David Laight --- net/ethtool/cmis_cdb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/net/ethtool/cmis_cdb.c b/net/ethtool/cmis_cdb.c index 3057576bc81e..1406205e047e 100644 --- a/net/ethtool/cmis_cdb.c +++ b/net/ethtool/cmis_cdb.c @@ -573,12 +573,11 @@ ethtool_cmis_cdb_execute_epl_cmd(struct net_device *d= ev, while (offset <=3D CMIS_CDB_EPL_FW_BLOCK_OFFSET_END && bytes_written < epl_len) { u32 bytes_left =3D epl_len - bytes_written; - u16 space_left, bytes_to_write; + u32 space_left, bytes_to_write; =20 space_left =3D CMIS_CDB_EPL_FW_BLOCK_OFFSET_END - offset + 1; - bytes_to_write =3D min_t(u16, bytes_left, - min_t(u16, space_left, - args->read_write_len_ext)); + bytes_to_write =3D min3(bytes_left, space_left, + args->read_write_len_ext); =20 err =3D __ethtool_cmis_cdb_execute_cmd(dev, page_data, page, offset, --=20 2.39.5