* Re: [PATCH for-next 1/1] net: jme: migrate to dma_map_phys instead of map_page
2025-10-24 7:07 ` [PATCH for-next 1/1] " Chu Guangqing
@ 2025-10-24 17:27 ` Simon Horman
2025-10-27 14:35 ` Leon Romanovsky
1 sibling, 0 replies; 4+ messages in thread
From: Simon Horman @ 2025-10-24 17:27 UTC (permalink / raw)
To: Chu Guangqing
Cc: cooldavid, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
linux-kernel
On Fri, Oct 24, 2025 at 03:07:34PM +0800, Chu Guangqing wrote:
> After introduction of dma_map_phys(), there is no need to convert
> from physical address to struct page in order to map page. So let's
> use it directly.
>
> Signed-off-by: Chu Guangqing <chuguangqing@inspur.com>
Although there have been a number minor updates since, mainly for in-kernel
API changes, it seems to me that the last change of substance to this
driver - a feature or bug fix - was the following commit in 2016.
commit 81422e672f81 ("jme: Fix device PM wakeup API usage")
So, unless there is a tree-wide effort to move to the pattern you describe,
I am wondering if it would be better to just leave this code as-is.
Quoting documentation:
1.6.6. Clean-up patches¶
Netdev discourages patches which perform simple clean-ups, which are not in the context of other work. For example:
Addressing checkpatch.pl, and other trivial coding style warnings
Addressing Local variable ordering issues
Conversions to device-managed APIs (devm_ helpers)
This is because it is felt that the churn that such changes produce comes at a greater cost than the value of such clean-ups.
Conversely, spelling and grammar fixes are not discouraged.
https://docs.kernel.org/process/maintainer-netdev.html#clean-up-patches
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH for-next 1/1] net: jme: migrate to dma_map_phys instead of map_page
2025-10-24 7:07 ` [PATCH for-next 1/1] " Chu Guangqing
2025-10-24 17:27 ` Simon Horman
@ 2025-10-27 14:35 ` Leon Romanovsky
1 sibling, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2025-10-27 14:35 UTC (permalink / raw)
To: Chu Guangqing
Cc: cooldavid, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
linux-kernel
On Fri, Oct 24, 2025 at 03:07:34PM +0800, Chu Guangqing wrote:
> After introduction of dma_map_phys(), there is no need to convert
> from physical address to struct page in order to map page. So let's
> use it directly.
>
> Signed-off-by: Chu Guangqing <chuguangqing@inspur.com>
> ---
> drivers/net/ethernet/jme.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c
> index d8be0e4dcb07..7ceeb706939d 100644
> --- a/drivers/net/ethernet/jme.c
> +++ b/drivers/net/ethernet/jme.c
> @@ -735,9 +735,10 @@ jme_make_new_rx_buf(struct jme_adapter *jme, int i)
> if (unlikely(!skb))
> return -ENOMEM;
>
> - mapping = dma_map_page(&jme->pdev->dev, virt_to_page(skb->data),
> - offset_in_page(skb->data), skb_tailroom(skb),
> - DMA_FROM_DEVICE);
> + mapping = dma_map_phys(&jme->pdev->dev, virt_to_phys(skb->data),
> + skb_tailroom(skb),
> + DMA_FROM_DEVICE,
> + 0);
Same comment as before, dma_map_phys() should be paired with dma_unmap_phys().
Thanks
> if (unlikely(dma_mapping_error(&jme->pdev->dev, mapping))) {
> dev_kfree_skb(skb);
> return -ENOMEM;
> --
> 2.43.7
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread