All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leo Li <leoyang.li@nxp.com>
To: Peter Rosin <peda@axentia.se>,
	Pankaj Bansal <pankaj.bansal@nxp.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>
Subject: RE: [PATCH] drivers: mux: Generic register bitfield-based multiplexer driver
Date: Tue, 19 Feb 2019 20:07:27 +0000	[thread overview]
Message-ID: <AM6PR04MB5863258E5168DD5115AEBDA88F7C0@AM6PR04MB5863.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <bfe3fd9c-7375-1c53-5692-7cdea3c9b670@axentia.se>



> -----Original Message-----
> From: Peter Rosin <peda@axentia.se>
> Sent: Monday, February 18, 2019 5:39 PM
> To: Leo Li <leoyang.li@nxp.com>; Pankaj Bansal <pankaj.bansal@nxp.com>;
> linux-kernel@vger.kernel.org; Philipp Zabel <p.zabel@pengutronix.de>
> Subject: Re: [PATCH] drivers: mux: Generic register bitfield-based
> multiplexer driver
> 
> On 2019-02-18 22:07, Leo Li wrote:
> > From: Peter Rosin <peda@axentia.se>
> >> On 2019-02-18 11:20, Pankaj Bansal wrote:
> >>> From: Peter Rosin [mailto:peda@axentia.se]
> >>>> Anyway, I would prefer if you could extend drivers/mux/mmio.c to
> >>>> support both compatibles, and using the compatible to select if
> >>>>
> >>>> 	regmap = syscon_node_to_regmap(np->parent);
> >>>>
> >>>> or
> >>>>
> >>>> 	regmap = dev_get_regmap(dev->parent, NULL);
> >>>>
> >>>> is called to get to the desired regmap.
> >>>
> >>> This can be done. The name mmio.c however suggests that mux is
> >>> controlled by a Memory mapped device.
> >>> IMO, if the generic regmap API is to be added to it, the name needs
> >>> to changed. Any suggestions ?
> >>
> >> Just keep the driver name as is, there is no shortage of drivers
> >> supporting more than one thing...
> >
> > You are right that a lot of drivers support multiple functions. But
> > the problem here is that the current name mmio is only a subset of
> > what the updated driver will handle, which can create confusion.
> 
> I refuse the duplication. This new driver is doing the exact same thing (-ish)
> as the old one. Having the same code in two places is just a recipe for future
> divergence when everyone have forgotten that there are two nearly
> identical drivers that both need patching. Stating this in a comment
> somewhere in the drivers will not help all that much in my experience. The
> comment will be missing from the context in some seemingly trivial patch,
> and there you go. There *will* be weed down the line, if duplication is
> allowed.

I agree that we should avoid the duplication.

> 
> I can agree that mux-regmap.c and CONFIG_MUX_REGMAP would have
> been better names, but mux-mmio is already there. So it is what it is. But if
> you can convince me that changing the name will not cause any trouble
> anywhere for any existing mux-mmio users, I suppose we can do a rename.
> But I bet there will be some nasty corner cases and odd use cases, so you will
> have to present strong arguments.

I don't think that it is hard to maintain the backward compatibility with the rename.  The updated driver can keep handling the "mmio-mux" device tree compatible string.  And we can also have MUX_MMIO selects the new MUX_REGMAP if we want to keep the compatibility with old kernel config file.

> 
> Just update the Kconfig to document the dual nature and remove the
> MFD_SYSCON dependency. I suppose you also need to handle the possibly
> missing syscon in the .c file, details, details. But something like this perhaps:
> 
> config MUX_MMIO
> 	tristate "MMIO/Regmap register bitfield-controlled Multiplexer"
> 	depends on OF || COMPILE_TEST
> 	help
> 	  MMIO/Regmap register bitfield-controlled Multiplexer controller.
> 
> 	  The driver builds multiplexer controllers for bitfields in either
> 	  a syscon register or a driver regmap register. For N bit wide
> 	  bitfields, there will be 2^N possible multiplexer states.
> 
> 	  To compile the driver as a module, choose M here: the module will
> 	  be called mux-mmio.
> 
> Cheers,
> Peter

      reply	other threads:[~2019-02-19 20:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190218110509.28225-1-pankaj.bansal@nxp.com>
2019-02-18  8:05 ` FW: [PATCH] drivers: mux: Generic register bitfield-based multiplexer driver Pankaj Bansal
2019-02-18  9:47 ` Peter Rosin
2019-02-18 10:20   ` Pankaj Bansal
2019-02-18 14:27     ` Peter Rosin
2019-02-18 21:07       ` Leo Li
2019-02-18 23:38         ` Peter Rosin
2019-02-19 20:07           ` Leo Li [this message]

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=AM6PR04MB5863258E5168DD5115AEBDA88F7C0@AM6PR04MB5863.eurprd04.prod.outlook.com \
    --to=leoyang.li@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=pankaj.bansal@nxp.com \
    --cc=peda@axentia.se \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.