* [PATCH] arch: arm: mach-omap2: voltage.c: Remove some unused functions
@ 2015-01-01 17:06 Rickard Strandqvist
2015-01-02 9:46 ` Arnd Bergmann
0 siblings, 1 reply; 3+ messages in thread
From: Rickard Strandqvist @ 2015-01-01 17:06 UTC (permalink / raw)
To: linux-arm-kernel
Removes some functions that are not used anywhere:
voltdm_for_each_pwrdm() omap_change_voltscale_method()
This was partially found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
arch/arm/mach-omap2/voltage.c | 65 ++---------------------------------------
arch/arm/mach-omap2/voltage.h | 5 ----
2 files changed, 3 insertions(+), 67 deletions(-)
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 3783b86..43e42fd 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -224,37 +224,6 @@ int omap_voltage_register_pmic(struct voltagedomain *voltdm,
}
/**
- * 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
*
* This API is to be called in the later stages of the
@@ -321,10 +290,9 @@ static struct voltagedomain *_voltdm_lookup(const char *name)
* @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.
+ * Associate the powerdomain @pwrdm with a voltagedomain @voltdm.
+ * 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)
{
@@ -340,33 +308,6 @@ int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm)
}
/**
- * 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 *
*
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index f7f2879..d8208f3 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -163,8 +163,6 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
unsigned long volt);
int omap_voltage_register_pmic(struct voltagedomain *voltdm,
struct omap_voltdm_pmic *pmic);
-void omap_change_voltscale_method(struct voltagedomain *voltdm,
- int voltscale_method);
int omap_voltage_late_init(void);
extern void omap2xxx_voltagedomains_init(void);
@@ -177,9 +175,6 @@ void voltdm_init(struct voltagedomain **voltdm_list);
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);
void voltdm_reset(struct voltagedomain *voltdm);
unsigned long voltdm_get_voltage(struct voltagedomain *voltdm);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] arch: arm: mach-omap2: voltage.c: Remove some unused functions
2015-01-01 17:06 [PATCH] arch: arm: mach-omap2: voltage.c: Remove some unused functions Rickard Strandqvist
@ 2015-01-02 9:46 ` Arnd Bergmann
[not found] ` <CAKXHbyPnTzOxWBBL0eiCNOPfF=htKpFRSt+R5h8o45ERp7zi1A@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2015-01-02 9:46 UTC (permalink / raw)
To: linux-arm-kernel
On Thursday 01 January 2015 18:06:34 Rickard Strandqvist wrote:
> -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__);
> - }
> -}
The VOLTSCALE_VPFORCEUPDATE/VOLTSCALE_VCBYPASS macros are now unused and should
be removed as well.
> @@ -321,10 +290,9 @@ static struct voltagedomain *_voltdm_lookup(const char *name)
> * @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.
> + * Associate the powerdomain @pwrdm with a voltagedomain @voltdm.
> + * 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)
> {
You have correctly spotted the only place that references voltdm_for_each_pwrdm
and changed the comment, but you failed to notice that it no longer makes
sense to call voltdm_add_pwrdm or keep the voltdm->pwrdm_list pointer
at all, so this function, and the associated list heads can all be removed
as well.
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] arch: arm: mach-omap2: voltage.c: Remove some unused functions
[not found] ` <CAKXHbyPnTzOxWBBL0eiCNOPfF=htKpFRSt+R5h8o45ERp7zi1A@mail.gmail.com>
@ 2015-01-02 21:22 ` Arnd Bergmann
0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2015-01-02 21:22 UTC (permalink / raw)
To: linux-arm-kernel
On Friday 02 January 2015 17:02:21 Rickard Strandqvist wrote:
> 2015-01-02 10:46 GMT+01:00 Arnd Bergmann <arnd@arndb.de>:
> > On Thursday 01 January 2015 18:06:34 Rickard Strandqvist wrote:
> >
> > You have correctly spotted the only place that references
> > voltdm_for_each_pwrdm
> > and changed the comment, but you failed to notice that it no longer makes
> > sense to call voltdm_add_pwrdm or keep the voltdm->pwrdm_list pointer
> > at all, so this function, and the associated list heads can all be removed
> > as well.
> >
> > Arnd
> >
>
>
> Hi Arnd
>
> Thanks for your reply.
>
> I see what you mean, but you are aware that voltdm_add_pwrdm() also be
> called from:
> arch/arm/mach-omap2/powerdomain.c in _pwrdm_register()
Yes, that call needs to be removed as well of course.
> I have also removde the voltdm_for_each()
Ok, sounds good. That list of course has to stay though, so removing
_voltdm_register would be bad ;-)
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-02 21:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-01 17:06 [PATCH] arch: arm: mach-omap2: voltage.c: Remove some unused functions Rickard Strandqvist
2015-01-02 9:46 ` Arnd Bergmann
[not found] ` <CAKXHbyPnTzOxWBBL0eiCNOPfF=htKpFRSt+R5h8o45ERp7zi1A@mail.gmail.com>
2015-01-02 21:22 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox