Message ID | 20220822153517.3747679-3-xu.yang_2@nxp.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | typec orientation switch support via mux controller | expand |
Hi! 2022-08-22 at 17:35, Xu Yang wrote: > Since some devices may link fwnode to dev but doesn't link of_node, > so here we could get mux_control from fwnode again. > > Signed-off-by: Xu Yang <xu.yang_2@nxp.com> > --- > drivers/mux/core.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/mux/core.c b/drivers/mux/core.c > index 49bedbe6316c..06d4e232e056 100644 > --- a/drivers/mux/core.c > +++ b/drivers/mux/core.c > @@ -538,6 +538,9 @@ static struct mux_control *mux_get(struct device *dev, const char *mux_name, > int index = 0; > int ret; > > + if (!np) > + np = to_of_node(dev_fwnode(dev)); > + > if (mux_name) { > if (state) > index = of_property_match_string(np, "mux-state-names", This feels like a band aid. Is it not possible to convert the whole thing to the fwnode interface? Cheers, Peter
Hi Peter, > -----Original Message----- > From: Peter Rosin <peda@axentia.se> > Sent: Tuesday, August 23, 2022 2:23 PM > To: Xu Yang <xu.yang_2@nxp.com>; heikki.krogerus@linux.intel.com; > robh+dt@kernel.org; shawnguo@kernel.org > Cc: gregkh@linuxfoundation.org; linux@roeck-us.net; Jun Li > <jun.li@nxp.com>; linux-usb@vger.kernel.org; dl-linux-imx <linux- > imx@nxp.com>; devicetree@vger.kernel.org; linux-arm- > kernel@lists.infradead.org > Subject: [EXT] Re: [PATCH 2/4] mux: allow get mux_control from fwnode if > of_node is NULL > > Caution: EXT Email > > Hi! > > 2022-08-22 at 17:35, Xu Yang wrote: > > Since some devices may link fwnode to dev but doesn't link of_node, so > > here we could get mux_control from fwnode again. > > > > Signed-off-by: Xu Yang <xu.yang_2@nxp.com> > > --- > > drivers/mux/core.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/mux/core.c b/drivers/mux/core.c index > > 49bedbe6316c..06d4e232e056 100644 > > --- a/drivers/mux/core.c > > +++ b/drivers/mux/core.c > > @@ -538,6 +538,9 @@ static struct mux_control *mux_get(struct device > *dev, const char *mux_name, > > int index = 0; > > int ret; > > > > + if (!np) > > + np = to_of_node(dev_fwnode(dev)); > > + > > if (mux_name) { > > if (state) > > index = of_property_match_string(np, > > "mux-state-names", > > This feels like a band aid. Is it not possible to convert the whole thing to the > fwnode interface? > Agreed. Actually, I'm hesitate to convert to fwnode interface due to not have a whole picture of all the mux controller users before. But now it should be okay to do so since all the existing drivers get mux controller based on platform device after my check. So, I will try to convert the whole thing to the fwnode interface in v2. Thanks, Xu Yang > Cheers, > Peter
diff --git a/drivers/mux/core.c b/drivers/mux/core.c index 49bedbe6316c..06d4e232e056 100644 --- a/drivers/mux/core.c +++ b/drivers/mux/core.c @@ -538,6 +538,9 @@ static struct mux_control *mux_get(struct device *dev, const char *mux_name, int index = 0; int ret; + if (!np) + np = to_of_node(dev_fwnode(dev)); + if (mux_name) { if (state) index = of_property_match_string(np, "mux-state-names",
Since some devices may link fwnode to dev but doesn't link of_node, so here we could get mux_control from fwnode again. Signed-off-by: Xu Yang <xu.yang_2@nxp.com> --- drivers/mux/core.c | 3 +++ 1 file changed, 3 insertions(+)