Re: [RFC/PATCH v3 1/3] usb: common: introduce usb_state_string()

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

 



Hi,

On Sat, Jan 26, 2013 at 10:05:46PM +0800, Peter Chen wrote:
> On Thu, Jan 24, 2013 at 10:40:36PM +0200, Felipe Balbi wrote:
> > this function will receive enum usb_device_state
> > and return a human-readable string from it or,
> > case an unknown value is passed as argument,
> > the string "UNKNOWN".
> > 
> > Signed-off-by: Felipe Balbi <balbi@xxxxxx>
> > ---
> >  drivers/usb/usb-common.c | 21 +++++++++++++++++++++
> >  include/linux/usb/ch9.h  |  9 +++++++++
> >  2 files changed, 30 insertions(+)
> > 
> > diff --git a/drivers/usb/usb-common.c b/drivers/usb/usb-common.c
> > index d29503e..070b681 100644
> > --- a/drivers/usb/usb-common.c
> > +++ b/drivers/usb/usb-common.c
> > @@ -32,4 +32,25 @@ const char *usb_speed_string(enum usb_device_speed speed)
> >  }
> >  EXPORT_SYMBOL_GPL(usb_speed_string);
> >  
> > +const char *usb_state_string(enum usb_device_state state)
> > +{
> > +	static const char *const names[] = {
> > +		[USB_STATE_NOTATTACHED] = "not attached",
> > +		[USB_STATE_ATTACHED] = "attached",
> > +		[USB_STATE_POWERED] = "powered",
> > +		[USB_STATE_RECONNECTING] = "reconnecting",
> > +		[USB_STATE_UNAUTHENTICATED] = "unauthenticated",
> > +		[USB_STATE_DEFAULT] = "default",
> > +		[USB_STATE_ADDRESS] = "addresssed",
> > +		[USB_STATE_CONFIGURED] = "configured",
> > +		[USB_STATE_SUSPENDED] = "suspended",
> > +	};
> Hi Felipe, I just ask again what's the meaning of "reconnecting"?

not something I can answer. The enum has been there for ages, and the
documentation about it doesn't really mention reconnecting. Anyway, it's
something the Host stack needs...

> I also try to understand at your coming dwc patch (3/3), but
> can't find the reference.

Reference for "reconnecting" ? Well, I don't use it. It doesn't mean I
shouldn't provide a human-readable string for that enum value, does it ?

-- 
balbi

Attachment: signature.asc
Description: Digital signature


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

  Powered by Linux