2019-05-22 18:47:37

by Florian Fainelli

[permalink] [raw]
Subject: [PATCH 0/2] cpufreq: brcmstb-avs-cpufreq: Couple fixes

Hi Rafael, Viresh,

These patch series contains two minor fixes for the brcmstb-avs-cpufreq
driver.

Florian Fainelli (2):
cpufreq: brcmstb-avs-cpufreq: Fix initial command check
cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency

drivers/cpufreq/brcmstb-avs-cpufreq.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

--
2.17.1


2019-05-22 18:47:39

by Florian Fainelli

[permalink] [raw]
Subject: [PATCH 1/2] cpufreq: brcmstb-avs-cpufreq: Fix initial command check

There is a logical error in brcm_avs_is_firmware_loaded() whereby if the
firmware returns -EINVAL, we will be reporting this as an error. The
comment is correct, the code was not.

Fixes: de322e085995 ("cpufreq: brcmstb-avs-cpufreq: AVS CPUfreq driver for Broadcom STB SoCs")
Signed-off-by: Florian Fainelli <[email protected]>
---
drivers/cpufreq/brcmstb-avs-cpufreq.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmstb-avs-cpufreq.c
index e6f9cbe5835f..6ed53ca8aa98 100644
--- a/drivers/cpufreq/brcmstb-avs-cpufreq.c
+++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c
@@ -446,8 +446,8 @@ static bool brcm_avs_is_firmware_loaded(struct private_data *priv)
rc = brcm_avs_get_pmap(priv, NULL);
magic = readl(priv->base + AVS_MBOX_MAGIC);

- return (magic == AVS_FIRMWARE_MAGIC) && (rc != -ENOTSUPP) &&
- (rc != -EINVAL);
+ return (magic == AVS_FIRMWARE_MAGIC) && ((rc != -ENOTSUPP) ||
+ (rc != -EINVAL));
}

static unsigned int brcm_avs_cpufreq_get(unsigned int cpu)
--
2.17.1

2019-05-22 18:49:11

by Florian Fainelli

[permalink] [raw]
Subject: [PATCH 2/2] cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency

What we read back from the register is going to be capped at 32-bits,
and cpufreq_freq_table.frequency is an unsigned int. Avoid any possible
value truncation by using the appropriate return value.

Fixes: de322e085995 ("cpufreq: brcmstb-avs-cpufreq: AVS CPUfreq driver for Broadcom STB SoCs")
Signed-off-by: Florian Fainelli <[email protected]>
---
drivers/cpufreq/brcmstb-avs-cpufreq.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmstb-avs-cpufreq.c
index 6ed53ca8aa98..77b0e5d0fb13 100644
--- a/drivers/cpufreq/brcmstb-avs-cpufreq.c
+++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c
@@ -384,12 +384,12 @@ static int brcm_avs_set_pstate(struct private_data *priv, unsigned int pstate)
return __issue_avs_command(priv, AVS_CMD_SET_PSTATE, true, args);
}

-static unsigned long brcm_avs_get_voltage(void __iomem *base)
+static u32 brcm_avs_get_voltage(void __iomem *base)
{
return readl(base + AVS_MBOX_VOLTAGE1);
}

-static unsigned long brcm_avs_get_frequency(void __iomem *base)
+static u32 brcm_avs_get_frequency(void __iomem *base)
{
return readl(base + AVS_MBOX_FREQUENCY) * 1000; /* in kHz */
}
@@ -653,14 +653,14 @@ static ssize_t show_brcm_avs_voltage(struct cpufreq_policy *policy, char *buf)
{
struct private_data *priv = policy->driver_data;

- return sprintf(buf, "0x%08lx\n", brcm_avs_get_voltage(priv->base));
+ return sprintf(buf, "0x%08x\n", brcm_avs_get_voltage(priv->base));
}

