struct dm_regulator_uclass_plat *uc_pdata;
int ret, old_uV = uV, is_enabled = 0;
+ if (!ops || !ops->set_value)
+ return -ENOSYS;
+
uc_pdata = dev_get_uclass_plat(dev);
if (uc_pdata->min_uV != -ENODATA && uV < uc_pdata->min_uV)
return -EINVAL;
if (uV == -ENODATA)
return -EINVAL;
- if (!ops || !ops->set_value)
- return -ENOSYS;
-
if (uc_pdata->ramp_delay) {
is_enabled = regulator_get_enable(dev);
old_uV = regulator_get_value(dev);
const struct dm_regulator_ops *ops = dev_get_driver_ops(dev);
struct dm_regulator_uclass_plat *uc_pdata;
+ if (!ops || !ops->set_suspend_value)
+ return -ENOSYS;
+
uc_pdata = dev_get_uclass_plat(dev);
if (uc_pdata->min_uV != -ENODATA && uV < uc_pdata->min_uV)
return -EINVAL;
if (uV == -ENODATA)
return -EINVAL;
- if (!ops->set_suspend_value)
- return -ENOSYS;
-
return ops->set_suspend_value(dev, uV);
}
{
const struct dm_regulator_ops *ops = dev_get_driver_ops(dev);
- if (!ops->get_suspend_value)
+ if (!ops || !ops->get_suspend_value)
return -ENOSYS;
return ops->get_suspend_value(dev);
const struct dm_regulator_ops *ops = dev_get_driver_ops(dev);
struct dm_regulator_uclass_plat *uc_pdata;
+ if (!ops || !ops->set_current)
+ return -ENOSYS;
+
uc_pdata = dev_get_uclass_plat(dev);
if (uc_pdata->min_uA != -ENODATA && uA < uc_pdata->min_uA)
return -EINVAL;
if (uA == -ENODATA)
return -EINVAL;
- if (!ops || !ops->set_current)
- return -ENOSYS;
-
return ops->set_current(dev, uA);
}
{
const struct dm_regulator_ops *ops = dev_get_driver_ops(dev);
- if (!ops->set_suspend_enable)
+ if (!ops || !ops->set_suspend_enable)
return -ENOSYS;
return ops->set_suspend_enable(dev, enable);
{
const struct dm_regulator_ops *ops = dev_get_driver_ops(dev);
- if (!ops->get_suspend_enable)
+ if (!ops || !ops->get_suspend_enable)
return -ENOSYS;
return ops->get_suspend_enable(dev);