From: Thomas Petazzoni Subject: Re: [PATCH 000/102] Convert drivers to explicit reset API Date: Thu, 20 Jul 2017 12:36:40 +0200 Message-ID: <20170720123640.43c2ce01@windsurf> References: <20170719152646.25903-1-p.zabel@pengutronix.de> <20170719211515.46a1196c@windsurf> <1500543415.2354.37.camel@pengutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Andrew Lunn , Prashant Gaikwad , Heiko Stuebner , Peter Chen , Linus Walleij , dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, Marc Dietrich , Rakesh Iyer , Peter Meerwald-Stadler , linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Wolfram Sang , Xinliang Liu , Chanwoo Choi , Alan Stern , Jiri Slaby , Michael Turquette , Guenter Roeck , Ohad Ben-Cohen , linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Thomas Gleixner , Vincent Abriou , Bin Liu , Greg Kroah-Hartman , linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, To: Philipp Zabel Return-path: In-Reply-To: <1500543415.2354.37.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+glpam-linux-mediatek=m.gmane.org-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org List-Id: linux-crypto.vger.kernel.org Hello, On Thu, 20 Jul 2017 11:36:55 +0200, Philipp Zabel wrote: > > I don't know if it has been discussed in the past, so forgive me if it > > has been. Have you considered adding a "int flags" argument to the > > existing reset_control_get_*() functions, rather than introducing > > separate exclusive variants ? > > > > Indeed, with a "int flags" argument you could in the future add more > > variants/behaviors without actually multiplying the number of > > functions. Something like the "flags" argument for request_irq() for > > example. > > I can't find the discussion right now, but I remember we had talked > about this in the past. > Behind the scenes, all the inline API functions already call common > entry points with flags (well, currently separate bool parameters for > shared and optional). > One reason against exposing those as an int flags in the user facing API > is the possibility to accidentally provide a wrong value. This is a quite strange argument. You could also accidentally use the wrong variant of the function, just like you could use the wrong flag. Once again, the next time you have another parameter for those reset functions, beyond the exclusive/shared variant, you will multiply again by two the number of functions ? You already have the exclusive/shared and optional/mandatory variants, so 4 variants. When you'll add a new parameter, you'll have 8 variants. Doesn't seem really good. What about reset_control_get(struct device *, const char *, int flags) to replace all those variants ? Best regards, Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com