Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yuanshen Cao" <alex.caoys@gmail.com>
Cc: linux-sunxi@lists.linux.dev, vkoul@kernel.org,
	dmaengine@vger.kernel.org, conor+dt@kernel.org,
	Frank.Li@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v4 2/5] dmaengine: sun6i-dma: Support variable address widths using masks
Date: Wed, 26 Aug 2026 01:40:09 +0000	[thread overview]
Message-ID: <20260826014009.BE29C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260826-sun60i-a733-dma-v4-2-dc2f745f40dc@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] Local redefinition of standard kernel macros `field_get` and `field_prep` instead of using the generic implementations from `<linux/bitfield.h>`.
- [Low] The newly introduced `field_get` macro is never used.
--

commit f2482b50c417768080bd7de168d315dbd88b3be7
Author: Yuanshen Cao <alex.caoys@gmail.com>

dmaengine: sun6i-dma: Support variable address widths using masks

This patch updates sun6i_dma_set_addr() to use masks for high-address bits,
allowing the driver to support variable address widths for newer Allwinner
SoCs. It also introduces local field_get and field_prep macros.

> diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
> index f305fbfb35453..53c54161e32a9 100644
> --- a/drivers/dma/sun6i-dma.c
> +++ b/drivers/dma/sun6i-dma.c
> @@ -24,6 +24,10 @@
>  
>  #include "virt-dma.h"
>  
> +/* Non-constant mask variant of FIELD_GET() and FIELD_PREP() */
> +#define field_get(_mask, _reg)	(((_reg) & (_mask)) >> (ffs(_mask) - 1))

[Severity: Low]
Is this macro actually needed?

Looking through the rest of the patch, field_get() doesn't seem to be used
anywhere.

> +#define field_prep(_mask, _val)	(((_val) << (ffs(_mask) - 1)) & (_mask))

[Severity: Low]
Could we use the generic implementations from <linux/bitfield.h> instead of
defining field_prep() and field_get() locally?

Redefining these core kernel macros creates a namespace collision, bypasses
the standard bitfield type-safety checks, and risks a build failure if
<linux/bitfield.h> is ever included in this driver.

Additionally, unlike the standard kernel macros, these custom versions
evaluate their arguments multiple times.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260826-sun60i-a733-dma-v4-0-dc2f745f40dc@gmail.com?part=2

  reply	other threads:[~2026-08-26  1:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26  1:30 [PATCH v4 0/5] dmaengine: sun6i-dma: Add support for Allwinner A733 DMA controller Yuanshen Cao
2026-08-26  1:30 ` [PATCH v4 1/5] dmaengine: sun6i-dma: Refactor to support A733 interrupt and register handling Yuanshen Cao
2026-08-26  1:45   ` sashiko-bot
2026-08-26  1:30 ` [PATCH v4 2/5] dmaengine: sun6i-dma: Support variable address widths using masks Yuanshen Cao
2026-08-26  1:40   ` sashiko-bot [this message]
2026-08-26  1:30 ` [PATCH v4 3/5] dmaengine: sun6i-dma: Add num_channels_per_reg for flexible interrupt mapping Yuanshen Cao
2026-08-26  1:43   ` sashiko-bot
2026-08-26  1:30 ` [PATCH v4 4/5] dt-bindings: dmaengine: sun50i-a64-dma: Add allwinner,sun60i-a733-dma compatible string Yuanshen Cao
2026-08-26  1:30 ` [PATCH v4 5/5] dmaengine: sun6i-dma: Add support for Allwinner A733 DMA controller Yuanshen Cao
2026-08-26  1:43   ` sashiko-bot
2026-08-26 16:26   ` Frank Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260826014009.BE29C1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=alex.caoys@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox