Re: [PATCH 3/3] usb : Add sysfs files to control usb port's power

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 13 Jun 2012, Greg KH wrote:

> On Wed, Jun 13, 2012 at 05:15:08PM -0400, Alan Stern wrote:
> > On Wed, 13 Jun 2012, Greg KH wrote:
> > 
> > > > +	struct device_attribute	port_control_attr;
> > > > +	struct device_attribute	port_state_attr;
> > > > +	enum port_power_policy port_power_policy;
> > > 
> > > Why do you need an attribute per port here?  Shouldn't they just be
> > > static variables?  Why duplicate them for every port?
> > 
> > If they were static, there would be no way for the store and show
> > methods to know which port they were called for.  That's because the
> > ports aren't separate kobjects; all these port attributes are bound to
> > the hub device.
> 
> Ports should be a struct device if we are going to hang attributes off
> of them, otherwise userspace can get very confused.

Is that really appropriate?  Ports don't have their own driver, they
can't be probed or removed, they can't be suspended or resumed, you
can't do I/O to them, they don't have resources, they don't have 
children...

In short, they don't qualify as separate devices.  All they do have is
a few attributes (power, ownership, and connectivity).

> How about making a port a real device?  That should solve this problem,
> right?  And I thought I recommended doing that a month or so ago, what
> happened with that proposal?

I argued against it, for the reasons listed above.

Alan Stern

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux