Message ID | 1566990835-27028-3-git-send-email-yoshihiro.shimoda.uh@renesas.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | dmaengine: rcar-dmac: Add dma-channel-mask property support | expand |
On Wed, Aug 28, 2019 at 08:13:55PM +0900, Yoshihiro Shimoda wrote: > This patch adds dma-channel-mask property support not to reserve > some DMA channels for some reasons. (for example: a heterogeneous > CPU uses it.) > > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Hi Shimoda-san, On Wed, Aug 28, 2019 at 1:15 PM Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> wrote: > This patch adds dma-channel-mask property support not to reserve > some DMA channels for some reasons. (for example: a heterogeneous > CPU uses it.) Thanks for your patch! > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> One suggestion below. > --- a/drivers/dma/sh/rcar-dmac.c > +++ b/drivers/dma/sh/rcar-dmac.c > @@ -1806,7 +1806,17 @@ static int rcar_dmac_parse_of(struct device *dev, struct rcar_dmac *dmac) > return -EINVAL; > } > > - dmac->channels_mask = GENMASK(dmac->n_channels - 1, 0); > + /* > + * If the driver is unable to read dma-channel-mask property, > + * the driver assumes that it can use all channels. > + */ > + ret = of_property_read_u32(np, "dma-channel-mask", > + &dmac->channels_mask); > + if (ret < 0) > + dmac->channels_mask = GENMASK(dmac->n_channels - 1, 0); You could keep the preinitialization, and just ignore the return value: dmac->channels_mask = GENMASK(dmac->n_channels - 1, 0); of_property_read_u32(np, "dma-channel-mask", &dmac->channels_mask); > > + > + /* If the property has out-of-channel mask, this driver clears it */ > + dmac->channels_mask &= GENMASK(dmac->n_channels - 1, 0); > > return 0; > } Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c index 204160e..bae0fe8 100644 --- a/drivers/dma/sh/rcar-dmac.c +++ b/drivers/dma/sh/rcar-dmac.c @@ -1806,7 +1806,17 @@ static int rcar_dmac_parse_of(struct device *dev, struct rcar_dmac *dmac) return -EINVAL; } - dmac->channels_mask = GENMASK(dmac->n_channels - 1, 0); + /* + * If the driver is unable to read dma-channel-mask property, + * the driver assumes that it can use all channels. + */ + ret = of_property_read_u32(np, "dma-channel-mask", + &dmac->channels_mask); + if (ret < 0) + dmac->channels_mask = GENMASK(dmac->n_channels - 1, 0); + + /* If the property has out-of-channel mask, this driver clears it */ + dmac->channels_mask &= GENMASK(dmac->n_channels - 1, 0); return 0; }
This patch adds dma-channel-mask property support not to reserve some DMA channels for some reasons. (for example: a heterogeneous CPU uses it.) Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> --- drivers/dma/sh/rcar-dmac.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)