[PATCH v2 2/9] dmaengine: edma: Use enum for eDMA binding type (legacy vs TPCC)

Arnd Bergmann arnd at arndb.de
Wed Sep 21 04:38:02 PDT 2016


On Wednesday, September 21, 2016 2:07:22 PM CEST Peter Ujfalusi wrote:
> > 
> > I tend to use 'uintptr_t' for the cast instead.
> 
> What about keeping the defines and:
> 
> diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
> index 3e9606b08340..493fdf30e8b8 100644
> --- a/drivers/dma/edma.c
> +++ b/drivers/dma/edma.c
> @@ -263,14 +263,19 @@ static const struct edmacc_param dummy_paramset = {
> 
>  #define EDMA_BINDING_LEGACY    0
>  #define EDMA_BINDING_TPCC      1
> +static const u32 edma_binding_type[] = {
> +       [EDMA_BINDING_LEGACY] = EDMA_BINDING_LEGACY,
> +       [EDMA_BINDING_TPCC] = EDMA_BINDING_TPCC,
> +};
> +
>  static const struct of_device_id edma_of_ids[] = {
>         {
>                 .compatible = "ti,edma3",
> -               .data = (void *)EDMA_BINDING_LEGACY,
> +               .data = (void *)&edma_binding_type[EDMA_BINDING_LEGACY],
>         },
>         {
>                 .compatible = "ti,edma3-tpcc",
> -               .data = (void *)EDMA_BINDING_TPCC,
> +               .data = (void *)&edma_binding_type[EDMA_BINDING_TPCC],
>         },
>         {}

You can drop the cast to (void *) here, otherwise looks good.

	Arnd



More information about the linux-arm-kernel mailing list