[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1a8bc554-5230-769d-c007-7f620d286a84@csgroup.eu>
Date: Thu, 5 Aug 2021 07:09:09 +0200
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Geoff Levand <geoff@...radead.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH v4 07/10] net/ps3_gelic: Add new routine gelic_unmap_link
Le 23/07/2021 à 22:31, Geoff Levand a écrit :
> Put the common code for unmaping a link into its own routine,
> gelic_unmap_link, and add some debugging checks.
>
> Signed-off-by: Geoff Levand <geoff@...radead.org>
CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#31: FILE: drivers/net/ethernet/toshiba/ps3_gelic_net.c:300:
+ dma_unmap_single(dev, descr->link.cpu_addr, descr->link.size,
+ DMA_BIDIRECTIONAL);
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
Commit bcb1cb297705 ("net/ps3_gelic: Add new routine gelic_unmap_link") has style problems, please
review.
NOTE: Ignored message types: ARCH_INCLUDE_LINUX BIT_MACRO COMPARISON_TO_NULL DT_SPLIT_BINDING_PATCH
EMAIL_SUBJECT FILE_PATH_CHANGES GLOBAL_INITIALISERS LINE_SPACING MULTIPLE_ASSIGNMENTS
> ---
> drivers/net/ethernet/toshiba/ps3_gelic_net.c | 23 +++++++++++++++-----
> 1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
> index 85fc1915c8be..e55aa9fecfeb 100644
> --- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c
> +++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
> @@ -288,6 +288,21 @@ void gelic_card_down(struct gelic_card *card)
> mutex_unlock(&card->updown_lock);
> }
>
> +static void gelic_unmap_link(struct device *dev, struct gelic_descr *descr)
> +{
> + BUG_ON_DEBUG(descr->hw_regs.payload.dev_addr);
> + BUG_ON_DEBUG(descr->hw_regs.payload.size);
> +
> + BUG_ON_DEBUG(!descr->link.cpu_addr);
> + BUG_ON_DEBUG(!descr->link.size);
> +
> + dma_unmap_single(dev, descr->link.cpu_addr, descr->link.size,
> + DMA_BIDIRECTIONAL);
> +
> + descr->link.cpu_addr = 0;
> + descr->link.size = 0;
> +}
> +
> /**
> * gelic_card_free_chain - free descriptor chain
> * @card: card structure
> @@ -301,9 +316,7 @@ static void gelic_card_free_chain(struct gelic_card *card,
>
> for (descr = descr_in; descr && descr->link.cpu_addr;
> descr = descr->next) {
> - dma_unmap_single(dev, descr->link.cpu_addr, descr->link.size,
> - DMA_BIDIRECTIONAL);
> - descr->link.cpu_addr = 0;
> + gelic_unmap_link(dev, descr);
> }
> }
>
> @@ -364,9 +377,7 @@ static int gelic_card_init_chain(struct gelic_card *card,
> iommu_error:
> for (i--, descr--; 0 <= i; i--, descr--)
> if (descr->link.cpu_addr)
> - dma_unmap_single(dev, descr->link.cpu_addr,
> - descr->link.size,
> - DMA_BIDIRECTIONAL);
> + gelic_unmap_link(dev, descr);
> return -ENOMEM;
> }
>
>
Powered by blists - more mailing lists