From: Philipp Zabel <p.zabel@pengutronix.de>
To: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: linux-kernel@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
Prashant Gaikwad <pgaikwad@nvidia.com>,
Heiko Stuebner <heiko@sntech.de>, Peter Chen <Peter.Chen@nxp.com>,
Linus Walleij <linus.walleij@linaro.org>,
dri-devel@lists.freedesktop.org, Marc Dietrich <marvin24@gmx.de>,
Rakesh Iyer <riyer@nvidia.com>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-clk@vger.kernel.org, Wim Van Sebroeck <wim@iguana.be>,
Wolfram Sang <wsa@the-dreams.de>,
Xinliang Liu <z.liuxinliang@hisilicon.com>,
Chanwoo Choi <cw00.choi@samsung.com>,
Alan Stern <stern@rowland.harvard.edu>,
Jiri Slaby <jslaby@suse.com>,
Michael Turquette <mturquette@baylibre.com>,
Guenter Roeck <linux@roeck-us.net>,
Ohad Ben-Cohen <ohad@wizery.com>,
linux-pm@vger.kernel.org, Thomas Gleixner <tglx>
Subject: Re: [PATCH 000/102] Convert drivers to explicit reset API
Date: Thu, 20 Jul 2017 14:55:12 +0200 [thread overview]
Message-ID: <1500555312.2354.75.camel@pengutronix.de> (raw)
In-Reply-To: <20170720123640.43c2ce01@windsurf>
Hi Thomas,
On Thu, 2017-07-20 at 12:36 +0200, Thomas Petazzoni wrote:
> 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.
You can't accidentally use no flag at all or a completely bogus value
with the "plethora of inline functions" variant.
> 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.
I'd rather avoid adding more variants, if possible. The complexity
increases regardless of whether the API is expressed as a bunch of
functions or as a single function with a bunch of flags.
> What about reset_control_get(struct device *, const char *, int flags)
> to replace all those variants ?
While I like how this looks, unfortunately (devm_)reset_control_get
already exists without the flags, so we can't change to that with a
gentle transition.
regards
Philipp
next prev parent reply other threads:[~2017-07-20 12:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-19 15:25 [PATCH 000/102] Convert drivers to explicit reset API Philipp Zabel
2017-07-20 20:32 ` Heiko Stuebner
[not found] ` <20170719152646.25903-1-p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2017-07-19 15:25 ` [PATCH 033/102] Input: tegra-kbc - request exclusive reset control Philipp Zabel
2017-07-19 19:15 ` [PATCH 000/102] Convert drivers to explicit reset API Thomas Petazzoni
2017-07-20 9:36 ` Philipp Zabel
[not found] ` <1500543415.2354.37.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2017-07-20 10:36 ` Thomas Petazzoni
2017-07-20 12:55 ` Philipp Zabel [this message]
2017-07-20 20:46 ` Dmitry Torokhov
2017-07-23 18:41 ` Linus Walleij
2017-07-24 8:33 ` Philipp Zabel
[not found] ` <1500885221.2391.50.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2017-08-12 11:43 ` Wolfram Sang
2017-08-14 7:36 ` Philipp Zabel
2017-07-20 6:56 ` Maxime Ripard
2017-07-20 8:11 ` Greg Kroah-Hartman
2017-07-20 9:24 ` Philipp Zabel
2017-07-20 20:32 ` Heiko Stuebner
2017-07-20 20:32 ` Heiko Stuebner
2017-07-20 20:32 ` Heiko Stuebner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1500555312.2354.75.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=Peter.Chen@nxp.com \
--cc=andrew@lunn.ch \
--cc=cw00.choi@samsung.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=heiko@sntech.de \
--cc=jslaby@suse.com \
--cc=linus.walleij@linaro.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=marvin24@gmx.de \
--cc=mturquette@baylibre.com \
--cc=ohad@wizery.com \
--cc=pgaikwad@nvidia.com \
--cc=pmeerw@pmeerw.net \
--cc=riyer@nvidia.com \
--cc=stern@rowland.harvard.edu \
--cc=thomas.petazzoni@free-electrons.com \
--cc=wim@iguana.be \
--cc=wsa@the-dreams.de \
--cc=z.liuxinliang@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).