mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 11:19:37 +00:00
USB: phy: drop legacy board-file support
The legacy interface for associating controllers with phys from board
files and platform code has been unused since commit 9080b8dc76
("ARM:
OMAP2+: Remove legacy usb-host.c platform init code"). Since then, all
calls to usb_get_phy_dev() and its devres version have been returning
-ENODEV.
Now that the final calls to these functions have been removed, we can
drop this legacy lookup interface altogether.
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d8351953fb
commit
c3c0ac70c7
2 changed files with 2 additions and 125 deletions
|
@ -27,7 +27,6 @@
|
|||
#define DEFAULT_ACA_CUR_MAX 5000
|
||||
|
||||
static LIST_HEAD(phy_list);
|
||||
static LIST_HEAD(phy_bind_list);
|
||||
static DEFINE_SPINLOCK(phy_lock);
|
||||
|
||||
struct phy_devm {
|
||||
|
@ -50,24 +49,6 @@ static struct usb_phy *__usb_find_phy(struct list_head *list,
|
|||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static struct usb_phy *__usb_find_phy_dev(struct device *dev,
|
||||
struct list_head *list, u8 index)
|
||||
{
|
||||
struct usb_phy_bind *phy_bind = NULL;
|
||||
|
||||
list_for_each_entry(phy_bind, list, list) {
|
||||
if (!(strcmp(phy_bind->dev_name, dev_name(dev))) &&
|
||||
phy_bind->index == index) {
|
||||
if (phy_bind->phy)
|
||||
return phy_bind->phy;
|
||||
else
|
||||
return ERR_PTR(-EPROBE_DEFER);
|
||||
}
|
||||
}
|
||||
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static struct usb_phy *__of_usb_find_phy(struct device_node *node)
|
||||
{
|
||||
struct usb_phy *phy;
|
||||
|
@ -584,72 +565,6 @@ struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(devm_usb_get_phy_by_phandle);
|
||||
|
||||
/**
|
||||
* usb_get_phy_dev - find the USB PHY
|
||||
* @dev - device that requests this phy
|
||||
* @index - the index of the phy
|
||||
*
|
||||
* Returns the phy driver, after getting a refcount to it; or
|
||||
* -ENODEV if there is no such phy. The caller is responsible for
|
||||
* calling usb_put_phy() to release that count.
|
||||
*
|
||||
* For use by USB host and peripheral drivers.
|
||||
*/
|
||||
struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index)
|
||||
{
|
||||
struct usb_phy *phy = NULL;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&phy_lock, flags);
|
||||
|
||||
phy = __usb_find_phy_dev(dev, &phy_bind_list, index);
|
||||
if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) {
|
||||
dev_dbg(dev, "unable to find transceiver\n");
|
||||
if (!IS_ERR(phy))
|
||||
phy = ERR_PTR(-ENODEV);
|
||||
|
||||
goto err0;
|
||||
}
|
||||
|
||||
get_device(phy->dev);
|
||||
|
||||
err0:
|
||||
spin_unlock_irqrestore(&phy_lock, flags);
|
||||
|
||||
return phy;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(usb_get_phy_dev);
|
||||
|
||||
/**
|
||||
* devm_usb_get_phy_dev - find the USB PHY using device ptr and index
|
||||
* @dev - device that requests this phy
|
||||
* @index - the index of the phy
|
||||
*
|
||||
* Gets the phy using usb_get_phy_dev(), and associates a device with it using
|
||||
* devres. On driver detach, release function is invoked on the devres data,
|
||||
* then, devres data is freed.
|
||||
*
|
||||
* For use by USB host and peripheral drivers.
|
||||
*/
|
||||
struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index)
|
||||
{
|
||||
struct usb_phy **ptr, *phy;
|
||||
|
||||
ptr = devres_alloc(devm_usb_phy_release, sizeof(*ptr), GFP_KERNEL);
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
|
||||
phy = usb_get_phy_dev(dev, index);
|
||||
if (!IS_ERR(phy)) {
|
||||
*ptr = phy;
|
||||
devres_add(dev, ptr);
|
||||
} else
|
||||
devres_free(ptr);
|
||||
|
||||
return phy;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devm_usb_get_phy_dev);
|
||||
|
||||
/**
|
||||
* devm_usb_put_phy - release the USB PHY
|
||||
* @dev - device that wants to release this phy
|
||||
|
@ -745,7 +660,6 @@ EXPORT_SYMBOL_GPL(usb_add_phy);
|
|||
*/
|
||||
int usb_add_phy_dev(struct usb_phy *x)
|
||||
{
|
||||
struct usb_phy_bind *phy_bind;
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
|
@ -762,13 +676,9 @@ int usb_add_phy_dev(struct usb_phy *x)
|
|||
ATOMIC_INIT_NOTIFIER_HEAD(&x->notifier);
|
||||
|
||||
spin_lock_irqsave(&phy_lock, flags);
|
||||
list_for_each_entry(phy_bind, &phy_bind_list, list)
|
||||
if (!(strcmp(phy_bind->phy_dev_name, dev_name(x->dev))))
|
||||
phy_bind->phy = x;
|
||||
|
||||
list_add_tail(&x->head, &phy_list);
|
||||
|
||||
spin_unlock_irqrestore(&phy_lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(usb_add_phy_dev);
|
||||
|
@ -782,15 +692,10 @@ EXPORT_SYMBOL_GPL(usb_add_phy_dev);
|
|||
void usb_remove_phy(struct usb_phy *x)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct usb_phy_bind *phy_bind;
|
||||
|
||||
spin_lock_irqsave(&phy_lock, flags);
|
||||
if (x) {
|
||||
list_for_each_entry(phy_bind, &phy_bind_list, list)
|
||||
if (phy_bind->phy == x)
|
||||
phy_bind->phy = NULL;
|
||||
if (x)
|
||||
list_del(&x->head);
|
||||
}
|
||||
spin_unlock_irqrestore(&phy_lock, flags);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(usb_remove_phy);
|
||||
|
|
|
@ -157,22 +157,6 @@ struct usb_phy {
|
|||
enum usb_charger_type (*charger_detect)(struct usb_phy *x);
|
||||
};
|
||||
|
||||
/**
|
||||
* struct usb_phy_bind - represent the binding for the phy
|
||||
* @dev_name: the device name of the device that will bind to the phy
|
||||
* @phy_dev_name: the device name of the phy
|
||||
* @index: used if a single controller uses multiple phys
|
||||
* @phy: reference to the phy
|
||||
* @list: to maintain a linked list of the binding information
|
||||
*/
|
||||
struct usb_phy_bind {
|
||||
const char *dev_name;
|
||||
const char *phy_dev_name;
|
||||
u8 index;
|
||||
struct usb_phy *phy;
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
/* for board-specific init logic */
|
||||
extern int usb_add_phy(struct usb_phy *, enum usb_phy_type type);
|
||||
extern int usb_add_phy_dev(struct usb_phy *);
|
||||
|
@ -234,8 +218,6 @@ usb_phy_vbus_off(struct usb_phy *x)
|
|||
extern struct usb_phy *usb_get_phy(enum usb_phy_type type);
|
||||
extern struct usb_phy *devm_usb_get_phy(struct device *dev,
|
||||
enum usb_phy_type type);
|
||||
extern struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index);
|
||||
extern struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index);
|
||||
extern struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
|
||||
const char *phandle, u8 index);
|
||||
extern struct usb_phy *devm_usb_get_phy_by_node(struct device *dev,
|
||||
|
@ -261,16 +243,6 @@ static inline struct usb_phy *devm_usb_get_phy(struct device *dev,
|
|||
return ERR_PTR(-ENXIO);
|
||||
}
|
||||
|
||||
static inline struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index)
|
||||
{
|
||||
return ERR_PTR(-ENXIO);
|
||||
}
|
||||
|
||||
static inline struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index)
|
||||
{
|
||||
return ERR_PTR(-ENXIO);
|
||||
}
|
||||
|
||||
static inline struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
|
||||
const char *phandle, u8 index)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue