From nobody Thu Apr 2 18:49:26 2026 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2B63D3D5666; Fri, 27 Mar 2026 08:27:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774600083; cv=none; b=QcWDeWxsIkOI8DKhavyjGzozuN//JbZRF+ofNjLYNJ043vL8JMid13nTap3xBm9nWs0G0JsCPiaHcjb9fN5HfJvLhPRCL1cD+PvBXED0dYFFgoxNYLBwg3IARwdRxlVZlsZkbKRCpptuoRc0E2Uxt/iURx/Niw2TsIeJAX2XICk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774600083; c=relaxed/simple; bh=AHTbZ5ZMDiHqSa7GUptX2ISx1icHznDQhy/RCqMiIuo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Fm//77/NkX1FldhNglS10PyghEpOKfihs+mh15BcKEKp0+Tda3N9A7iPV5VT15vh8jl++F1c1wa7tVcSI0ipvwrxnEbYJmKz305HewCHrH4nLmglKM/9gtuhNPlSZIaRQPSJi6cTyhujnhuU5FEVekUDkIVLbi0PJhbHcZQLEPE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com X-CSE-ConnectionGUID: VOySfCgpRda8hc4/5jJd3g== X-CSE-MsgGUID: 3Nn4ktoxQva3zwTtSz87eQ== Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 27 Mar 2026 17:27:51 +0900 Received: from [127.0.1.1] (unknown [10.226.78.135]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 6180F40116AA; Fri, 27 Mar 2026 17:27:49 +0900 (JST) From: Michael Dege Date: Fri, 27 Mar 2026 09:27:32 +0100 Subject: [PATCH net-next v2 02/13] net: renesas: rswitch: use device instead of net_device Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260327-rswitch_add_vlans-v2-2-d7f4358ca57a@renesas.com> References: <20260327-rswitch_add_vlans-v2-0-d7f4358ca57a@renesas.com> In-Reply-To: <20260327-rswitch_add_vlans-v2-0-d7f4358ca57a@renesas.com> To: Yoshihiro Shimoda , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Dege X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1774600062; l=6218; i=michael.dege@renesas.com; s=20251023; h=from:subject:message-id; bh=AHTbZ5ZMDiHqSa7GUptX2ISx1icHznDQhy/RCqMiIuo=; b=6qWstHokFWgNou++8Yo8c420NNmRizMaGnIl598i22dqZDkpiuPRLMJX3PXlu4zZH2e1tKJ4+ eC4yxSyJH8cDYDYb7VwJNNDevTufipcrFHVdDWhG1cMBiqZ3k2eTv72 X-Developer-Key: i=michael.dege@renesas.com; a=ed25519; pk=gu1rwIcCrAxNMv2I8fIfiQvt51xzZwnQy4Ua/DscQt8= In upcomming changes for adding vlan support struct net_device will not be available in all cases, therefore use struct device instead. Signed-off-by: Michael Dege --- drivers/net/ethernet/renesas/rswitch_main.c | 34 ++++++++++++++-----------= ---- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/renesas/rswitch_main.c b/drivers/net/ethe= rnet/renesas/rswitch_main.c index f6d1e610e7fa..f10e188bc0bd 100644 --- a/drivers/net/ethernet/renesas/rswitch_main.c +++ b/drivers/net/ethernet/renesas/rswitch_main.c @@ -302,13 +302,13 @@ static int rswitch_gwca_queue_alloc_rx_buf(struct rsw= itch_gwca_queue *gq, return -ENOMEM; } =20 -static void rswitch_gwca_queue_free(struct net_device *ndev, +static void rswitch_gwca_queue_free(struct device *dev, struct rswitch_gwca_queue *gq) { unsigned int i; =20 if (!gq->dir_tx) { - dma_free_coherent(ndev->dev.parent, + dma_free_coherent(dev, sizeof(struct rswitch_ext_ts_desc) * (gq->ring_size + 1), gq->rx_ring, gq->ring_dma); gq->rx_ring =3D NULL; @@ -318,7 +318,7 @@ static void rswitch_gwca_queue_free(struct net_device *= ndev, kfree(gq->rx_bufs); gq->rx_bufs =3D NULL; } else { - dma_free_coherent(ndev->dev.parent, + dma_free_coherent(dev, sizeof(struct rswitch_ext_desc) * (gq->ring_size + 1), gq->tx_ring, gq->ring_dma); gq->tx_ring =3D NULL; @@ -357,7 +357,7 @@ static int rswitch_gwca_queue_alloc(struct net_device *= ndev, if (rswitch_gwca_queue_alloc_rx_buf(gq, 0, gq->ring_size) < 0) goto out; =20 - gq->rx_ring =3D dma_alloc_coherent(ndev->dev.parent, + gq->rx_ring =3D dma_alloc_coherent(&priv->pdev->dev, sizeof(struct rswitch_ext_ts_desc) * (gq->ring_size + 1), &gq->ring_dma, GFP_KERNEL); } else { @@ -367,7 +367,7 @@ static int rswitch_gwca_queue_alloc(struct net_device *= ndev, gq->unmap_addrs =3D kzalloc_objs(*gq->unmap_addrs, gq->ring_size); if (!gq->unmap_addrs) goto out; - gq->tx_ring =3D dma_alloc_coherent(ndev->dev.parent, + gq->tx_ring =3D dma_alloc_coherent(&priv->pdev->dev, sizeof(struct rswitch_ext_desc) * (gq->ring_size + 1), &gq->ring_dma, GFP_KERNEL); } @@ -385,7 +385,7 @@ static int rswitch_gwca_queue_alloc(struct net_device *= ndev, return 0; =20 out: - rswitch_gwca_queue_free(ndev, gq); + rswitch_gwca_queue_free(&priv->pdev->dev, gq); =20 return -ENOMEM; } @@ -467,12 +467,11 @@ static void rswitch_gwca_ts_queue_fill(struct rswitch= _private *priv, } } =20 -static int rswitch_gwca_queue_ext_ts_fill(struct net_device *ndev, +static int rswitch_gwca_queue_ext_ts_fill(struct device *dev, struct rswitch_gwca_queue *gq, unsigned int start_index, unsigned int num) { - struct rswitch_device *rdev =3D netdev_priv(ndev); struct rswitch_ext_ts_desc *desc; unsigned int i, index; dma_addr_t dma_addr; @@ -481,18 +480,17 @@ static int rswitch_gwca_queue_ext_ts_fill(struct net_= device *ndev, index =3D (i + start_index) % gq->ring_size; desc =3D &gq->rx_ring[index]; if (!gq->dir_tx) { - dma_addr =3D dma_map_single(ndev->dev.parent, + dma_addr =3D dma_map_single(dev, gq->rx_bufs[index] + RSWITCH_HEADROOM, RSWITCH_MAP_BUF_SIZE, DMA_FROM_DEVICE); - if (dma_mapping_error(ndev->dev.parent, dma_addr)) + if (dma_mapping_error(dev, dma_addr)) goto err; =20 desc->desc.info_ds =3D cpu_to_le16(RSWITCH_DESC_BUF_SIZE); rswitch_desc_set_dptr(&desc->desc, dma_addr); dma_wmb(); desc->desc.die_dt =3D DT_FEMPTY | DIE; - desc->info1 =3D cpu_to_le64(INFO1_SPN(rdev->etha->index)); } else { desc->desc.die_dt =3D DT_EEMPTY | DIE; } @@ -506,7 +504,7 @@ static int rswitch_gwca_queue_ext_ts_fill(struct net_de= vice *ndev, index =3D (i + start_index) % gq->ring_size; desc =3D &gq->rx_ring[index]; dma_addr =3D rswitch_desc_get_dptr(&desc->desc); - dma_unmap_single(ndev->dev.parent, dma_addr, + dma_unmap_single(dev, dma_addr, RSWITCH_MAP_BUF_SIZE, DMA_FROM_DEVICE); } } @@ -514,7 +512,7 @@ static int rswitch_gwca_queue_ext_ts_fill(struct net_de= vice *ndev, return -ENOMEM; } =20 -static int rswitch_gwca_queue_ext_ts_format(struct net_device *ndev, +static int rswitch_gwca_queue_ext_ts_format(struct device *dev, struct rswitch_private *priv, struct rswitch_gwca_queue *gq) { @@ -524,7 +522,7 @@ static int rswitch_gwca_queue_ext_ts_format(struct net_= device *ndev, int err; =20 memset(gq->rx_ring, 0, ring_size); - err =3D rswitch_gwca_queue_ext_ts_fill(ndev, gq, 0, gq->ring_size); + err =3D rswitch_gwca_queue_ext_ts_fill(dev, gq, 0, gq->ring_size); if (err < 0) return err; =20 @@ -636,7 +634,7 @@ static void rswitch_txdmac_free(struct net_device *ndev) { struct rswitch_device *rdev =3D netdev_priv(ndev); =20 - rswitch_gwca_queue_free(ndev, rdev->tx_queue); + rswitch_gwca_queue_free(ndev->dev.parent, rdev->tx_queue); rswitch_gwca_put(rdev->priv, rdev->tx_queue); } =20 @@ -670,7 +668,7 @@ static void rswitch_rxdmac_free(struct net_device *ndev) { struct rswitch_device *rdev =3D netdev_priv(ndev); =20 - rswitch_gwca_queue_free(ndev, rdev->rx_queue); + rswitch_gwca_queue_free(ndev->dev.parent, rdev->rx_queue); rswitch_gwca_put(rdev->priv, rdev->rx_queue); } =20 @@ -679,7 +677,7 @@ static int rswitch_rxdmac_init(struct rswitch_private *= priv, unsigned int index) struct rswitch_device *rdev =3D priv->rdev[index]; struct net_device *ndev =3D rdev->ndev; =20 - return rswitch_gwca_queue_ext_ts_format(ndev, priv, rdev->rx_queue); + return rswitch_gwca_queue_ext_ts_format(ndev->dev.parent, priv, rdev->rx_= queue); } =20 static int rswitch_gwca_hw_init(struct rswitch_private *priv) @@ -870,7 +868,7 @@ static bool rswitch_rx(struct net_device *ndev, int *qu= ota) ret =3D rswitch_gwca_queue_alloc_rx_buf(gq, gq->dirty, num); if (ret < 0) goto err; - ret =3D rswitch_gwca_queue_ext_ts_fill(ndev, gq, gq->dirty, num); + ret =3D rswitch_gwca_queue_ext_ts_fill(ndev->dev.parent, gq, gq->dirty, n= um); if (ret < 0) goto err; gq->dirty =3D rswitch_next_queue_index(gq, false, num); --=20 2.43.0