Re: [RFC PATCH 1/2] usb: Add physical layer utility code

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

 



On Mon, Aug 01, 2011 at 05:29:14PM +0300, Heikki Krogerus wrote:
> This is only the idea. Work in progress.
> 
> Adds struct usb_transceiver and functions to interact with
> the controller drivers. This also introduces very basic
> support for multiple transceivers.

+1, we really need this to properly handle phys. The current single
transceiver support depends on the fact that there may be only one
otg port, which is true. Other host only ports often have a transceiver
aswell though.

> +
> +/*
> + * usb_get_transceiver - find a USB transceiver
> + * @name: the name of the transceiver driver
> + *
> + * Returns a transceiver driver matching the name, or NULL, and gets
> + * refcount to it. The caller is responsible for calling
> + * usb_put_transceiver() to release that count.
> + */
> +struct usb_transceiver *usb_get_transceiver(const char *name)
> +{

What are drivers supposed to pass as name? I would say dev_name(dev),
right? In this case we might want to pass a struct device here.

> +	struct usb_transceiver *xceiv;
> +
> +	mutex_lock(&xceiv_lock);
> +
> +	list_for_each_entry(xceiv, &xceiv_list, list) {
> +		if (strcmp(xceiv->name, name) == 0) {
> +			get_device(xceiv->dev);
> +			mutex_unlock(&xceiv_lock);
> +			return xceiv;
> +		}
> +	}
> +
> +	mutex_unlock(&xceiv_lock);
> +
> +	return NULL;
> +}
> +EXPORT_SYMBOL(usb_get_transceiver);
> +

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
--
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