From patchwork Thu Feb 22 17:58:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13567743 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (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 47592156961; Thu, 22 Feb 2024 17:58:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708624742; cv=none; b=bLOIQ+43Kfz4qgtjL4/0n3hP+Gvou/dAa4sHrN+Zu7e9neinvKABisugcnS/PmxDZCWAiJB9fZPPQGvRxFlavfcFuBd+I2JuwlZ0duAY3zo3ZEq33ne2TJltyv3H0GszhvWqOWwleCZj2CVHt1ZZwnifiev8ErL53pzMTv/RxgU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708624742; c=relaxed/simple; bh=xivy3UlSQqvQmx57Qi8EAzpF57Mk2WtzBv+/+8Pqri0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lmuYPXrPUALW0Oc7+liTja9EKqkFjh+EFnC1bTzCB1vlZs6Oo+CM5eYqD0VQ3tCaq6i3SjA06YT3Too63BZ05u/A/lH8BT2pmi6FyN+V1i7CtvkjFB10yNC/y1KJh1NZNNUQv3v0QNyLek80IAggOTFxs7b7CteI0HT3SChkRUc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ND7LaGMG; arc=none smtp.client-ip=209.85.208.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ND7LaGMG" Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2d2305589a2so720531fa.1; Thu, 22 Feb 2024 09:58:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708624738; x=1709229538; 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=fOW9you0b0342rsDJpYsth5h/RvQ0i1KuZysF40tbO0=; b=ND7LaGMGGP4KJRUteYyehlGShGyC7clWpA5cMBWUeZd8jZVT5eKgtnQyHJ8+rVENPE VdDZxDjlFKMP5YSYLXr6H2WRINBwErRnqiHtTWc/6htsD/jRJGfXU+/snc+p1JhyotvI wOy9J698BVb52nBl4FPGXoEUztB+XjOsr6ybFKH0Hd/pRNt+aBRRiaxYq6qeL+bZw3kR qVoj38aizdu2h0GNWm4ncnVN6NcglNRn/za+VqyF2XGg+LrE3NxqXuRCiWjQMwRasGDl sWjBju+RG2/PcCtvpACnki3DnD3e8Y/9Okv2of8s1i4W+xvSoIG0IqgqWH6EoSR9UqNf CM5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708624738; x=1709229538; 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=fOW9you0b0342rsDJpYsth5h/RvQ0i1KuZysF40tbO0=; b=gRUwXvp/RRFu4fyAy6F9ONKQWaGpKwJUGtM+VkAaWjUieSPfiRId4M2nA8vv9FNZcS 80jphcct+YoIDj5TdGjxtAgWR/7xvkvT92U58AgBeTo780/nophlEbxdso2/238ecSuY CJH20Pu5NMb1AkWCDR4u+zaR0PbkDiKn389jnxatwxefW4JoDHzpUABEOLMbFge8XlO1 kGcSZ9mp03J04JWujTQI2akp8lkIMtQ+UC9xPx2a1sPnXTkTonVHga+yYHe37GfFVCNu 2hb5zMgLZwwgcTLp/brl3RlKp9dmY3nX7EXpud5F8uQ6SI6Nj8goc14f+Re+FmTVLKYY bXXQ== X-Forwarded-Encrypted: i=1; AJvYcCW0lYxJ89VGMR5rL/dPpvOe8Evoe1A4tIy3HcH2aGcDYD+uIUKBwcS4nnXMGPhWQubM6JfoBe6tLkkwYi1sApgkBqD8zqS/Lh5bxHz3IP2pNnsU4fSXYNaJWlQKdAh5SPrumubR X-Gm-Message-State: AOJu0Yw1MukSQoaZUQHp+NdAtGPxlNr85hWRq1KBBtGGA9IQd0nIvpvu MuXEahDV64UE8T/oi3NKMh59bsN+kwkyjSibLj6i/M3bkxoo6LEM X-Google-Smtp-Source: AGHT+IGt49I5Sptvj945xk8GlYDZxwnj9/17uQP/A9B3F9aGMdn0iFrkB8SHmAKNpN7pw6Mp/sGMXA== X-Received: by 2002:a05:651c:b0f:b0:2d2:64c8:49a6 with SMTP id b15-20020a05651c0b0f00b002d264c849a6mr1360670ljr.21.1708624738266; Thu, 22 Feb 2024 09:58:58 -0800 (PST) Received: from localhost ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id z33-20020a2ebe21000000b002d230f2e808sm2011743ljq.48.2024.02.22.09.58.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 09:58:57 -0800 (PST) From: Serge Semin To: Jose Abreu , Jose Abreu , Andrew Lunn , Heiner Kallweit , Russell King , Jakub Kicinski , Vladimir Oltean , Maxime Chevallier , "David S. Miller" , Eric Dumazet , Paolo Abeni Cc: Serge Semin , Mengyuan Lou , Tomer Maimon , Jiawen Wu , Alexandre Torgue , openbmc@lists.ozlabs.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Vladimir Oltean Subject: [PATCH net-next v2 1/4] net: pcs: xpcs: Drop sentinel entry from 2500basex ifaces list Date: Thu, 22 Feb 2024 20:58:20 +0300 Message-ID: <20240222175843.26919-2-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240222175843.26919-1-fancer.lancer@gmail.com> References: <20240222175843.26919-1-fancer.lancer@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org There are currently only 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 total number of supported interfaces. 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. Based on the above drop the PHY_INTERFACE_MODE_MAX entry from the xpcs_2500basex_interfaces array and the PHY_INTERFACE_MODE_MAX-based conditional statement from the xpcs_get_interfaces() method as redundant. Signed-off-by: Serge Semin Reviewed-by: Vladimir Oltean --- 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); From patchwork Thu Feb 22 17:58:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13567744 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (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 C8429157E89; Thu, 22 Feb 2024 17:59:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708624743; cv=none; b=OYg0Sg4Kt9O2SRfQo9oaHWIVfMW1eF0uRzM3vyh5VuaTf2+EBAeKi+tytSm99JrAwtdsmaxbJwokRZMLwWXsx054lyAk7UjumGUi7FUiRMgIkneONna7YakHo6zM7940+zBh1y4fD9+QTX1H3iFuMmThkftY5Rs71mIHJrSL/RQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708624743; c=relaxed/simple; bh=kP+bPj01i5XvLv/bChPOEWkzE3rhDS/Qc9Bv07ibpJc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ssLzfmpKAX+BiNWNEqflR0DnmhHaXRdEf4wgirYJCT6IJ2QkjaofzDBcD2mFztM8eA24Y8d8+VsVAN8wpC0WRV4PJmpY+22+QUZrhFvXQDfyzS5f+P1XHMn1wyXTT1LXUBKAAJgWZCdRUZawQqCw/Dzwu9alj612O7czR40b3/s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OVaDuEgx; arc=none smtp.client-ip=209.85.208.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OVaDuEgx" Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2d269b2ff48so579941fa.3; Thu, 22 Feb 2024 09:59:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708624740; x=1709229540; 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=uH0T15OnUfP1zKLKNNl5grEVTc9u2KY09oUHUCmXOXI=; b=OVaDuEgxh9uXfmbDOiaGcQYQaxuaXMiJZTAyfO/GHT/7y0gRkG0TZmxRPRtCWB62Vn YhF5IaUfxyuuJVgyXqkD5BWvarS2wCvvPbxlfHssbWsB9jtbhTfQJ3egGTYLDz/UgEGE b5rAgLPUHIK0WgixGC7yQUy0aHjA/Kib9xx5u2fLmXoHrgKfkjMniw60+G8/GHY8TiRE j7nmWBPGUPDRdeLQvqWb9nEUbL3d+SNbLo978nB9KVryXBv6IUIY+gb9rRpbpYprN68E ALW2b9DuPWfmSJaZ+fLJUT+66hp7t1Lm2jQF2WLT0lzrh7oinLi3GWYeV36+Zq8loPEX HP2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708624740; x=1709229540; 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=uH0T15OnUfP1zKLKNNl5grEVTc9u2KY09oUHUCmXOXI=; b=dsINlsXk7numEQPKinnHxCJsmrBhEmzRATJOSj/Il7E2j4XcMK4vasNofOsg/eQ9ad yMzBwJ4CKnWR0U5LTjamK6xUedk0V9QIBQlclEPLpzPUk1ioxXjkRR8k2mgHljaYWlQ3 plyumkISmpiUjnIUIdz6LjHSw7JNth8aqkEQsoOym6IuXjAdxw27a3O3JBrzSRkVlZi6 LgHDiAnp0YSYc0E6cdbGXaaU1QFzRxFE9xRDUyub4DeMSpvix79UkPzAt6sSLQkjSvWc 5UptYnXoxayZ5+XFgEtQ/oqxmVZcSdmEwDAW6Sar4d0aZjgNpVvdP5uFKoxHgR0GjI4Z vl2Q== X-Forwarded-Encrypted: i=1; AJvYcCVN4fZm16MVwuHQvhp5Er7SbC11J/pnlLq1JDbSFv1dwM6xEZVFGZO7lrLqh1Kcwle2gYaoVjiMrwhD5Pjh3Xo5An6sme0x2Qi2/z+ESI41JKsPrB7gPUldqySuV8hie+sDUdD2 X-Gm-Message-State: AOJu0YzGbU5/I1h7TIxw8sen1Nzh60vM9zV973r0B+PhT5v0HM75IKDQ Vl3GWBeuFoMzMniHr7i0+9omFl752L8A4oB3/EOyDtrfhqMoSNiJ X-Google-Smtp-Source: AGHT+IHIkOef23Pm0dSclQaK6P87y6AMWfJ1jDRoVN7DxBBYhgDQybIibJWUwprz4AO8ax14LoWKKg== X-Received: by 2002:a05:6512:3e14:b0:512:b932:7913 with SMTP id i20-20020a0565123e1400b00512b9327913mr8296418lfv.41.1708624739902; Thu, 22 Feb 2024 09:58:59 -0800 (PST) Received: from localhost ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id 2-20020ac25f42000000b00512b92ad710sm1461552lfz.168.2024.02.22.09.58.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 09:58:59 -0800 (PST) From: Serge Semin To: Jose Abreu , Jose Abreu , Andrew Lunn , Heiner Kallweit , Russell King , Jakub Kicinski , Vladimir Oltean , Maxime Chevallier , "David S. Miller" , Eric Dumazet , Paolo Abeni Cc: Serge Semin , Mengyuan Lou , Tomer Maimon , Jiawen Wu , Alexandre Torgue , openbmc@lists.ozlabs.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 2/4] net: pcs: xpcs: Drop redundant workqueue.h include directive Date: Thu, 22 Feb 2024 20:58:21 +0300 Message-ID: <20240222175843.26919-3-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240222175843.26919-1-fancer.lancer@gmail.com> References: <20240222175843.26919-1-fancer.lancer@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org There is nothing CM workqueue-related in the driver. So the respective include directive can be dropped. While at it add an empty line delimiter between the generic and local path include directives to visually separate them. Signed-off-by: Serge Semin Tested-by: Andrew Lunn --- drivers/net/pcs/pcs-xpcs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index dc7c374da495..7f8c63922a4b 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -10,7 +10,7 @@ #include #include #include -#include + #include "pcs-xpcs.h" #define phylink_pcs_to_xpcs(pl_pcs) \ From patchwork Thu Feb 22 17:58:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13567745 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (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 AF2461586E7; Thu, 22 Feb 2024 17:59:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708624745; cv=none; b=l/ymSUgyKQF/W7eLYerfGO6rGjNQkvYqr54M1SEMb+SDqS9b39jxZvJ22sEiS18amzLJMoU23wUubvZyUfPKGaInTZ6X27F9U+lByooR7O57EYoxkYxbE5deQMskYfiYBrpzOvO88tSPfka1xutjernuXcNuwWKPBK8zPA4tS5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708624745; c=relaxed/simple; bh=mJ4vI/M8uX6iTjXYqK2tKOismbv4AwjWdoffO2uKt1I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YBbltonXyiTHT9inbFl2GAqIAnlSdGBsN+DIcm7QfcsZ3nWKvDnrEcEzdoq1AvheJK2hHZKD5gtvoTy+83HRinWzprcImW/7cehRC62rVaZ1q3rUc/Aq8N8EWF7wklA8PVTcaeuku4nY0HMz6Cb9Lpwf+rEoSC5qz0wrxBxK4Q8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YlQi9nmw; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YlQi9nmw" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-512bce554a5so62864e87.3; Thu, 22 Feb 2024 09:59:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708624742; x=1709229542; 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=jp1g5lResVomu+V7VdkXdGM8kiQtYo+auuikQ/uSWZI=; b=YlQi9nmwp/xFKAn/G/yCXtUK5LfPvJfBSra+d5HpmzV/Dikaw9OjipKWaGF0oYXOq3 EJw4RJOq6QIh8taWbF4uubMUo9/v0VSkP8QnMYG5dFYqU+aVBVP8Ygn3ArkrvLnkhYna pswNyjpPp45QULXGgW7M3zfYJfqMHOfE9B8mhNKtt6dNx5+ziC7udHZ322tlh37bhY+r bv4KgWwOCF+kZ4fMPelhzpSGUgMthtwsF5TETyt5ybi8xK8fmyQcY4Z8KBqvSRRM077i 7jHLbWr1qM7nO5OGuUVeBTVHmXcWsVGX82Eez94r7pRaAuKWjM+Ks61SnXbPDSOMl+AU P/jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708624742; x=1709229542; 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=jp1g5lResVomu+V7VdkXdGM8kiQtYo+auuikQ/uSWZI=; b=aH6h5uSbbOHn6oSh+XUK8WNgipCB0tA4VsRXm094wubPggiP4PZ6ovDDHf0ne3Y36m 3DSD0kpwENuPJa2OQ8Fm1sslu2s91z5jCYPUDjkGefhOHY8w9gae4ZsKnD6RzrWab6kO LklF8Y7UaGfpqSjuiQ9obk7XVmscIzFK8dNajvHdJdFqA8alrJx//qCuYtbGzN0Bg3nT npVkvCSpRMUDUdPuU8sIBAt5JrzPlsN1Ce/jEbn17VP0ygwB6fO/NhbER+A/pStweqPI F3/XSPd1hsUcJtfGmB6iwxcWa4/xcdRRo46R3Ogkct3BOal76BqJVnCZrvJYP1Zn/77J EuCA== X-Forwarded-Encrypted: i=1; AJvYcCWqfcmWXMsDY5LDUoQ96RWEjLZLrhr+E2ErAZDr2Fh3WfTQinJ55nEHLLOg9KjdrSdC7ystspkzKI28yuFjYhyq/QEVZIVAUb0sXEBWFsz0MV8TP5B9yvXOfkYkzRtZvy4lBJI5 X-Gm-Message-State: AOJu0YyVHDdrKn4ytE3DDxZdxxuG7bnM71mywF8uZlEJJOz9pdu+5vZy +GNxLp8qFo+xHd2pwHbzCxuzkWl3iJYIusTrPpOa5FuItXLLosvT X-Google-Smtp-Source: AGHT+IGRpEI2oSqtm9dYNcKLyivAzdy3gMDPODH0h2w+FofbgIArs+mWBkkBVw4dyzhAIdDfbP1Bew== X-Received: by 2002:ac2:5e25:0:b0:512:bed4:dfc8 with SMTP id o5-20020ac25e25000000b00512bed4dfc8mr6182428lfg.3.1708624741750; Thu, 22 Feb 2024 09:59:01 -0800 (PST) Received: from localhost ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id k13-20020a0565123d8d00b00512d47a6459sm694644lfv.148.2024.02.22.09.59.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 09:59:01 -0800 (PST) From: Serge Semin To: Jose Abreu , Jose Abreu , Andrew Lunn , Heiner Kallweit , Russell King , Jakub Kicinski , Vladimir Oltean , Maxime Chevallier , "David S. Miller" , Eric Dumazet , Paolo Abeni Cc: Serge Semin , Mengyuan Lou , Tomer Maimon , Jiawen Wu , Alexandre Torgue , openbmc@lists.ozlabs.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 3/4] net: pcs: xpcs: Return EINVAL in the internal methods Date: Thu, 22 Feb 2024 20:58:22 +0300 Message-ID: <20240222175843.26919-4-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240222175843.26919-1-fancer.lancer@gmail.com> References: <20240222175843.26919-1-fancer.lancer@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org In particular the xpcs_soft_reset() and xpcs_do_config() functions currently return -1 if invalid auto-negotiation mode is specified. That value might be then passed to the generic kernel subsystems which require a standard kernel errno value. Even though the erroneous conditions are very specific (memory corruption or buggy driver implementation) using a hard-coded -1 literal doesn't seem correct anyway especially when it comes to passing it higher to the network subsystem or printing to the system log. Convert the hard-coded error values to -EINVAL then. Signed-off-by: Serge Semin Tested-by: Andrew Lunn --- drivers/net/pcs/pcs-xpcs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 7f8c63922a4b..92c47da61db4 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -292,7 +292,7 @@ static int xpcs_soft_reset(struct dw_xpcs *xpcs, dev = MDIO_MMD_VEND2; break; default: - return -1; + return -EINVAL; } ret = xpcs_write(xpcs, dev, MDIO_CTRL1, MDIO_CTRL1_RESET); @@ -889,7 +889,7 @@ int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface, return ret; break; default: - return -1; + return -EINVAL; } if (compat->pma_config) { From patchwork Thu Feb 22 17:58:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13567746 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (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 7F8DB158D7E; Thu, 22 Feb 2024 17:59:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708624747; cv=none; b=S1DEoS8ciHh3g1gkcHWdwdDsnEjp87bo/L/X/vYTcnFhvtn5N4UIA5E6zKPbIiZZmwLN/cFvilOLShrk/yEkloFgTP299xrSmVMRj/vHbwRABkBOcjyCMfz2KqCcGHJYjFoc3qOmJGIeIG/iXoElFou4YJzqH9w2KN1HUojh1t0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708624747; c=relaxed/simple; bh=Z/EIGnuYjLNrAYUnfmJi4T97HGPjIPXlLK6RZjCVmqY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uetQ0cZI/J7kVI48mOOosgordsc9HxGDJukzBvvxLqh4T/5q+lGq0Dyi5Tm/L67x0bSl7yOwe0pCCIHwl/7nKNg7ycwQKzNnfnZpTtU1qGd3Ii9c095OTDsznoumiAZEMzVKT7YIb+SUQiubejT30clQR48YWUECSPP0U7fy2Mw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bGZrPy3/; arc=none smtp.client-ip=209.85.208.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bGZrPy3/" Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2d2628e81b8so7543761fa.0; Thu, 22 Feb 2024 09:59:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708624743; x=1709229543; 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=5bTqyc5eLl00Lab2XpbFjSYvN/btOw7kIcPOi9K55pg=; b=bGZrPy3/FKYsUr4VSUe6MTQx723LvRkz6A8tqWv6bO/6KQFC5YRPXXORWjKaTyj3Fq P0/ciaQSbqbyF1oQNhboasL/+mzWwbY92eiO6zH5oc7DSesc9VBlLADam3IAySiAnu1j DzsbRu+TwPPAqaxzGtTVT2zBbgEI0I92fuDUxuehNHKmuu1EavWfyVJUwwH6BUrckGDO M1KxwvDat/oaB3Bv4US77WE8BbGiVAyWRa50lgt/cSgwPq9JJJVAg8omU1swP+7pChnT KgCon99xDMNJ7snstt9MEuWGehIc7Gv+dGwaifDjW62x6t7+wqoOzCAob8qpOme+Y5rs RrTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708624743; x=1709229543; 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=5bTqyc5eLl00Lab2XpbFjSYvN/btOw7kIcPOi9K55pg=; b=NDVHyvpxDy5vE+qOG/xqoM3WM9oFTpncJCH6oig6q1LvAIVUDxzEkGGJ+dF4D1eYFc Lo0bkgMq9wFi2eWN7M2vVHBs7Z2HQj+9pmEyVXZ0exg2yukyo8HEswQBhvt4HNo75LZH DW0ChIcob3nt/ko0cuVx510Wu5tOlL3PqsVECH51HgEKLVZW0YsNusTEm/CuLjbBY+hD cLkHnwyjOv87ZNJNZrbrPtjL1YkRPXsHphP9N+eowfvJj3ZzHXvR6hbafeTkFAj2IRgk Ewjjriy1P5lKFP9ktMrqZDpq292MJ8VyzrbXuvPrJ0FKA9Jpbq/Airkf7xiUbrZqqSbB MmYQ== X-Forwarded-Encrypted: i=1; AJvYcCVK/T7acKIqjgTEqn3+ooVF8YE5/mzWjULhOmuEWw/VWb9/plVodoBUE+RF5vRkVLXl+DlTIejXIJOk5VbZDwBQ9ET9+za8yyN/qFwaaedboX4EA31PMVYjqYpgRTvkbYH2pznY X-Gm-Message-State: AOJu0YyixE2gFm+ghtj75M1edyXEzURf3q2imIRKDUlIXAs+uCOWk6hh vMosvVHCiAiqPImzfROtItRJQdLFoOd0T4+dj1I1/J4exPCUM7wj X-Google-Smtp-Source: AGHT+IHuasSgIqN4mYlSs8rVhcBwid+S/k+ba5GORgBQig/kQBDhwbuCR6H37k2jc6Uam3ZK+g908A== X-Received: by 2002:a2e:904d:0:b0:2d2:31a8:cb1a with SMTP id n13-20020a2e904d000000b002d231a8cb1amr1275872ljg.13.1708624743579; Thu, 22 Feb 2024 09:59:03 -0800 (PST) Received: from localhost ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id l25-20020a2e8699000000b002d221041b59sm2296052lji.51.2024.02.22.09.59.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 09:59:03 -0800 (PST) From: Serge Semin To: Jose Abreu , Jose Abreu , Andrew Lunn , Heiner Kallweit , Russell King , Jakub Kicinski , Vladimir Oltean , Maxime Chevallier , "David S. Miller" , Eric Dumazet , Paolo Abeni Cc: Serge Semin , Mengyuan Lou , Tomer Maimon , Jiawen Wu , Alexandre Torgue , openbmc@lists.ozlabs.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 4/4] net: pcs: xpcs: Explicitly return error on caps validation Date: Thu, 22 Feb 2024 20:58:23 +0300 Message-ID: <20240222175843.26919-5-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240222175843.26919-1-fancer.lancer@gmail.com> References: <20240222175843.26919-1-fancer.lancer@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org If an unsupported interface is passed to the PCS validation callback there is no need in further link-modes calculations since the resultant array will be initialized with zeros which will be perceived by the phylink subsystem as error anyway (see phylink_validate_mac_and_pcs()). Instead let's explicitly return the -EINVAL error to inform the caller about the unsupported interface as it's done in the rest of the pcs_validate callbacks. Signed-off-by: Serge Semin Reviewed-by: Maxime Chevallier --- drivers/net/pcs/pcs-xpcs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 92c47da61db4..46afeb5510c0 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -613,14 +613,15 @@ static int xpcs_validate(struct phylink_pcs *pcs, unsigned long *supported, xpcs = phylink_pcs_to_xpcs(pcs); compat = xpcs_find_compat(xpcs->id, state->interface); + if (!compat) + return -EINVAL; /* Populate the supported link modes for this PHY interface type. * FIXME: what about the port modes and autoneg bit? This masks * all those away. */ - if (compat) - for (i = 0; compat->supported[i] != __ETHTOOL_LINK_MODE_MASK_NBITS; i++) - set_bit(compat->supported[i], xpcs_supported); + for (i = 0; compat->supported[i] != __ETHTOOL_LINK_MODE_MASK_NBITS; i++) + set_bit(compat->supported[i], xpcs_supported); linkmode_and(supported, supported, xpcs_supported);