lkml.org 
[lkml]   [2016]   [Aug]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 1/2] usb: USB Type-C connector class
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

\
 
 \ /
  Last update: 2016-09-17 09:57    [W:0.122 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site