linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Hans de Goede <hdegoede@redhat.com>, Jun Li <jun.li@nxp.com>,
	Mats Karrman <mats.dev.list@gmail.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [3/8] usb: typec: mux: Get the mux identifier from function parameter
Date: Mon, 9 Jul 2018 12:03:10 -0700	[thread overview]
Message-ID: <20180709190310.GC1896@roeck-us.net> (raw)

On Thu, Jun 28, 2018 at 02:34:27PM +0300, Heikki Krogerus wrote:
> On Thu, Jun 28, 2018 at 07:51:55PM +0900, Greg Kroah-Hartman wrote:
> > On Wed, Jun 27, 2018 at 06:19:48PM +0300, Heikki Krogerus wrote:
> > > In order for the muxes to be usable with alternate modes,
> > > the alternate mode devices will need also to be able to get
> > > a handle to the muxes on top of the port devices. To make
> > > that possible, the muxes need to be possible to request with
> > > an identifier.
> > > 
> > > This will change the API so that the mux identifier is given
> > > as a function parameter to typec_mux_get(), and the hard-coded
> > > "typec-mux" is replaced with that value.
> > > 
> > > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > > ---
> > >  drivers/usb/typec/class.c     | 2 +-
> > >  drivers/usb/typec/mux.c       | 6 +++---
> > >  include/linux/usb/typec_mux.h | 2 +-
> > >  3 files changed, 5 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> > > index 2b3eaa969f3b..b860bd3a0acb 100644
> > > --- a/drivers/usb/typec/class.c
> > > +++ b/drivers/usb/typec/class.c
> > > @@ -1357,7 +1357,7 @@ struct typec_port *typec_register_port(struct device *parent,
> > >  		goto err_switch;
> > >  	}
> > >  
> > > -	port->mux = typec_mux_get(cap->fwnode ? &port->dev : parent);
> > > +	port->mux = typec_mux_get(parent, "typec-mux");
> > 
> > This changes the first parameter for this call, is that ok?  Doesn't
> > that change the functionality here?
> 
> No, I noticed that cap->fwnode is set after we call that function, so
> we always ended up using parent.
> 
> This needs to be fixed properly of course, but I choose not to propose
> anything in this series. We don't yet use the fwnode handle with the
> muxes in any case, as the device connection API does not support
> anything else except build-in connections descriptions for now.
> 

Seems to me that would be better handled in a separate patch or patch
series. With this patch, the code ends up always using parent here but
there is still
	port->sw = typec_switch_get(cap->fwnode ? &port->dev : parent);
a couple of lines above. This is at the very least confusing to the
reader.

Guenter
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2018-07-09 19:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-09 19:03 Guenter Roeck [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-07-20 10:53 [3/8] usb: typec: mux: Get the mux identifier from function parameter Heikki Krogerus
2018-06-28 11:34 Heikki Krogerus
2018-06-28 10:51 Greg Kroah-Hartman
2018-06-27 15:19 Heikki Krogerus

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=20180709190310.GC1896@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jun.li@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mats.dev.list@gmail.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).