All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	Oliver Neukum <oneukum@suse.com>,
	Felipe Balbi <felipe.balbi@linux.intel.com>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH v5 1/2] usb: USB Type-C connector class
Date: Thu, 18 Aug 2016 13:43:38 +0300	[thread overview]
Message-ID: <20160818104338.GV9927@kuha.fi.intel.com> (raw)
In-Reply-To: <20160817175311.GA4598@roeck-us.net>

On Wed, Aug 17, 2016 at 10:53:11AM -0700, Guenter Roeck wrote:
> On Wed, Aug 17, 2016 at 01:34:40PM +0300, Heikki Krogerus wrote:
> > The purpose of USB Type-C connector class is to provide
> > unified interface for the user space to get the status and
> > basic information about USB Type-C connectors on a system,
> > control over data role swapping, and when the port supports
> > USB Power Delivery, also control over power role swapping
> > and Alternate Modes.
> > 
> > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > ---
> [ ... ]
> > +
> > +static ssize_t
> > +current_data_role_store(struct device *dev, struct device_attribute *attr,
> > +			const char *buf, size_t size)
> > +{
> > +	struct typec_port *port = to_typec_port(dev);
> > +	enum typec_role role;
> > +	int ret;
> > +
> > +	if (port->cap->type != TYPEC_PORT_DRP) {
> > +		dev_dbg(dev, "data role swap only supported with DRP ports\n");
> > +		return -EOPNOTSUPP;
> > +	}
> > +
> > +	if (!port->cap->dr_set) {
> > +		dev_dbg(dev, "data role swapping not supported\n");
> > +		return -EOPNOTSUPP;
> > +	}
> > +
> > +	if (!port->connected)
> > +		return size;
> 
> I don't think this check should be here. The connection status can change after
> the connection status was checked. We should leave it up to the driver to
> perform the necessary checks.
> 
> This also applies to the other role change store functions.

OK.

Thanks,

-- 
heikki

  reply	other threads:[~2016-08-18 10:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-17 10:34 [PATCH v5 0/2] USB Type-C Connector class Heikki Krogerus
2016-08-17 10:34 ` [PATCH v5 1/2] usb: USB Type-C connector class Heikki Krogerus
2016-08-17 13:14   ` Frans Klaver
2016-08-17 13:53     ` Heikki Krogerus
2016-08-17 14:00       ` Frans Klaver
2016-08-17 13:30   ` Guenter Roeck
2016-08-17 13:56     ` Heikki Krogerus
2016-08-17 17:53   ` Guenter Roeck
2016-08-18 10:43     ` Heikki Krogerus [this message]
2016-08-17 17:58   ` Guenter Roeck
2016-08-18 10:44     ` Heikki Krogerus
2016-08-17 10:34 ` [PATCH v5 2/2] usb: typec: add driver for Intel Whiskey Cove PMIC USB Type-C PHY Heikki Krogerus
2016-08-17 12:53   ` Felipe Balbi
2016-08-17 13:32     ` Heikki Krogerus
2016-08-17 23:00     ` Peter Chen
2016-08-18  6:33       ` Felipe Balbi
2016-08-18 13:32         ` Guenter Roeck

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=20160818104338.GV9927@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=felipe.balbi@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=oneukum@suse.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 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.