Commit b91dc63b authored by Rickard Strandqvist's avatar Rickard Strandqvist Committed by Tony Lindgren

ARM: OMAP2+: voltage: Remove some unused functions

Removes some functions that are not used anywhere:
omap_change_voltscale_method() voltdm_add_pwrdm()
voltdm_for_each() voltdm_for_each_pwrdm()

And remove define VOLTSCALE_VPFORCEUPDATE and VOLTSCALE_VCBYPASS

This was partially found by using a static code analysis program called cppcheck.
Signed-off-by: default avatarRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 10637afb
...@@ -115,7 +115,6 @@ static int _pwrdm_register(struct powerdomain *pwrdm) ...@@ -115,7 +115,6 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
} }
pwrdm->voltdm.ptr = voltdm; pwrdm->voltdm.ptr = voltdm;
INIT_LIST_HEAD(&pwrdm->voltdm_node); INIT_LIST_HEAD(&pwrdm->voltdm_node);
voltdm_add_pwrdm(voltdm, pwrdm);
skip_voltdm: skip_voltdm:
spin_lock_init(&pwrdm->_lock); spin_lock_init(&pwrdm->_lock);
......
...@@ -223,37 +223,6 @@ int omap_voltage_register_pmic(struct voltagedomain *voltdm, ...@@ -223,37 +223,6 @@ int omap_voltage_register_pmic(struct voltagedomain *voltdm,
return 0; return 0;
} }
/**
* omap_change_voltscale_method() - API to change the voltage scaling method.
* @voltdm: pointer to the VDD whose voltage scaling method
* has to be changed.
* @voltscale_method: the method to be used for voltage scaling.
*
* This API can be used by the board files to change the method of voltage
* scaling between vpforceupdate and vcbypass. The parameter values are
* defined in voltage.h
*/
void omap_change_voltscale_method(struct voltagedomain *voltdm,
int voltscale_method)
{
if (!voltdm || IS_ERR(voltdm)) {
pr_warn("%s: VDD specified does not exist!\n", __func__);
return;
}
switch (voltscale_method) {
case VOLTSCALE_VPFORCEUPDATE:
voltdm->scale = omap_vp_forceupdate_scale;
return;
case VOLTSCALE_VCBYPASS:
voltdm->scale = omap_vc_bypass_scale;
return;
default:
pr_warn("%s: Trying to change the method of voltage scaling to an unsupported one!\n",
__func__);
}
}
/** /**
* omap_voltage_late_init() - Init the various voltage parameters * omap_voltage_late_init() - Init the various voltage parameters
* *
...@@ -316,90 +285,11 @@ static struct voltagedomain *_voltdm_lookup(const char *name) ...@@ -316,90 +285,11 @@ static struct voltagedomain *_voltdm_lookup(const char *name)
return voltdm; return voltdm;
} }
/**
* voltdm_add_pwrdm - add a powerdomain to a voltagedomain
* @voltdm: struct voltagedomain * to add the powerdomain to
* @pwrdm: struct powerdomain * to associate with a voltagedomain
*
* Associate the powerdomain @pwrdm with a voltagedomain @voltdm. This
* enables the use of voltdm_for_each_pwrdm(). Returns -EINVAL if
* presented with invalid pointers; -ENOMEM if memory could not be allocated;
* or 0 upon success.
*/
int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm)
{
if (!voltdm || !pwrdm)
return -EINVAL;
pr_debug("voltagedomain: %s: associating powerdomain %s\n",
voltdm->name, pwrdm->name);
list_add(&pwrdm->voltdm_node, &voltdm->pwrdm_list);
return 0;
}
/**
* voltdm_for_each_pwrdm - call function for each pwrdm in a voltdm
* @voltdm: struct voltagedomain * to iterate over
* @fn: callback function *
*
* Call the supplied function @fn for each powerdomain in the
* voltagedomain @voltdm. Returns -EINVAL if presented with invalid
* pointers; or passes along the last return value of the callback
* function, which should be 0 for success or anything else to
* indicate failure.
*/
int voltdm_for_each_pwrdm(struct voltagedomain *voltdm,
int (*fn)(struct voltagedomain *voltdm,
struct powerdomain *pwrdm))
{
struct powerdomain *pwrdm;
int ret = 0;
if (!fn)
return -EINVAL;
list_for_each_entry(pwrdm, &voltdm->pwrdm_list, voltdm_node)
ret = (*fn)(voltdm, pwrdm);
return ret;
}
/**
* voltdm_for_each - call function on each registered voltagedomain
* @fn: callback function *
*
* Call the supplied function @fn for each registered voltagedomain.
* The callback function @fn can return anything but 0 to bail out
* early from the iterator. Returns the last return value of the
* callback function, which should be 0 for success or anything else
* to indicate failure; or -EINVAL if the function pointer is null.
*/
int voltdm_for_each(int (*fn)(struct voltagedomain *voltdm, void *user),
void *user)
{
struct voltagedomain *temp_voltdm;
int ret = 0;
if (!fn)
return -EINVAL;
list_for_each_entry(temp_voltdm, &voltdm_list, node) {
ret = (*fn)(temp_voltdm, user);
if (ret)
break;
}
return ret;
}
static int _voltdm_register(struct voltagedomain *voltdm) static int _voltdm_register(struct voltagedomain *voltdm)
{ {
if (!voltdm || !voltdm->name) if (!voltdm || !voltdm->name)
return -EINVAL; return -EINVAL;
INIT_LIST_HEAD(&voltdm->pwrdm_list);
list_add(&voltdm->node, &voltdm_list); list_add(&voltdm->node, &voltdm_list);
pr_debug("voltagedomain: registered %s\n", voltdm->name); pr_debug("voltagedomain: registered %s\n", voltdm->name);
......
...@@ -23,10 +23,6 @@ ...@@ -23,10 +23,6 @@
struct powerdomain; struct powerdomain;
/* XXX document */
#define VOLTSCALE_VPFORCEUPDATE 1
#define VOLTSCALE_VCBYPASS 2
/* /*
* OMAP3 GENERIC setup times. Revisit to see if these needs to be * OMAP3 GENERIC setup times. Revisit to see if these needs to be
* passed from board or PMIC file * passed from board or PMIC file
...@@ -55,7 +51,6 @@ struct omap_vfsm_instance { ...@@ -55,7 +51,6 @@ struct omap_vfsm_instance {
* @name: Name of the voltage domain which can be used as a unique identifier. * @name: Name of the voltage domain which can be used as a unique identifier.
* @scalable: Whether or not this voltage domain is scalable * @scalable: Whether or not this voltage domain is scalable
* @node: list_head linking all voltage domains * @node: list_head linking all voltage domains
* @pwrdm_list: list_head linking all powerdomains in this voltagedomain
* @vc: pointer to VC channel associated with this voltagedomain * @vc: pointer to VC channel associated with this voltagedomain
* @vp: pointer to VP associated with this voltagedomain * @vp: pointer to VP associated with this voltagedomain
* @read: read a VC/VP register * @read: read a VC/VP register
...@@ -71,7 +66,6 @@ struct voltagedomain { ...@@ -71,7 +66,6 @@ struct voltagedomain {
char *name; char *name;
bool scalable; bool scalable;
struct list_head node; struct list_head node;
struct list_head pwrdm_list;
struct omap_vc_channel *vc; struct omap_vc_channel *vc;
const struct omap_vfsm_instance *vfsm; const struct omap_vfsm_instance *vfsm;
struct omap_vp_instance *vp; struct omap_vp_instance *vp;
...@@ -163,8 +157,6 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm, ...@@ -163,8 +157,6 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
unsigned long volt); unsigned long volt);
int omap_voltage_register_pmic(struct voltagedomain *voltdm, int omap_voltage_register_pmic(struct voltagedomain *voltdm,
struct omap_voltdm_pmic *pmic); struct omap_voltdm_pmic *pmic);
void omap_change_voltscale_method(struct voltagedomain *voltdm,
int voltscale_method);
int omap_voltage_late_init(void); int omap_voltage_late_init(void);
extern void omap2xxx_voltagedomains_init(void); extern void omap2xxx_voltagedomains_init(void);
...@@ -175,11 +167,6 @@ extern void omap54xx_voltagedomains_init(void); ...@@ -175,11 +167,6 @@ extern void omap54xx_voltagedomains_init(void);
struct voltagedomain *voltdm_lookup(const char *name); struct voltagedomain *voltdm_lookup(const char *name);
void voltdm_init(struct voltagedomain **voltdm_list); void voltdm_init(struct voltagedomain **voltdm_list);
int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm); int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm);
int voltdm_for_each(int (*fn)(struct voltagedomain *voltdm, void *user),
void *user);
int voltdm_for_each_pwrdm(struct voltagedomain *voltdm,
int (*fn)(struct voltagedomain *voltdm,
struct powerdomain *pwrdm));
int voltdm_scale(struct voltagedomain *voltdm, unsigned long target_volt); int voltdm_scale(struct voltagedomain *voltdm, unsigned long target_volt);
void voltdm_reset(struct voltagedomain *voltdm); void voltdm_reset(struct voltagedomain *voltdm);
unsigned long voltdm_get_voltage(struct voltagedomain *voltdm); unsigned long voltdm_get_voltage(struct voltagedomain *voltdm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment