Subject: Re: [PATCH for-next 1/1] net: jme: migrate to dma_map_phys instead of map_page

From: Leon Romanovsky <[email-masked]>
Date: Mon, 27 Oct 2025 16:35:16 +0200

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 <[email-masked]>
> ---
>  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
> 
>