> From: Matthijs Kooijman [mailto:matthijs@xxxxxxxx] > Sent: Wednesday, May 08, 2013 12:45 PM > > Platform devices added through OF usually do not have any dma_mask > pointer set. In this case, point it at the coherent_dma_mask and set > their value to a 32 bit mask. This still allows any platform code to set > any more specific mask if needed, but makes the driver work for most > dma-enabled hardware. > > Signed-off-by: Matthijs Kooijman <matthijs@xxxxxxxx> > --- > drivers/staging/dwc2/platform.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/staging/dwc2/platform.c b/drivers/staging/dwc2/platform.c > index 74f1b7d..fdf81c2 100644 > --- a/drivers/staging/dwc2/platform.c > +++ b/drivers/staging/dwc2/platform.c > @@ -187,6 +187,14 @@ static int dwc2_driver_probe(struct platform_device *dev) > > hsotg->dev = &dev->dev; > > + /* > + * Use reasonable defaults so platforms don't have to provide these. > + */ > + if (!dev->dev.dma_mask) > + dev->dev.dma_mask = &dev->dev.coherent_dma_mask; > + if (!dev->dev.coherent_dma_mask) > + dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); Hmm. Is it kosher to override these in a driver and force DMA to be enabled? What if it has been disabled earlier on purpose, say because the platform does not have DMA support? You say "This still allows any platform code to set any more specific mask if needed", but how would that be done exactly? -- Paul -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html