Re: [RFC PATCHv2] usb: USB Type-C Connector Class
From: Heikki Krogerus
Date: Fri May 20 2016 - 06:58:13 EST
On Thu, May 19, 2016 at 08:43:27AM -0700, Greg KH wrote:
> On Thu, May 19, 2016 at 04:48:46PM +0200, Oliver Neukum wrote:
> > On Thu, 2016-05-19 at 15:44 +0300, Heikki Krogerus wrote:
> > > + ret = typec_register_altmodes(dev, partner->alt_modes);
> > > + if (ret) {
> > > + device_unregister(dev);
> > > + return ret;
> > > + }
> > > +
> > > + /* REVISIT: Creating symlink for the port device for now. */
> > > + ret = sysfs_create_link(&port->dev.kobj, &dev->kobj, "partner");
> > > + if (ret)
> > > + dev_WARN(&port->dev, "failed to create link to %s (%d)\n",
> > > + dev_name(dev), ret);
> >
> > The attributes should be present as soon as the device is announced.
>
> Yes, this is wrong and racy (hint, if you have to drop down to a sysfs
> call within a driver, almost always something is wrong...)
I'll remove those links.
I'm hoping to get comments about the attributes in general. Do we
have everything needed to describe the state and capabilities of USB
Type-C ports with them, and are they in reasonable places. I'm playing
with these links in couple of places in the code, and I've put
questions in the comments on some of them. I'm really not planning on
leaving them as they are.
So if you guys could provide your opinions on those questions, I would
much appreciate.
Thanks a lot,
--
heikki