From nobody Wed Apr 1 14:07:18 2026 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1388C3ED5B9; Tue, 31 Mar 2026 10:04:17 +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=1774951459; cv=none; b=oxZ/tLtzPf06enIquMdJPTJH3+y+k1UnQnbBKM2NNYFk0L0lfL+C2cpg7rKZ8lR68cLsRmZqsYIoYqcjx0rcnIcoLNgm6sY0a4xkuilDZRSFxF0iVCL7auB0AuySnN/13wD43cw/wYo+/QsXLQtYKQnN4FkFpmKrnZLmSSEYQwo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774951459; c=relaxed/simple; bh=AHTbZ5ZMDiHqSa7GUptX2ISx1icHznDQhy/RCqMiIuo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EaNQOj1TSzEYrIrE5nKhwe1m3F5oLwObNyuDwrML/VYU1OkH9/jy1TRwV1BRmKAzhBvTKECynolXg+HpoMYdvfwGQWcm5l/rC2L8GPrQyYQqCzFhX7w3FwBzQ7v5rYiOS0phxK2A0eBXMYOsATVTxfRVtBFR5Ze8QWjKs61Fr+E= 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: T3rErIdoTl2cLYU8MPmm3g== X-CSE-MsgGUID: F7UAlxxoQ3eoq1y0hh1U8g== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 31 Mar 2026 19:04:13 +0900 Received: from [127.0.1.1] (unknown [10.226.78.135]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 84F35416C823; Tue, 31 Mar 2026 19:04:10 +0900 (JST) From: Michael Dege Date: Tue, 31 Mar 2026 12:03:56 +0200 Subject: [PATCH net-next v3 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: <20260331-rswitch_add_vlans-v3-2-c37f41b1c556@renesas.com> References: <20260331-rswitch_add_vlans-v3-0-c37f41b1c556@renesas.com> In-Reply-To: <20260331-rswitch_add_vlans-v3-0-c37f41b1c556@renesas.com> To: Yoshihiro Shimoda , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , =?utf-8?q?Niklas_S=C3=B6derlund?= , Paul Barker 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=1774951442; l=6218; i=michael.dege@renesas.com; s=20251023; h=from:subject:message-id; bh=AHTbZ5ZMDiHqSa7GUptX2ISx1icHznDQhy/RCqMiIuo=; b=HxfJoejGz8IDYXrr34UdVPlM4ngJ3CikbWTj/HHkA5k2VGSWHPvspD6+aA/BIZY5+/HpaoKGF fiFJ8YuQB7RBSXh1edjKQ+34t34gt3lVFmXnjvR0JYlN3VmL8Ldb2F3 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