All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] opp: Increase parsed_static_opps on _of_add_opp_table_v1
@ 2020-07-16  2:54 Walter Lozano
  2020-07-16  3:22 ` Viresh Kumar
  0 siblings, 1 reply; 3+ messages in thread
From: Walter Lozano @ 2020-07-16  2:54 UTC (permalink / raw)
  To: linux-pm
  Cc: kernel, Walter Lozano, Nishanth Menon, Stephen Boyd,
	Viresh Kumar, linux-kernel

Currently, when using _of_add_opp_table_v2 parsed_static_opps is
increased and this value is used on _opp_remove_all_static to
check if there are static opps entries that need to be freed.
Unfortunately this does not happens when using _of_add_opp_table_v1,
which leads to warnings.

This patch increases parsed_static_opps on _of_add_opp_table_v1 in a
similar way as in _of_add_opp_table_v2.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---

 drivers/opp/of.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/opp/of.c b/drivers/opp/of.c
index 9a5873591a40..b2bc82bf8b42 100644
--- a/drivers/opp/of.c
+++ b/drivers/opp/of.c
@@ -917,6 +917,8 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table)
 		nr -= 2;
 	}
 
+	opp_table->parsed_static_opps++;
+
 	return ret;
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] opp: Increase parsed_static_opps on _of_add_opp_table_v1
  2020-07-16  2:54 [PATCH] opp: Increase parsed_static_opps on _of_add_opp_table_v1 Walter Lozano
@ 2020-07-16  3:22 ` Viresh Kumar
  2020-07-16 12:57   ` Walter Lozano
  0 siblings, 1 reply; 3+ messages in thread
From: Viresh Kumar @ 2020-07-16  3:22 UTC (permalink / raw)
  To: Walter Lozano
  Cc: linux-pm, kernel, Nishanth Menon, Stephen Boyd, Viresh Kumar,
	linux-kernel

On 15-07-20, 23:54, Walter Lozano wrote:
> Currently, when using _of_add_opp_table_v2 parsed_static_opps is
> increased and this value is used on _opp_remove_all_static to
> check if there are static opps entries that need to be freed.
> Unfortunately this does not happens when using _of_add_opp_table_v1,
> which leads to warnings.
> 
> This patch increases parsed_static_opps on _of_add_opp_table_v1 in a
> similar way as in _of_add_opp_table_v2.
> 
> Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
> ---
> 
>  drivers/opp/of.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/opp/of.c b/drivers/opp/of.c
> index 9a5873591a40..b2bc82bf8b42 100644
> --- a/drivers/opp/of.c
> +++ b/drivers/opp/of.c
> @@ -917,6 +917,8 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table)
>  		nr -= 2;
>  	}
>  
> +	opp_table->parsed_static_opps++;
> +
>  	return ret;
>  }

Merged with this and added relevant Fixes and stable tags.

diff --git a/drivers/opp/of.c b/drivers/opp/of.c
index b2bc82bf8b42..314f306140a1 100644
--- a/drivers/opp/of.c
+++ b/drivers/opp/of.c
@@ -902,6 +902,10 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table)
                return -EINVAL;
        }
 
+       mutex_lock(&opp_table->lock);
+       opp_table->parsed_static_opps = 1;
+       mutex_unlock(&opp_table->lock);
+
        val = prop->value;
        while (nr) {
                unsigned long freq = be32_to_cpup(val++) * 1000;
@@ -917,8 +921,6 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table)
                nr -= 2;
        }
 
-       opp_table->parsed_static_opps++;
-
        return ret;
 }
 
-- 
viresh

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] opp: Increase parsed_static_opps on _of_add_opp_table_v1
  2020-07-16  3:22 ` Viresh Kumar
@ 2020-07-16 12:57   ` Walter Lozano
  0 siblings, 0 replies; 3+ messages in thread
From: Walter Lozano @ 2020-07-16 12:57 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: linux-pm, kernel, Nishanth Menon, Stephen Boyd, Viresh Kumar,
	linux-kernel

Hi Viresh,

On 16/7/20 00:22, Viresh Kumar wrote:
> On 15-07-20, 23:54, Walter Lozano wrote:
>> Currently, when using _of_add_opp_table_v2 parsed_static_opps is
>> increased and this value is used on _opp_remove_all_static to
>> check if there are static opps entries that need to be freed.
>> Unfortunately this does not happens when using _of_add_opp_table_v1,
>> which leads to warnings.
>>
>> This patch increases parsed_static_opps on _of_add_opp_table_v1 in a
>> similar way as in _of_add_opp_table_v2.
>>
>> Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
>> ---
>>
>>   drivers/opp/of.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/opp/of.c b/drivers/opp/of.c
>> index 9a5873591a40..b2bc82bf8b42 100644
>> --- a/drivers/opp/of.c
>> +++ b/drivers/opp/of.c
>> @@ -917,6 +917,8 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table)
>>   		nr -= 2;
>>   	}
>>   
>> +	opp_table->parsed_static_opps++;
>> +
>>   	return ret;
>>   }
> Merged with this and added relevant Fixes and stable tags.


Thanks for apply the proper fix.


>
> diff --git a/drivers/opp/of.c b/drivers/opp/of.c
> index b2bc82bf8b42..314f306140a1 100644
> --- a/drivers/opp/of.c
> +++ b/drivers/opp/of.c
> @@ -902,6 +902,10 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table)
>                  return -EINVAL;
>          }
>   
> +       mutex_lock(&opp_table->lock);
> +       opp_table->parsed_static_opps = 1;
> +       mutex_unlock(&opp_table->lock);
> +
>          val = prop->value;
>          while (nr) {
>                  unsigned long freq = be32_to_cpup(val++) * 1000;
> @@ -917,8 +921,6 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table)
>                  nr -= 2;
>          }
>   
> -       opp_table->parsed_static_opps++;
> -
>          return ret;
>   }
>   

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-16 12:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16  2:54 [PATCH] opp: Increase parsed_static_opps on _of_add_opp_table_v1 Walter Lozano
2020-07-16  3:22 ` Viresh Kumar
2020-07-16 12:57   ` Walter Lozano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.