linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Peter Chen <peter.chen@nxp.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Benson Leung <bleung@chromium.org>,
	Prashant Malani <pmalani@chromium.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	Felipe Balbi <balbi@kernel.org>,
	Chunfeng Yun <chunfeng.yun@mediatek.com>, Bin Liu <b-liu@ti.com>
Subject: Re: [PATCH v2 5/9] usb: roles: Provide the switch drivers handle to the switch in the API
Date: Mon, 2 Mar 2020 11:17:38 +0200	[thread overview]
Message-ID: <20200302091738.GB22243@kuha.fi.intel.com> (raw)
In-Reply-To: <20200302062302.GE3834@b29397-desktop>

On Mon, Mar 02, 2020 at 06:22:59AM +0000, Peter Chen wrote:
> > > @@ -613,9 +613,10 @@ static enum usb_role ci_usb_role_switch_get(struct device *dev)
> > >  	return role;
> > >  }
> > >  
> > > -static int ci_usb_role_switch_set(struct device *dev, enum usb_role role)
> > > +static int ci_usb_role_switch_set(struct usb_role_switch *sw,
> > > +				  enum usb_role role)
> > >  {
> > > -	struct ci_hdrc *ci = dev_get_drvdata(dev);
> > > +	struct ci_hdrc *ci = usb_role_switch_get_drvdata(sw);
> > >  	struct ci_hdrc_cable *cable = NULL;
> > >  	enum usb_role current_role = ci_role_to_usb_role(ci);
> > >  	enum ci_role ci_role = usb_role_to_ci_role(role);
> > > @@ -1118,6 +1119,7 @@ static int ci_hdrc_probe(struct platform_device *pdev)
> > >  	}
> > >  
> > >  	if (ci_role_switch.fwnode) {
> > > +		ci_role_switch.driver_data = ci;
> 
> And chipidea code, better change it like cdns3's, otherwise, the
> switch desc for all controllers have the same driver_data.

That I'll skip after all...

Note that since the context of the switch descriptor is always copied
during registration, the driver_data is not going to be the same for
every switch.

The structure is actually filled in two separate functions, so the
change is not straightforward. We can still change that of course, but
it's out side the scope of this series, so it needs to be done
separately.


thanks,

-- 
heikki

  parent reply	other threads:[~2020-03-02  9:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-24 12:13 [PATCH v2 0/9] usb: typec: Driver for Intel PMC Mux-Agent Heikki Krogerus
2020-02-24 12:13 ` [PATCH v2 1/9] usb: typec: mux: Allow the muxes to be named Heikki Krogerus
2020-02-24 12:13 ` [PATCH v2 2/9] usb: typec: mux: Add helpers for setting the mux state Heikki Krogerus
2020-02-24 12:14 ` [PATCH v2 3/9] usb: typec: mux: Allow the mux handles to be requested with fwnode Heikki Krogerus
2020-02-24 12:14 ` [PATCH v2 4/9] usb: roles: Leave the private driver data pointer to the drivers Heikki Krogerus
2020-02-24 12:14 ` [PATCH v2 5/9] usb: roles: Provide the switch drivers handle to the switch in the API Heikki Krogerus
2020-02-24 13:14   ` Peter Chen
2020-03-02  6:22     ` Peter Chen
2020-03-02  7:43       ` Heikki Krogerus
2020-03-02  8:01         ` Heikki Krogerus
2020-03-02  9:17       ` Heikki Krogerus [this message]
2020-03-02 10:14         ` Peter Chen
2020-02-24 12:14 ` [PATCH v2 6/9] usb: roles: Allow the role switches to be named Heikki Krogerus
2020-02-24 12:14 ` [PATCH v2 7/9] device property: Export fwnode_get_name() Heikki Krogerus
2020-02-24 16:09   ` Rafael J. Wysocki
2020-02-24 12:14 ` [PATCH v2 8/9] usb: typec: Add definitions for Thunderbolt 3 Alternate Mode Heikki Krogerus
2020-02-24 12:14 ` [PATCH v2 9/9] usb: typec: driver for Intel PMC mux control 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=20200302091738.GB22243@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=b-liu@ti.com \
    --cc=balbi@kernel.org \
    --cc=bleung@chromium.org \
    --cc=chunfeng.yun@mediatek.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=peter.chen@nxp.com \
    --cc=pmalani@chromium.org \
    /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).