author: Emil Renner Berthing <emil.renner.berthing@canonical.com> 2023-07-22 16:18:24 +0200
committer: Emil Renner Berthing <emil.renner.berthing@canonical.com> 2024-01-30 15:22:25 +0100
commit: 5293f377ba6e684ae022034fbd07d4f8b10a257d
parent: 03ba57a546c73e7c149a336cb5ca2f3e0c886734
Commit Summary:
Diffstat:
1 file changed, 15 insertions, 20 deletions
diff --git a/drivers/usb/cdns3/cdns3-starfive.c b/drivers/usb/cdns3/cdns3-starfive.c
index dc941dbae723..03b66787fc6f 100644
--- a/drivers/usb/cdns3/cdns3-starfive.c
+++ b/drivers/usb/cdns3/cdns3-starfive.c
@@ -33,7 +33,6 @@
#define USB_REFCLK_MODE BIT(23)
struct cdns_starfive {
- struct device *dev;
struct reset_control *resets;
struct clk_bulk_data *clks;
int num_clks;
@@ -49,7 +48,7 @@ static int cdns_mode_init(struct device *dev, struct cdns_starfive *data)
"starfive,stg-syscon", 1, &usb_mode);
if (IS_ERR(syscon))
return dev_err_probe(dev, PTR_ERR(syscon),
- "Failed to parse starfive,stg-syscon\n");
+ "failed to parse starfive,stg-syscon\n");
regmap_update_bits(syscon, usb_mode,
USB_MISC_CFG_MASK,
@@ -75,18 +74,17 @@ static int cdns_mode_init(struct device *dev, struct cdns_starfive *data)
return 0;
}
-static int cdns_clk_rst_init(struct cdns_starfive *data)
+static int cdns_clk_rst_init(struct device *dev, struct cdns_starfive *data)
{
int ret;
ret = clk_bulk_prepare_enable(data->num_clks, data->clks);
if (ret)
- return dev_err_probe(data->dev, ret,
- "failed to enable clocks\n");
+ return dev_err_probe(dev, ret, "failed to enable clocks\n");
ret = reset_control_deassert(data->resets);
if (ret) {
- dev_err(data->dev, "failed to reset clocks\n");
+ dev_err(dev, "failed to reset clocks\n");
goto err_clk_init;
}
@@ -97,7 +95,7 @@ err_clk_init:
return ret;
}
-static void cdns_clk_rst_deinit(struct cdns_starfive *data)
+static void cdns_clk_rst_deinit(struct device *dev, struct cdns_starfive *data)
{
reset_control_assert(data->resets);
clk_bulk_disable_unprepare(data->num_clks, data->clks);
@@ -113,30 +111,26 @@ static int cdns_starfive_probe(struct platform_device *pdev)
if (!data)
return -ENOMEM;
- data->dev = dev;
-
- data->num_clks = devm_clk_bulk_get_all(data->dev, &data->clks);
+ data->num_clks = devm_clk_bulk_get_all(dev, &data->clks);
if (data->num_clks < 0)
- return dev_err_probe(data->dev, -ENODEV,
- "Failed to get clocks\n");
+ return dev_err_probe(dev, -ENODEV, "failed to get clocks\n");
- data->resets = devm_reset_control_array_get_exclusive(data->dev);
+ data->resets = devm_reset_control_array_get_exclusive(dev);
if (IS_ERR(data->resets))
- return dev_err_probe(data->dev, PTR_ERR(data->resets),
- "Failed to get resets");
+ return dev_err_probe(dev, PTR_ERR(data->resets), "failed to get resets\n");
ret = cdns_mode_init(dev, data);
if (ret)
return ret;
- ret = cdns_clk_rst_init(data);
+ ret = cdns_clk_rst_init(dev, data);
if (ret)
return ret;
ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
if (ret) {
- dev_err(dev, "Failed to create children\n");
- cdns_clk_rst_deinit(data);
+ dev_err(dev, "failed to create children\n");
+ cdns_clk_rst_deinit(dev, data);
return ret;
}
@@ -167,7 +161,7 @@ static void cdns_starfive_remove(struct platform_device *pdev)
pm_runtime_disable(dev);
pm_runtime_put_noidle(dev);
- cdns_clk_rst_deinit(data);
+ cdns_clk_rst_deinit(dev, data);
platform_set_drvdata(pdev, NULL);
}
@@ -193,14 +187,14 @@ static int cdns_starfive_resume(struct device *dev)
{
struct cdns_starfive *data = dev_get_drvdata(dev);
- return cdns_clk_rst_init(data);
+ return cdns_clk_rst_init(dev, data);
}
static int cdns_starfive_suspend(struct device *dev)
{
struct cdns_starfive *data = dev_get_drvdata(dev);
- cdns_clk_rst_deinit(data);
+ cdns_clk_rst_deinit(dev, data);
return 0;
}