summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/udc/tegra-xudc.c
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2020-03-02 16:53:49 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-03-04 13:12:50 +0300
commitbce3052f0c165685a074e50136e4d341bcd59f4a (patch)
treeaca5d7b0f95155a2195508e877dbb810fb985826 /drivers/usb/gadget/udc/tegra-xudc.c
parent69af044a7700552512a147e2ce3520741b65df41 (diff)
downloadlinux-bce3052f0c165685a074e50136e4d341bcd59f4a.tar.xz
usb: roles: Provide the switch drivers handle to the switch in the API
The USB role callback functions had a parameter pointing to the parent device (struct device) of the switch. The assumption was that the switch parent is always the controller. Firstly, that may not be true in every case, and secondly, it prevents us from supporting devices that supply multiple muxes. Changing the first parameter of usb_role_switch_set_t and usb_role_switch_get_t from struct device to struct usb_role_switch. Cc: Peter Chen <Peter.Chen@nxp.com> Cc: Felipe Balbi <balbi@kernel.org> Cc: Chunfeng Yun <chunfeng.yun@mediatek.com> Cc: Bin Liu <b-liu@ti.com> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20200302135353.56659-6-heikki.krogerus@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget/udc/tegra-xudc.c')
-rw-r--r--drivers/usb/gadget/udc/tegra-xudc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/usb/gadget/udc/tegra-xudc.c b/drivers/usb/gadget/udc/tegra-xudc.c
index 634c2c19a176..b9df6369d56d 100644
--- a/drivers/usb/gadget/udc/tegra-xudc.c
+++ b/drivers/usb/gadget/udc/tegra-xudc.c
@@ -676,12 +676,13 @@ static void tegra_xudc_usb_role_sw_work(struct work_struct *work)
}
-static int tegra_xudc_usb_role_sw_set(struct device *dev, enum usb_role role)
+static int tegra_xudc_usb_role_sw_set(struct usb_role_switch *sw,
+ enum usb_role role)
{
- struct tegra_xudc *xudc = dev_get_drvdata(dev);
+ struct tegra_xudc *xudc = usb_role_switch_get_drvdata(sw);
unsigned long flags;
- dev_dbg(dev, "%s role is %d\n", __func__, role);
+ dev_dbg(xudc->dev, "%s role is %d\n", __func__, role);
spin_lock_irqsave(&xudc->lock, flags);
@@ -3590,6 +3591,7 @@ static int tegra_xudc_probe(struct platform_device *pdev)
if (of_property_read_bool(xudc->dev->of_node, "usb-role-switch")) {
role_sx_desc.set = tegra_xudc_usb_role_sw_set;
role_sx_desc.fwnode = dev_fwnode(xudc->dev);
+ role_sx_desc.driver_data = xudc;
xudc->usb_role_sw = usb_role_switch_register(xudc->dev,
&role_sx_desc);