regulator: core: add const qualifier to ops in struct regulator_desc
struct regulator_ops *ops is a member in struct regulator_desc, which gets its value from individual regulator driver upon regulator_register() and is used by regulator core APIs. It's not allowed for regulator core to modify any of these callbacks in *ops. Add 'const' qualifier to enforce that. Signed-off-by: Guodong Xu <guodong.xu@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
parent
7d1311b93e
commit
272e2315fa
@ -839,7 +839,7 @@ static void print_constraints(struct regulator_dev *rdev)
|
|||||||
static int machine_constraints_voltage(struct regulator_dev *rdev,
|
static int machine_constraints_voltage(struct regulator_dev *rdev,
|
||||||
struct regulation_constraints *constraints)
|
struct regulation_constraints *constraints)
|
||||||
{
|
{
|
||||||
struct regulator_ops *ops = rdev->desc->ops;
|
const struct regulator_ops *ops = rdev->desc->ops;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* do we need to apply the constraint voltage */
|
/* do we need to apply the constraint voltage */
|
||||||
@ -938,7 +938,7 @@ static int machine_constraints_voltage(struct regulator_dev *rdev,
|
|||||||
static int machine_constraints_current(struct regulator_dev *rdev,
|
static int machine_constraints_current(struct regulator_dev *rdev,
|
||||||
struct regulation_constraints *constraints)
|
struct regulation_constraints *constraints)
|
||||||
{
|
{
|
||||||
struct regulator_ops *ops = rdev->desc->ops;
|
const struct regulator_ops *ops = rdev->desc->ops;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!constraints->min_uA && !constraints->max_uA)
|
if (!constraints->min_uA && !constraints->max_uA)
|
||||||
@ -982,7 +982,7 @@ static int set_machine_constraints(struct regulator_dev *rdev,
|
|||||||
const struct regulation_constraints *constraints)
|
const struct regulation_constraints *constraints)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct regulator_ops *ops = rdev->desc->ops;
|
const struct regulator_ops *ops = rdev->desc->ops;
|
||||||
|
|
||||||
if (constraints)
|
if (constraints)
|
||||||
rdev->constraints = kmemdup(constraints, sizeof(*constraints),
|
rdev->constraints = kmemdup(constraints, sizeof(*constraints),
|
||||||
@ -2209,7 +2209,7 @@ EXPORT_SYMBOL_GPL(regulator_count_voltages);
|
|||||||
int regulator_list_voltage(struct regulator *regulator, unsigned selector)
|
int regulator_list_voltage(struct regulator *regulator, unsigned selector)
|
||||||
{
|
{
|
||||||
struct regulator_dev *rdev = regulator->rdev;
|
struct regulator_dev *rdev = regulator->rdev;
|
||||||
struct regulator_ops *ops = rdev->desc->ops;
|
const struct regulator_ops *ops = rdev->desc->ops;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (rdev->desc->fixed_uV && rdev->desc->n_voltages == 1 && !selector)
|
if (rdev->desc->fixed_uV && rdev->desc->n_voltages == 1 && !selector)
|
||||||
@ -2573,7 +2573,7 @@ int regulator_set_voltage_time(struct regulator *regulator,
|
|||||||
int old_uV, int new_uV)
|
int old_uV, int new_uV)
|
||||||
{
|
{
|
||||||
struct regulator_dev *rdev = regulator->rdev;
|
struct regulator_dev *rdev = regulator->rdev;
|
||||||
struct regulator_ops *ops = rdev->desc->ops;
|
const struct regulator_ops *ops = rdev->desc->ops;
|
||||||
int old_sel = -1;
|
int old_sel = -1;
|
||||||
int new_sel = -1;
|
int new_sel = -1;
|
||||||
int voltage;
|
int voltage;
|
||||||
@ -3337,7 +3337,7 @@ EXPORT_SYMBOL_GPL(regulator_mode_to_status);
|
|||||||
static int add_regulator_attributes(struct regulator_dev *rdev)
|
static int add_regulator_attributes(struct regulator_dev *rdev)
|
||||||
{
|
{
|
||||||
struct device *dev = &rdev->dev;
|
struct device *dev = &rdev->dev;
|
||||||
struct regulator_ops *ops = rdev->desc->ops;
|
const struct regulator_ops *ops = rdev->desc->ops;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
/* some attributes need specific methods to be displayed */
|
/* some attributes need specific methods to be displayed */
|
||||||
@ -3905,7 +3905,7 @@ core_initcall(regulator_init);
|
|||||||
static int __init regulator_init_complete(void)
|
static int __init regulator_init_complete(void)
|
||||||
{
|
{
|
||||||
struct regulator_dev *rdev;
|
struct regulator_dev *rdev;
|
||||||
struct regulator_ops *ops;
|
const struct regulator_ops *ops;
|
||||||
struct regulation_constraints *c;
|
struct regulation_constraints *c;
|
||||||
int enabled, ret;
|
int enabled, ret;
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ struct regulator_desc {
|
|||||||
int id;
|
int id;
|
||||||
bool continuous_voltage_range;
|
bool continuous_voltage_range;
|
||||||
unsigned n_voltages;
|
unsigned n_voltages;
|
||||||
struct regulator_ops *ops;
|
const struct regulator_ops *ops;
|
||||||
int irq;
|
int irq;
|
||||||
enum regulator_type type;
|
enum regulator_type type;
|
||||||
struct module *owner;
|
struct module *owner;
|
||||||
|
Loading…
Reference in New Issue
Block a user