buf);
}
-static int __maybe_unused sysc_runtime_suspend(struct device *dev)
+static int __maybe_unused sysc_runtime_suspend_legacy(struct device *dev,
+ struct sysc *ddata)
+{
+ struct ti_sysc_platform_data *pdata;
+ int error;
+
+ pdata = dev_get_platdata(ddata->dev);
+ if (!pdata)
+ return 0;
+
+ if (!pdata->idle_module)
+ return -ENODEV;
+
+ error = pdata->idle_module(dev, &ddata->cookie);
+ if (error)
+ dev_err(dev, "%s: could not idle: %i\n",
+ __func__, error);
+
+ return 0;
+}
+
+static int __maybe_unused sysc_runtime_resume_legacy(struct device *dev,
+ struct sysc *ddata)
{
struct ti_sysc_platform_data *pdata;
+ int error;
+
+ pdata = dev_get_platdata(ddata->dev);
+ if (!pdata)
+ return 0;
+
+ if (!pdata->enable_module)
+ return -ENODEV;
+
+ error = pdata->enable_module(dev, &ddata->cookie);
+ if (error)
+ dev_err(dev, "%s: could not enable: %i\n",
+ __func__, error);
+
+ return 0;
+}
+
+static int __maybe_unused sysc_runtime_suspend(struct device *dev)
+{
struct sysc *ddata;
int error = 0, i;
return 0;
if (ddata->legacy_mode) {
- pdata = dev_get_platdata(ddata->dev);
- if (!pdata)
- return 0;
-
- if (!pdata->idle_module)
- return -ENODEV;
-
- error = pdata->idle_module(dev, &ddata->cookie);
- if (error)
- dev_err(dev, "%s: could not idle: %i\n",
- __func__, error);
+ error = sysc_runtime_suspend_legacy(dev, ddata);
+ if (!error)
+ ddata->enabled = false;
- goto idled;
+ return error;
}
for (i = 0; i < ddata->nr_clocks; i++) {
clk_disable(ddata->clocks[i]);
}
-idled:
ddata->enabled = false;
return error;
static int __maybe_unused sysc_runtime_resume(struct device *dev)
{
- struct ti_sysc_platform_data *pdata;
struct sysc *ddata;
int error = 0, i;
return 0;
if (ddata->legacy_mode) {
- pdata = dev_get_platdata(ddata->dev);
- if (!pdata)
- return 0;
+ error = sysc_runtime_resume_legacy(dev, ddata);
+ if (!error)
+ ddata->enabled = true;
- if (!pdata->enable_module)
- return -ENODEV;
-
- error = pdata->enable_module(dev, &ddata->cookie);
- if (error)
- dev_err(dev, "%s: could not enable: %i\n",
- __func__, error);
-
- goto awake;
+ return error;
}
for (i = 0; i < ddata->nr_clocks; i++) {
return error;
}
-awake:
ddata->enabled = true;
return error;