Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp94981rbb; Fri, 23 Feb 2024 13:02:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWnhrF8ys/3k0B2aWAsOm1RaGTFyKRwIqDABzEQ15GZks91oQfIJHRRk9SsLy7qwYExMPNG71yhpq/2DFekzK1S0rMkUjD8fYchQoX8OA== X-Google-Smtp-Source: AGHT+IGk4NWG3NDFrmwvIUYf/0wbUpJzOZrgdF/pbZ8oqaEmCDpYudwJflM6PG4c7+ayXfuPrfSM X-Received: by 2002:ac8:7e95:0:b0:42e:606e:9c81 with SMTP id w21-20020ac87e95000000b0042e606e9c81mr367195qtj.14.1708722172171; Fri, 23 Feb 2024 13:02:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708722172; cv=pass; d=google.com; s=arc-20160816; b=mZehGtiHwmTOg14R3sOEEOp5qAx0j2+3XyXLZY7PWYlXJ5QGpknRcf9vODuDlD9z3C X0hqQxzaZwbUkehwimqNwApSROypQgSKCw4rliP7aOQO5MLH78s7dJgNsZjGfT+0+s5b IVaHnNCIlTO6JyEMv1kU/pwCvCGu//epoBIZw6E/6zK8mK7XIpVHDjbdEDEgCagzSy50 KT+t0kAMC3cVr1YBPvBk1JZwhG+mCUr0MiJE9iNUPR/b2jEC9bLut7eW/nUC+fMerqpL APpYkkt8cH+nPhYvHMsAjr7Y/asqeEUDWo6K7JwwIQpsOQAXHlHhS0JeeV69F89bWa7b p2JQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=DPX4Iuw96szPAD6qjCqbSaeFiBzpVrcX4bId7fchfRc=; fh=o5FD1Ge7mDrCKBA/1gKNGk+1h1Sz9h7JrXGenmlODQ0=; b=pJcYbWK1Dzojh89I91FI5T7AGkPht9h56MBti1y4nk/7mAgAWJWLIcB50p9QWXRqUc KURDOkgjdUPERRkhsXFr00mVGGXngYUCyKUneRlKjl++q4dB84sOgs2GdnizgaW1Cxp4 1XYr5a1GYfbQPdsqgBCYPFuv/6lRv7HnhyusYLNw8uRhxqryA0r5ePGqwo7bU7xJApWH wRbaV+RJRVQ1mo56DhTf5IVtdVVezgJZIZr5cgFdnh8E5wn4/+lDB1I5Pahpnkqkqgl8 pJbUpgCw6U86GrVs5pzrndB/ialffQD2jqutvNrLbfau8ipRxZpZuxihdxBUABJDzrEl utNw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FAG8jUKd; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79163-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79163-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id kd24-20020a05622a269800b0042c38359742si14998679qtb.271.2024.02.23.13.02.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 13:02:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79163-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FAG8jUKd; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79163-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79163-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D9AB01C251E5 for ; Fri, 23 Feb 2024 21:02:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CA3514CAB4; Fri, 23 Feb 2024 21:02:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FAG8jUKd" Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (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 E15E8149386; Fri, 23 Feb 2024 21:02:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708722125; cv=none; b=ro1cRrMgKqXGwJ8BFmuv5+pmC06r/NtBKpT9o/qpzTqzlmagrVOT1JI10A+1rlizxTcn7zrsRI/b1mluxlrQp61zsnBuOPZYwAlvJbl1uAJ69KeNzisqRVLrr+urxF4EfwA/InSSLKPm7WEekvY768g8tU/AsFJcVqh/LTOfFUU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708722125; c=relaxed/simple; bh=jMIi9XpyjMKrSso2kjpj8ETvk29CWpBo/T3bKFftHjE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sT38ZTgwnnzSFgYt2U3cc+L/lct19dcfuSyrxXINcJWPBDVzz3ivQvsaeNp0PcK95+F1LxTwWaH870Y8erV2pnjaUCfaM/Gikt5xRwzsAhpig00DjM6qxVxVqbZDgeyXOtXK8ffsqAvO38kc+x9IrPhR077Jcy2FCPA11QXsAgs= 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=FAG8jUKd; arc=none smtp.client-ip=209.85.167.43 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 Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-512e01b3da3so1658866e87.3; Fri, 23 Feb 2024 13:02:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708722122; x=1709326922; 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=DPX4Iuw96szPAD6qjCqbSaeFiBzpVrcX4bId7fchfRc=; b=FAG8jUKd0oEmwhnH1Zr+LBWbrrqciEKLybwCgIoEy6VUIREIOEapvSAdNmHNcPYqg5 p0bY6PPa/NrPOSVLv1ILFh/TSIXxAyAqe18NoifOG9aa9xR9vK/GjS8/jdLruGrrkZW7 yZBY/LEXupyzUbZGTkgb+6gzoqUVIhjJsjVU2aKpf2rRPiRft7kwKGuhACsmgKc1wZ5w vWbkGJrsfA87f2itnUCrq8vZZVp9p+z4Fdom9tubh8HoXvsfDHXmGmnJ/pm4eF6wFcP6 WNyS0LdjMqjPUBXi8HTz/7hWhcz7x1rXnEufS03smDt96ag6dnH0lvwS22JpEabQEwSt gYnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708722122; x=1709326922; 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=DPX4Iuw96szPAD6qjCqbSaeFiBzpVrcX4bId7fchfRc=; b=AtT0EN5+Gw+2ei0Jn9KUKpRAnipQypGW/rbT6//RgTVx7mgGKIdOBNxEmQhS7d9uGZ +FpYkYDoSxr/wrqRGOKxZRFmlAh6395g2Vi7LnDY0k5OBJ3Hc4BjGq287HZgIW1pulkK MXcZHX4LxU8qZHcOEyJKdDysmYqXChgN1M7HevNA/tgT2b1IxekXCl/MKbTh/bqWdWjX 6AKHokHLt1o/VyYektzTNkkigmC1QSmaTh8DRw+PLQviGJUIZnOSwhPH7lJI2vdmKaFB cIBQuFz6dB6rUjMZJ9V0JF4FE8e/w6i4xj1DMwFp5ey2w1ESfkrSogbYTm/YBImV/Gid nApA== X-Forwarded-Encrypted: i=1; AJvYcCW9YipJc95KPKzBisogpf01dZUbIpNch6E0dBLmd+SiflkaVj/2TKe4i8G3IHIWaBuxSYeCfoK1ae1tSp9PZR/Wdj6cAQoNii2KjTVx X-Gm-Message-State: AOJu0YxbD/QMd2O2+q0Bl4JGneys7+kO0RdQn0gJPvhj66oY7SZcSeih XivjP7TBPKs23Sk11iiMXixhCYNfWxXPGsXN2lh0rZVjd0Z1CoKE9ehURavLhLs= X-Received: by 2002:ac2:483a:0:b0:512:e711:d46a with SMTP id 26-20020ac2483a000000b00512e711d46amr542056lft.24.1708722121826; Fri, 23 Feb 2024 13:02:01 -0800 (PST) Received: from WBEC325.dom.lan ([185.188.71.122]) by smtp.gmail.com with ESMTPSA id st11-20020a170907c08b00b00a3e559aaff9sm6185424ejc.29.2024.02.23.13.02.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 13:02:01 -0800 (PST) From: Pawel Dembicki To: netdev@vger.kernel.org Cc: linus.walleij@linaro.org, Pawel Dembicki , Vladimir Oltean , Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Russell King , linux-kernel@vger.kernel.org Subject: [PATCH net-next v5 04/16] net: dsa: vsc73xx: Add define for max num of ports Date: Fri, 23 Feb 2024 22:00:34 +0100 Message-Id: <20240223210049.3197486-5-paweldembicki@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240223210049.3197486-1-paweldembicki@gmail.com> References: <20240223210049.3197486-1-paweldembicki@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: 8bit This patch introduces a new define: VSC73XX_MAX_NUM_PORTS, which can be used in the future instead of a hardcoded value. Currently, the only hardcoded value is vsc->ds->num_ports. It is being replaced with the new define. Suggested-by: Vladimir Oltean Signed-off-by: Pawel Dembicki Reviewed-by: Vladimir Oltean --- v5: - added 'Reviewed-by' only v4: - Resend patch v3: - Introduce patch drivers/net/dsa/vitesse-vsc73xx-core.c | 13 +------------ drivers/net/dsa/vitesse-vsc73xx.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/dsa/vitesse-vsc73xx-core.c b/drivers/net/dsa/vitesse-vsc73xx-core.c index 8ed8fc997d6d..425999d7bf41 100644 --- a/drivers/net/dsa/vitesse-vsc73xx-core.c +++ b/drivers/net/dsa/vitesse-vsc73xx-core.c @@ -1180,23 +1180,12 @@ int vsc73xx_probe(struct vsc73xx *vsc) vsc->addr[0], vsc->addr[1], vsc->addr[2], vsc->addr[3], vsc->addr[4], vsc->addr[5]); - /* The VSC7395 switch chips have 5+1 ports which means 5 - * ordinary ports and a sixth CPU port facing the processor - * with an RGMII interface. These ports are numbered 0..4 - * and 6, so they leave a "hole" in the port map for port 5, - * which is invalid. - * - * The VSC7398 has 8 ports, port 7 is again the CPU port. - * - * We allocate 8 ports and avoid access to the nonexistant - * ports. - */ vsc->ds = devm_kzalloc(dev, sizeof(*vsc->ds), GFP_KERNEL); if (!vsc->ds) return -ENOMEM; vsc->ds->dev = dev; - vsc->ds->num_ports = 8; + vsc->ds->num_ports = VSC73XX_MAX_NUM_PORTS; vsc->ds->priv = vsc; vsc->ds->ops = &vsc73xx_ds_ops; diff --git a/drivers/net/dsa/vitesse-vsc73xx.h b/drivers/net/dsa/vitesse-vsc73xx.h index 30b1f0a36566..fee1378508b5 100644 --- a/drivers/net/dsa/vitesse-vsc73xx.h +++ b/drivers/net/dsa/vitesse-vsc73xx.h @@ -3,6 +3,17 @@ #include #include +/* The VSC7395 switch chips have 5+1 ports which means 5 ordinary ports and + * a sixth CPU port facing the processor with an RGMII interface. These ports + * are numbered 0..4 and 6, so they leave a "hole" in the port map for port 5, + * which is invalid. + * + * The VSC7398 has 8 ports, port 7 is again the CPU port. + * + * We allocate 8 ports and avoid access to the nonexistent ports. + */ +#define VSC73XX_MAX_NUM_PORTS 8 + /** * struct vsc73xx - VSC73xx state container */ -- 2.34.1