Re: [PATCH 1/3] USB: OHCI/EHCI: add struct for generic platform driver

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

 



On Sun, 12 Feb 2012, Hauke Mehrtens wrote:

> struct usb_hci_pdata is used by the generic OHCI and EHCI platform
> driver. The is used to activate some some special handling in the
> generic driver.

...

> +#define USB_HCI_PDATA_PORT_POWER_SET (1 << 0)
> +#define USB_HCI_PDATA_HAS_TT_SET (1 << 1)
> +
> +struct usb_hci_pdata {
> +	int		flags;
> +	int		caps_offset;
> +	unsigned	has_tt:1;
> +	unsigned	power_set_is_on:1;
> +};

You don't need a separate "flags" field; just create additional 
bitflags.  For example, power_set_is_off along with power_set_is_on.

(Actually I suspect these power_set things aren't needed at all.  The
hub driver will automatically turn on power to all ports when the root
hub is registered, and before that it shouldn't matter whether power is
on or off.)

And you don't need USB_HCI_PDATA_HAS_TT_SET.  The default is that 
has_tt is 0, so simply set the has_tt field whenever it should be on.

I like this approach, because it's easy to expand the structure as
needed when supporting new platforms.

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