# Re: \[PATCH 2/4\] dmaengine: at\_xdmac: fix AT\_XDMAC\_CC\_PERID() macro

- From: \<hidden\>
- Date: 2021-10-15 07:51:09 
- List: linux-arm-kernel
- Page: https://ratatoskr.run/linux-arm-kernel/2021/10/1542883
- Thread: https://ratatoskr.run/linux-arm-kernel/2021/10/1533908/t.md

```text
On 10/7/21 2:12 PM, Claudiu Beznea wrote:
> AT_XDMAC_CC_PERID() should be used to setup bits 24..30 of XDMAC_CC
> register. Using it without parenthesis around 0x7f & (i) will lead to
> setting all the time zero for bits 24..30 of XDMAC_CC as the << operator
> has higher precedence over bitwise &. Thus, add paranthesis around
> 0x7f & (i).
> 
> Fixes: 15a03850ab8f ("dmaengine: at_xdmac: fix macro typo")
> Signed-off-by: Claudiu Beznea <redacted>

Reviewed-by: Tudor Ambarus <redacted>

> ---
>  drivers/dma/at_xdmac.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
> index c66ad5706cb5..e18abbd56fb5 100644
> --- a/drivers/dma/at_xdmac.c
> +++ b/drivers/dma/at_xdmac.c
> @@ -155,7 +155,7 @@
>  #define		AT_XDMAC_CC_WRIP	(0x1 << 23)	/* Write in Progress (read only) */
>  #define			AT_XDMAC_CC_WRIP_DONE		(0x0 << 23)
>  #define			AT_XDMAC_CC_WRIP_IN_PROGRESS	(0x1 << 23)
> -#define		AT_XDMAC_CC_PERID(i)	(0x7f & (i) << 24)	/* Channel Peripheral Identifier */
> +#define		AT_XDMAC_CC_PERID(i)	((0x7f & (i)) << 24)	/* Channel Peripheral Identifier */
>  #define AT_XDMAC_CDS_MSP	0x2C	/* Channel Data Stride Memory Set Pattern */
>  #define AT_XDMAC_CSUS		0x30	/* Channel Source Microblock Stride */
>  #define AT_XDMAC_CDUS		0x34	/* Channel Destination Microblock Stride */
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```
