From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3535BC41514 for ; Sat, 31 Aug 2019 08:36:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 087AC23784 for ; Sat, 31 Aug 2019 08:36:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726453AbfHaIgK (ORCPT ); Sat, 31 Aug 2019 04:36:10 -0400 Received: from kirsty.vergenet.net ([202.4.237.240]:49694 "EHLO kirsty.vergenet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726029AbfHaIgK (ORCPT ); Sat, 31 Aug 2019 04:36:10 -0400 Received: from penelope.horms.nl (ip4dab7138.direct-adsl.nl [77.171.113.56]) by kirsty.vergenet.net (Postfix) with ESMTPA id 0DBFD25AD78; Sat, 31 Aug 2019 18:36:08 +1000 (AEST) Received: by penelope.horms.nl (Postfix, from userid 7100) id E20C7E218F0; Sat, 31 Aug 2019 10:36:05 +0200 (CEST) Date: Sat, 31 Aug 2019 10:36:05 +0200 From: Simon Horman To: Geert Uytterhoeven Cc: Yoshihiro Shimoda , Vinod , dmaengine@vger.kernel.org, Linux-Renesas Subject: Re: [PATCH 1/2] dmaengine: rcar-dmac: Use of_data values instead of a macro Message-ID: <20190831083605.t6wf2lu3xzdtiarv@verge.net.au> References: <1566904231-25486-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> <1566904231-25486-2-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organisation: Horms Solutions BV User-Agent: NeoMutt/20170113 (1.7.2) Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org On Tue, Aug 27, 2019 at 03:08:16PM +0200, Geert Uytterhoeven wrote: > Hi Shimoda-san, > > On Tue, Aug 27, 2019 at 1:12 PM Yoshihiro Shimoda > wrote: > > Since we will have changed memory mapping of the DMAC in the future, > > this patch uses of_data values instead of a macro to calculate > > each channel's base offset. > > > > Signed-off-by: Yoshihiro Shimoda > > Reviewed-by: Geert Uytterhoeven > > > --- a/drivers/dma/sh/rcar-dmac.c > > +++ b/drivers/dma/sh/rcar-dmac.c > > @@ -208,12 +208,20 @@ struct rcar_dmac { > > > > #define to_rcar_dmac(d) container_of(d, struct rcar_dmac, engine) > > > > +/* > > + * struct rcar_dmac_of_data - This driver's OF data > > + * @chan_offset_base: DMAC channels base offset > > + * @chan_offset_coefficient: DMAC channels offset coefficient > > Perhaps "stride" instead of "coefficient"? Or "step"? > > > @@ -1803,10 +1813,15 @@ static int rcar_dmac_probe(struct platform_device *pdev) > > unsigned int channels_offset = 0; > > struct dma_device *engine; > > struct rcar_dmac *dmac; > > + const struct rcar_dmac_of_data *data; > > struct resource *mem; > > unsigned int i; > > int ret; > > > > + data = of_device_get_match_data(&pdev->dev); > > + if (!data) > > + return -EINVAL; > > This cannot fail, as the driver is DT only, and all entries in the match table > have a data pointer. It seems to me that not including this check would make the code both more fragile and less intuitive for a marginal gain in simplicity. > > 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 >