Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-05-05 Thread Peter Rosin
On 2017-04-18 12:59, Peter Rosin wrote: > On 2017-04-18 10:51, Greg Kroah-Hartman wrote: >> On Thu, Apr 13, 2017 at 06:43:07PM +0200, Peter Rosin wrote: >>> +/** >>> + * devm_mux_chip_unregister() - Resource-managed version >>> mux_chip_unregister(). >>> + * @dev: The device that originally

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-05-05 Thread Peter Rosin
On 2017-04-18 12:59, Peter Rosin wrote: > On 2017-04-18 10:51, Greg Kroah-Hartman wrote: >> On Thu, Apr 13, 2017 at 06:43:07PM +0200, Peter Rosin wrote: >>> +/** >>> + * devm_mux_chip_unregister() - Resource-managed version >>> mux_chip_unregister(). >>> + * @dev: The device that originally

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-21 Thread Peter Rosin
On 2017-04-20 23:53, Peter Rosin wrote: > On 2017-04-18 23:53, Peter Rosin wrote: >> On 2017-04-18 13:44, Greg Kroah-Hartman wrote: >>> On Tue, Apr 18, 2017 at 12:59:50PM +0200, Peter Rosin wrote: On 2017-04-18 10:51, Greg Kroah-Hartman wrote: > On Thu, Apr 13, 2017 at 06:43:07PM +0200,

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-21 Thread Peter Rosin
On 2017-04-20 23:53, Peter Rosin wrote: > On 2017-04-18 23:53, Peter Rosin wrote: >> On 2017-04-18 13:44, Greg Kroah-Hartman wrote: >>> On Tue, Apr 18, 2017 at 12:59:50PM +0200, Peter Rosin wrote: On 2017-04-18 10:51, Greg Kroah-Hartman wrote: > On Thu, Apr 13, 2017 at 06:43:07PM +0200,

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-21 Thread Peter Rosin
On 2017-04-21 16:41, Philipp Zabel wrote: > On Fri, 2017-04-21 at 16:32 +0200, Peter Rosin wrote: >> On 2017-04-21 16:23, Philipp Zabel wrote: >>> On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: >>> [...] +int mux_chip_register(struct mux_chip *mux_chip) +{ + int i; +

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-21 Thread Peter Rosin
On 2017-04-21 16:41, Philipp Zabel wrote: > On Fri, 2017-04-21 at 16:32 +0200, Peter Rosin wrote: >> On 2017-04-21 16:23, Philipp Zabel wrote: >>> On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: >>> [...] +int mux_chip_register(struct mux_chip *mux_chip) +{ + int i; +

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-21 Thread Peter Rosin
On 2017-04-21 16:18, Philipp Zabel wrote: > Hi Peter, > > On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: > [...] >> +int mux_control_select(struct mux_control *mux, int state) > > state could be unsigned int for the consumer facing API. > >> +{ >> +int ret; > > And

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-21 Thread Peter Rosin
On 2017-04-21 16:18, Philipp Zabel wrote: > Hi Peter, > > On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: > [...] >> +int mux_control_select(struct mux_control *mux, int state) > > state could be unsigned int for the consumer facing API. > >> +{ >> +int ret; > > And

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-21 Thread Philipp Zabel
On Fri, 2017-04-21 at 16:55 +0200, Peter Rosin wrote: > On 2017-04-21 16:41, Philipp Zabel wrote: > > On Fri, 2017-04-21 at 16:32 +0200, Peter Rosin wrote: > >> On 2017-04-21 16:23, Philipp Zabel wrote: > >>> On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: > >>> [...] > +int

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-21 Thread Philipp Zabel
On Fri, 2017-04-21 at 16:55 +0200, Peter Rosin wrote: > On 2017-04-21 16:41, Philipp Zabel wrote: > > On Fri, 2017-04-21 at 16:32 +0200, Peter Rosin wrote: > >> On 2017-04-21 16:23, Philipp Zabel wrote: > >>> On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: > >>> [...] > +int

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-21 Thread Philipp Zabel
On Fri, 2017-04-21 at 16:32 +0200, Peter Rosin wrote: > On 2017-04-21 16:23, Philipp Zabel wrote: > > On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: > > [...] > >> +int mux_chip_register(struct mux_chip *mux_chip) > >> +{ > >> + int i; > >> + int ret; > >> + > >> + for (i = 0; i <

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-21 Thread Philipp Zabel
On Fri, 2017-04-21 at 16:32 +0200, Peter Rosin wrote: > On 2017-04-21 16:23, Philipp Zabel wrote: > > On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: > > [...] > >> +int mux_chip_register(struct mux_chip *mux_chip) > >> +{ > >> + int i; > >> + int ret; > >> + > >> + for (i = 0; i <

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-21 Thread Peter Rosin
On 2017-04-21 16:23, Philipp Zabel wrote: > On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: > [...] >> +int mux_chip_register(struct mux_chip *mux_chip) >> +{ >> +int i; >> +int ret; >> + >> +for (i = 0; i < mux_chip->controllers; ++i) { >> +struct mux_control *mux =

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-21 Thread Peter Rosin
On 2017-04-21 16:23, Philipp Zabel wrote: > On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: > [...] >> +int mux_chip_register(struct mux_chip *mux_chip) >> +{ >> +int i; >> +int ret; >> + >> +for (i = 0; i < mux_chip->controllers; ++i) { >> +struct mux_control *mux =

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-21 Thread Philipp Zabel
On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: [...] > +int mux_chip_register(struct mux_chip *mux_chip) > +{ > + int i; > + int ret; > + > + for (i = 0; i < mux_chip->controllers; ++i) { > + struct mux_control *mux = _chip->mux[i]; > + > + if

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-21 Thread Philipp Zabel
On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: [...] > +int mux_chip_register(struct mux_chip *mux_chip) > +{ > + int i; > + int ret; > + > + for (i = 0; i < mux_chip->controllers; ++i) { > + struct mux_control *mux = _chip->mux[i]; > + > + if

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-21 Thread Philipp Zabel
Hi Peter, On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: [...] > +int mux_control_select(struct mux_control *mux, int state) state could be unsigned int for the consumer facing API. > +{ > + int ret; And mux_control_select should check that (0 <= state < mux->states). regards

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-21 Thread Philipp Zabel
Hi Peter, On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: [...] > +int mux_control_select(struct mux_control *mux, int state) state could be unsigned int for the consumer facing API. > +{ > + int ret; And mux_control_select should check that (0 <= state < mux->states). regards

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-20 Thread Peter Rosin
On 2017-04-18 23:53, Peter Rosin wrote: > On 2017-04-18 13:44, Greg Kroah-Hartman wrote: >> On Tue, Apr 18, 2017 at 12:59:50PM +0200, Peter Rosin wrote: >>> On 2017-04-18 10:51, Greg Kroah-Hartman wrote: On Thu, Apr 13, 2017 at 06:43:07PM +0200, Peter Rosin wrote: *snip* > + if

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-20 Thread Peter Rosin
On 2017-04-18 23:53, Peter Rosin wrote: > On 2017-04-18 13:44, Greg Kroah-Hartman wrote: >> On Tue, Apr 18, 2017 at 12:59:50PM +0200, Peter Rosin wrote: >>> On 2017-04-18 10:51, Greg Kroah-Hartman wrote: On Thu, Apr 13, 2017 at 06:43:07PM +0200, Peter Rosin wrote: *snip* > + if

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-19 Thread Peter Rosin
On 2017-04-19 15:49, Philipp Zabel wrote: > On Wed, 2017-04-19 at 14:00 +0200, Peter Rosin wrote: > [...] +int mux_control_select(struct mux_control *mux, int state) >>> >>> If we let two of these race, ... >> >> The window for this "race" is positively huge. If there are several >> mux

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-19 Thread Peter Rosin
On 2017-04-19 15:49, Philipp Zabel wrote: > On Wed, 2017-04-19 at 14:00 +0200, Peter Rosin wrote: > [...] +int mux_control_select(struct mux_control *mux, int state) >>> >>> If we let two of these race, ... >> >> The window for this "race" is positively huge. If there are several >> mux

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-19 Thread Philipp Zabel
On Wed, 2017-04-19 at 14:00 +0200, Peter Rosin wrote: [...] > >> +int mux_control_select(struct mux_control *mux, int state) > > > > If we let two of these race, ... > > The window for this "race" is positively huge. If there are several > mux consumers of a single mux controller, it is

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-19 Thread Philipp Zabel
On Wed, 2017-04-19 at 14:00 +0200, Peter Rosin wrote: [...] > >> +int mux_control_select(struct mux_control *mux, int state) > > > > If we let two of these race, ... > > The window for this "race" is positively huge. If there are several > mux consumers of a single mux controller, it is

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-19 Thread Peter Rosin
On 2017-04-19 11:06, Philipp Zabel wrote: > On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: >> Add a new minimalistic subsystem that handles multiplexer controllers. >> When multiplexers are used in various places in the kernel, and the >> same multiplexer controller can be used for several

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-19 Thread Peter Rosin
On 2017-04-19 11:06, Philipp Zabel wrote: > On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: >> Add a new minimalistic subsystem that handles multiplexer controllers. >> When multiplexers are used in various places in the kernel, and the >> same multiplexer controller can be used for several

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-19 Thread Philipp Zabel
On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: > Add a new minimalistic subsystem that handles multiplexer controllers. > When multiplexers are used in various places in the kernel, and the > same multiplexer controller can be used for several independent things, > there should be one place

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-19 Thread Philipp Zabel
On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: > Add a new minimalistic subsystem that handles multiplexer controllers. > When multiplexers are used in various places in the kernel, and the > same multiplexer controller can be used for several independent things, > there should be one place

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-18 Thread Joe Perches
On Tue, 2017-04-18 at 23:53 +0200, Peter Rosin wrote: > On 2017-04-18 13:44, Greg Kroah-Hartman wrote: > > On Tue, Apr 18, 2017 at 12:59:50PM +0200, Peter Rosin wrote: [] > > > > > + ret = device_add(_chip->dev); > > > > > + if (ret < 0) > > > > > + dev_err(_chip->dev, > > > >

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-18 Thread Joe Perches
On Tue, 2017-04-18 at 23:53 +0200, Peter Rosin wrote: > On 2017-04-18 13:44, Greg Kroah-Hartman wrote: > > On Tue, Apr 18, 2017 at 12:59:50PM +0200, Peter Rosin wrote: [] > > > > > + ret = device_add(_chip->dev); > > > > > + if (ret < 0) > > > > > + dev_err(_chip->dev, > > > >

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-18 Thread Peter Rosin
On 2017-04-18 13:44, Greg Kroah-Hartman wrote: > On Tue, Apr 18, 2017 at 12:59:50PM +0200, Peter Rosin wrote: >> On 2017-04-18 10:51, Greg Kroah-Hartman wrote: >>> On Thu, Apr 13, 2017 at 06:43:07PM +0200, Peter Rosin wrote: +config MUX_GPIO + tristate "GPIO-controlled Multiplexer"

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-18 Thread Peter Rosin
On 2017-04-18 13:44, Greg Kroah-Hartman wrote: > On Tue, Apr 18, 2017 at 12:59:50PM +0200, Peter Rosin wrote: >> On 2017-04-18 10:51, Greg Kroah-Hartman wrote: >>> On Thu, Apr 13, 2017 at 06:43:07PM +0200, Peter Rosin wrote: +config MUX_GPIO + tristate "GPIO-controlled Multiplexer"

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-18 Thread Greg Kroah-Hartman
On Tue, Apr 18, 2017 at 12:59:50PM +0200, Peter Rosin wrote: > On 2017-04-18 10:51, Greg Kroah-Hartman wrote: > > On Thu, Apr 13, 2017 at 06:43:07PM +0200, Peter Rosin wrote: > >> +config MUX_GPIO > >> + tristate "GPIO-controlled Multiplexer" > >> + depends on OF && GPIOLIB > > > > Why have the

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-18 Thread Greg Kroah-Hartman
On Tue, Apr 18, 2017 at 12:59:50PM +0200, Peter Rosin wrote: > On 2017-04-18 10:51, Greg Kroah-Hartman wrote: > > On Thu, Apr 13, 2017 at 06:43:07PM +0200, Peter Rosin wrote: > >> +config MUX_GPIO > >> + tristate "GPIO-controlled Multiplexer" > >> + depends on OF && GPIOLIB > > > > Why have the

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-18 Thread Peter Rosin
On 2017-04-18 10:51, Greg Kroah-Hartman wrote: > On Thu, Apr 13, 2017 at 06:43:07PM +0200, Peter Rosin wrote: >> +config MUX_GPIO >> +tristate "GPIO-controlled Multiplexer" >> +depends on OF && GPIOLIB > > Why have the gpio and mux core in the same patch? One is not usable w/o the other.

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-18 Thread Peter Rosin
On 2017-04-18 10:51, Greg Kroah-Hartman wrote: > On Thu, Apr 13, 2017 at 06:43:07PM +0200, Peter Rosin wrote: >> +config MUX_GPIO >> +tristate "GPIO-controlled Multiplexer" >> +depends on OF && GPIOLIB > > Why have the gpio and mux core in the same patch? One is not usable w/o the other.

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-18 Thread Greg Kroah-Hartman
On Thu, Apr 13, 2017 at 06:43:07PM +0200, Peter Rosin wrote: > +config MUX_GPIO > + tristate "GPIO-controlled Multiplexer" > + depends on OF && GPIOLIB Why have the gpio and mux core in the same patch? And why does this depend on OF? > + help > + GPIO-controlled Multiplexer

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-18 Thread Greg Kroah-Hartman
On Thu, Apr 13, 2017 at 06:43:07PM +0200, Peter Rosin wrote: > +config MUX_GPIO > + tristate "GPIO-controlled Multiplexer" > + depends on OF && GPIOLIB Why have the gpio and mux core in the same patch? And why does this depend on OF? > + help > + GPIO-controlled Multiplexer

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-18 Thread Philipp Zabel
Hi Peter, On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: [...] > diff --git a/include/linux/mux.h b/include/linux/mux.h > new file mode 100644 > index ..febdde4246df > --- /dev/null > +++ b/include/linux/mux.h [...] Consider separating mux.h into a consumer header and a driver

Re: [PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-18 Thread Philipp Zabel
Hi Peter, On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: [...] > diff --git a/include/linux/mux.h b/include/linux/mux.h > new file mode 100644 > index ..febdde4246df > --- /dev/null > +++ b/include/linux/mux.h [...] Consider separating mux.h into a consumer header and a driver

[PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-13 Thread Peter Rosin
Add a new minimalistic subsystem that handles multiplexer controllers. When multiplexers are used in various places in the kernel, and the same multiplexer controller can be used for several independent things, there should be one place to implement support for said multiplexer controller. A

[PATCH v13 03/10] mux: minimal mux subsystem and gpio-based mux controller

2017-04-13 Thread Peter Rosin
Add a new minimalistic subsystem that handles multiplexer controllers. When multiplexers are used in various places in the kernel, and the same multiplexer controller can be used for several independent things, there should be one place to implement support for said multiplexer controller. A