static ssize_t show_brcm_avs_frequency(struct cpufreq_policy *policy, char *buf)
{
struct private_data *priv = policy->driver_data;

- return sprintf(buf, "0x%08lx\n", brcm_avs_get_frequency(priv->base));
+ return sprintf(buf, "0x%08x\n", brcm_avs_get_frequency(priv->base));
}

cpufreq_freq_attr_ro(brcm_avs_pstate);
--
2.17.1

2019-05-27 10:54:26

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH 0/2] cpufreq: brcmstb-avs-cpufreq: Couple fixes

On Wednesday, May 22, 2019 8:45:45 PM CEST Florian Fainelli wrote:
> Hi Rafael, Viresh,
>
> These patch series contains two minor fixes for the brcmstb-avs-cpufreq
> driver.
>
> Florian Fainelli (2):
> cpufreq: brcmstb-avs-cpufreq: Fix initial command check
> cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency
>
> drivers/cpufreq/brcmstb-avs-cpufreq.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)

These look straightforward enough to me, but it would be good to get an ACK from the
driver maintainer for them.



2019-05-29 17:03:57

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH 0/2] cpufreq: brcmstb-avs-cpufreq: Couple fixes

On 5/27/19 3:51 AM, Rafael J. Wysocki wrote:
> On Wednesday, May 22, 2019 8:45:45 PM CEST Florian Fainelli wrote:
>> Hi Rafael, Viresh,
>>
>> These patch series contains two minor fixes for the brcmstb-avs-cpufreq
>> driver.
>>
>> Florian Fainelli (2):
>> cpufreq: brcmstb-avs-cpufreq: Fix initial command check
>> cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency
>>
>> drivers/cpufreq/brcmstb-avs-cpufreq.c | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> These look straightforward enough to me, but it would be good to get an ACK from the
> driver maintainer for them.

Adding Markus' other email address.

>
>
>


--
Florian

2019-06-03 19:57:55

by Markus Mayer

[permalink] [raw]
Subject: Re: [PATCH 0/2] cpufreq: brcmstb-avs-cpufreq: Couple fixes

On Wed, 29 May 2019 at 10:02, Florian Fainelli <[email protected]> wrote:
>
> On 5/27/19 3:51 AM, Rafael J. Wysocki wrote:
> > On Wednesday, May 22, 2019 8:45:45 PM CEST Florian Fainelli wrote:
> >> Hi Rafael, Viresh,
> >>
> >> These patch series contains two minor fixes for the brcmstb-avs-cpufreq
> >> driver.
> >>
> >> Florian Fainelli (2):
> >> cpufreq: brcmstb-avs-cpufreq: Fix initial command check
> >> cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency

To both of these

Acked-by: Markus Mayer <[email protected]>

My apologies for the delay.

> >> drivers/cpufreq/brcmstb-avs-cpufreq.c | 12 ++++++------
> >> 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > These look straightforward enough to me, but it would be good to get an ACK from the
> > driver maintainer for them.
>
> Adding Markus' other email address.
> --
> Florian

2019-06-04 04:05:20

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH 0/2] cpufreq: brcmstb-avs-cpufreq: Couple fixes

On 03-06-19, 12:55, Markus Mayer wrote:
> On Wed, 29 May 2019 at 10:02, Florian Fainelli <[email protected]> wrote:
> >
> > On 5/27/19 3:51 AM, Rafael J. Wysocki wrote:
> > > On Wednesday, May 22, 2019 8:45:45 PM CEST Florian Fainelli wrote:
> > >> Hi Rafael, Viresh,
> > >>
> > >> These patch series contains two minor fixes for the brcmstb-avs-cpufreq
> > >> driver.
> > >>
> > >> Florian Fainelli (2):
> > >> cpufreq: brcmstb-avs-cpufreq: Fix initial command check
> > >> cpufreq: brcmstb-avs-cpufreq: Fix types for voltage/frequency
>
> To both of these
>
> Acked-by: Markus Mayer <[email protected]>

Applied. Thanks.

--
viresh