All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Lan Tianyu <tianyu.lan@intel.com>,
	lenb@kernel.org, sarah.a.sharp@linux.intel.com,
	linux-usb@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: Re: [PATCH 3/3] usb : Add sysfs files to control usb port's power
Date: Thu, 14 Jun 2012 07:35:59 -0700	[thread overview]
Message-ID: <20120614143559.GA13449@kroah.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1206140947410.1701-100000@iolanthe.rowland.org>

On Thu, Jun 14, 2012 at 09:57:37AM -0400, Alan Stern wrote:
> 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...

Ah, but they can have "children" if we want to move the devices attached
to them there.  But that's something to consider in the future, not for
now.

As for the other things, if we applied those rules to all other parts of
the device tree, well, it would be a lot smaller :)

You are showing something "logical" in the tree, that exists, and has
attributes (power, etc.).  Because of that, userspace needs to be
notified of them, as it should be doing things with them.  So, make them
a device so that userspace can actually see them.  Otherwise things
break down really quickly, and you can not use the "standard" userspace
tools to control them (i.e. libusb and friends.)

thanks,

greg k-h

      reply	other threads:[~2012-06-14 14:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-11  2:24 [PATCH 0/3] USB/ACPI: Add usb port power off mechanism Lan Tianyu
     [not found] ` <1339381474-17413-1-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2012-06-11  2:24   ` [PATCH 1/3] xhci: Add clear PORT_POWER feature process in the xhci_hub_control() Lan Tianyu
2012-06-11  2:24 ` [PATCH 2/3] USB/ACPI: Add usb port's acpi power control in the xhci PORT_POWER feature request process Lan Tianyu
2012-06-13 19:30   ` Greg KH
2012-06-13 20:53     ` Sarah Sharp
2012-06-13 21:00       ` Greg KH
     [not found]     ` <20120613193038.GA6312-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2012-06-13 21:10       ` Alan Stern
2012-06-13 21:35         ` Sarah Sharp
2012-06-14  7:22       ` Lan Tianyu
2012-06-14 15:44         ` Greg KH
2012-06-15  7:05           ` Lan Tianyu
2012-06-11  2:24 ` [PATCH 3/3] usb : Add sysfs files to control usb port's power Lan Tianyu
2012-06-11 14:12   ` Alan Stern
     [not found]   ` <1339381474-17413-4-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2012-06-13 19:33     ` Greg KH
     [not found]       ` <20120613193323.GB6312-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2012-06-13 21:15         ` Alan Stern
2012-06-13 21:46           ` Greg KH
2012-06-14 13:57             ` Alan Stern
2012-06-14 14:35               ` Greg KH [this message]

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=20120614143559.GA13449@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sarah.a.sharp@linux.intel.com \
    --cc=stern@rowland.harvard.edu \
    --cc=tianyu.lan@intel.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.