Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp188001rdb; Tue, 5 Dec 2023 02:36:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIrIFKxoHJfcpAJLk5lHR9STZ8yj0R6V/QsnfzAKHJ8B3rTIGLci5HbzTgX6p7Po6qDgFg X-Received: by 2002:a05:6a00:4c18:b0:6ce:6bd5:b943 with SMTP id ea24-20020a056a004c1800b006ce6bd5b943mr954650pfb.11.1701772591014; Tue, 05 Dec 2023 02:36:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701772590; cv=none; d=google.com; s=arc-20160816; b=x+hH8T/e/ZLiuRUP1Lz7zSJjWm9B5vo50vHXVXd7qTmOLqMkU38bcp0UBKll9oxR5M +rqTbSYg0TkF+4VYSkF1nlT7ItFuUvNVQ8VF+GFhwTByOXyaK0oeT+yByRVXdjazayQS cIpCadSKC40K44JVyEBIHt2dRAdpLDoetkDrvuTStmfI5EQV5TIRJ2Bj7nSSZLgt/GYl oQau8uyxCQuZJliiNZ4ghxdIhizM82BwtTlUgRvYx+yIwqzgwDGm5ij9BMrtrTC/AqM8 6/oLohLS99nKqlE74RAy3HlFV1wd/uuuAMwsvzpqWERhcwsabPNUYAy4KZOKSC/rytDM 67pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=a4aEtBuTh0UC9CrFmY+V3IFx8owY/yY3vgzi9PmzSa0=; fh=NoYD4WQZNjSG2Bb9ocssXw4U79pWAZvdivFB0JgByN0=; b=gkKNIav+uq4DV4vM8CfqtKSNAt1hh4H6JbKsPn40NMaXMLpavRKjIEibrPkCCJKhJM xNNItE8xZjlE0zgznzG2D8j0GqH8PIkUu7M+eEL6a9Dawj6q3Wed7Qe3xCJQWsnoWTje 0WGC1mMb+vgUKSSGAVB5NKeSgpZh9XVC9r5vw0TpNqBT4+2TT1AJ4MosxOqAPYbWyk/F n+TRar7+nYWEsp8Vcd4ZOIXoxprwEQAchpfn7l0YdLQFvvyfogfz9L0ErIDpatdmXFru duN1ICvLKFVP0+JvtvRVQqmXvlGmQEP4U6zQhlv5eaqOlTHabjKxyjRBp1yaJZK6wiy4 zicg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=AAUDwXA5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id c23-20020a6566d7000000b005be1e55546esi9792767pgw.51.2023.12.05.02.36.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 02:36:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=AAUDwXA5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id EFDF58220126; Tue, 5 Dec 2023 02:36:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344851AbjLEKgC (ORCPT + 99 others); Tue, 5 Dec 2023 05:36:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235059AbjLEKgA (ORCPT ); Tue, 5 Dec 2023 05:36:00 -0500 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C55EEFA; Tue, 5 Dec 2023 02:36:05 -0800 (PST) Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2c9f413d6b2so33422001fa.1; Tue, 05 Dec 2023 02:36:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701772564; x=1702377364; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=a4aEtBuTh0UC9CrFmY+V3IFx8owY/yY3vgzi9PmzSa0=; b=AAUDwXA5Vn5b2YgoYr1vhdX4/ruUKqMQ9z99m1JaH+80iapLCXGjmE89Qq3zq1DfBt IoCOHzlVwVuPsaHqoxhoBf+bz0TONTg74PcgEAsd8zOvL15YNu4Cl+LW/3ddlX8ak2Mp wLsBekjU6wqp5sNn8RHoJxvXn8rcMFcdl2SoE1DBljG1gZQGNkS5YzIAUaNcg+exw+Cb 8lzEkkdCM8fYoM8Te9n4ZrQxwEuNi5amQ0amQluYfm1iOiUiPn+qy6J2OwvWPsiqlzE4 SYcYQNRRs2HDffs28uaphVQJMMjqNogoAvU2TO+fMgwixb89X8ZMO32q7tLARz960XOK /M5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701772564; x=1702377364; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a4aEtBuTh0UC9CrFmY+V3IFx8owY/yY3vgzi9PmzSa0=; b=s8DkiuDCHP4yiUwai+qSMy5tjK6gYiM5aOTSb8DMZBHJW8L+my0UkPcLFcwTmmRaNO Lk7iYTKF86gF6QBI6tKkd0L2bT3rmR7KlO0AWc5E4xTgMVXelKcmyw+kYpXH85bQ2LL+ qcHiqIMl+eTtLFu79dowmbts1NiECbPUGkEFB+R4Ju2G+xKP3wYGD9YotWrWRndpsziw 3JWRJpqPoyIfWwhqSkz3z/0qpVvXCDKGmESrKrGIO37zQECn+mUww/X8cw1CVjxXBoDd GgmI6sNOYcO+x1UvnkSwJ6u8WSjU9bdpGXXolJLRB4Ks0jrGGbHse7F/Jw/yBQpVGou2 SR8A== X-Gm-Message-State: AOJu0YwvnjCyn46xnE8WbTF81oFLDNF0u6udXvoIVY7IYoa68VFOaznJ R+4a/w17WaWeJrf0NNDGatE= X-Received: by 2002:a2e:b24d:0:b0:2c0:17bc:124e with SMTP id n13-20020a2eb24d000000b002c017bc124emr2510299ljm.38.1701772563975; Tue, 05 Dec 2023 02:36:03 -0800 (PST) Received: from localhost ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id h20-20020a2e5314000000b002c9bb53ee68sm849784ljb.136.2023.12.05.02.36.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 02:36:03 -0800 (PST) From: Serge Semin To: Andrew Lunn , Heiner Kallweit , Russell King , Alexandre Torgue , Jose Abreu , Jose Abreu , Maxime Chevallier , Tomer Maimon , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Serge Semin , openbmc@lists.ozlabs.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 01/16] net: pcs: xpcs: Drop sentinel entry from 2500basex ifaces list Date: Tue, 5 Dec 2023 13:35:22 +0300 Message-ID: <20231205103559.9605-2-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231205103559.9605-1-fancer.lancer@gmail.com> References: <20231205103559.9605-1-fancer.lancer@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 05 Dec 2023 02:36:24 -0800 (PST) There are currently two methods (xpcs_find_compat() and xpcs_get_interfaces()) defined in the driver which loop over the available interfaces. All of them rely on the xpcs_compat.num_interfaces field value to get the number of interfaces. That field is initialized with the ARRAY_SIZE(xpcs_*_interfaces) macro function call. Thus the interface arrays are supposed to be filled with actual interface IDs and there is no need in the dummy terminating ID placed at the end of the arrays. Let's drop the redundant PHY_INTERFACE_MODE_MAX entry from the xpcs_2500basex_interfaces list and the redundant PHY_INTERFACE_MODE_MAX-based conditional statement from the xpcs_get_interfaces() method then. Signed-off-by: Serge Semin --- drivers/net/pcs/pcs-xpcs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 31f0beba638a..dc7c374da495 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -130,7 +130,6 @@ static const phy_interface_t xpcs_1000basex_interfaces[] = { static const phy_interface_t xpcs_2500basex_interfaces[] = { PHY_INTERFACE_MODE_2500BASEX, - PHY_INTERFACE_MODE_MAX, }; enum { @@ -636,8 +635,7 @@ void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces) const struct xpcs_compat *compat = &xpcs->id->compat[i]; for (j = 0; j < compat->num_interfaces; j++) - if (compat->interface[j] < PHY_INTERFACE_MODE_MAX) - __set_bit(compat->interface[j], interfaces); + __set_bit(compat->interface[j], interfaces); } } EXPORT_SYMBOL_GPL(xpcs_get_interfaces); -- 2.42.1