Message ID | bbd248d1-223c-00a9-3d2a-33df085c4f68@ti.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
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 -- To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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], }, {} }; @@ -2183,7 +2188,7 @@ static int edma_probe(struct platform_device *pdev) const struct of_device_id *match; match = of_match_node(edma_of_ids, node); - if (match && (u32)match->data == EDMA_BINDING_TPCC) + if (match && (*(u32*)match->data) == EDMA_BINDING_TPCC) legacy_mode = false; info = edma_setup_info_from_dt(dev, legacy_mode);