linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thermal: armada: Fix -Wshift-negative-value
@ 2019-06-13 18:49 Nathan Huckleberry
  2019-06-14 10:11 ` Daniel Lezcano
  0 siblings, 1 reply; 9+ messages in thread
From: Nathan Huckleberry @ 2019-06-13 18:49 UTC (permalink / raw)
  To: miquel.raynal, rui.zhang, edubezval, daniel.lezcano
  Cc: linux-pm, linux-kernel, Nathan Huckleberry, clang-built-linux

Clang produces the following warning

drivers/thermal/armada_thermal.c:270:33: warning: shifting a negative
signed value is undefined [-Wshift-negative-value]
1 warning        reg &= ~CONTROL1_TSEN_AVG_MASK <<
CONTROL1_TSEN_AVG_SHIFT; generated
.
               ~~~~~~~~~~~~~~~~~~~~~~~ ^

CONTROL1_TSEN_AVG_SHIFT is defined to be zero.
Since shifting by zero does nothing this variable can be removed.

Cc: clang-built-linux@googlegroups.com
Link: https://github.com/ClangBuiltLinux/linux/issues/532
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
---
 drivers/thermal/armada_thermal.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
index 8c07a393dc2e..709a22f455e9 100644
--- a/drivers/thermal/armada_thermal.c
+++ b/drivers/thermal/armada_thermal.c
@@ -53,7 +53,6 @@
 #define CONTROL0_TSEN_MODE_EXTERNAL	0x2
 #define CONTROL0_TSEN_MODE_MASK		0x3
 
-#define CONTROL1_TSEN_AVG_SHIFT		0
 #define CONTROL1_TSEN_AVG_MASK		0x7
 #define CONTROL1_EXT_TSEN_SW_RESET	BIT(7)
 #define CONTROL1_EXT_TSEN_HW_RESETn	BIT(8)
@@ -267,8 +266,8 @@ static void armada_cp110_init(struct platform_device *pdev,
 
 	/* Average the output value over 2^1 = 2 samples */
 	regmap_read(priv->syscon, data->syscon_control1_off, &reg);
-	reg &= ~CONTROL1_TSEN_AVG_MASK << CONTROL1_TSEN_AVG_SHIFT;
-	reg |= 1 << CONTROL1_TSEN_AVG_SHIFT;
+	reg &= ~CONTROL1_TSEN_AVG_MASK;
+	reg |= 1;
 	regmap_write(priv->syscon, data->syscon_control1_off, reg);
 }
 
-- 
2.22.0.rc2.383.gf4fbbf30c2-goog


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

* Re: [PATCH] thermal: armada: Fix -Wshift-negative-value
  2019-06-13 18:49 [PATCH] thermal: armada: Fix -Wshift-negative-value Nathan Huckleberry
@ 2019-06-14 10:11 ` Daniel Lezcano
  2019-08-13 17:28   ` Nathan Huckleberry
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Lezcano @ 2019-06-14 10:11 UTC (permalink / raw)
  To: Nathan Huckleberry, miquel.raynal, rui.zhang, edubezval
  Cc: linux-pm, linux-kernel, clang-built-linux

On 13/06/2019 20:49, Nathan Huckleberry wrote:
> Clang produces the following warning
> 
> drivers/thermal/armada_thermal.c:270:33: warning: shifting a negative
> signed value is undefined [-Wshift-negative-value]
> 1 warning        reg &= ~CONTROL1_TSEN_AVG_MASK <<
> CONTROL1_TSEN_AVG_SHIFT; generated
> .
>                ~~~~~~~~~~~~~~~~~~~~~~~ ^
> 
> CONTROL1_TSEN_AVG_SHIFT is defined to be zero.
> Since shifting by zero does nothing this variable can be removed.
> 
> Cc: clang-built-linux@googlegroups.com
> Link: https://github.com/ClangBuiltLinux/linux/issues/532
> Signed-off-by: Nathan Huckleberry <nhuck@google.com>

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>

> ---
>  drivers/thermal/armada_thermal.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
> index 8c07a393dc2e..709a22f455e9 100644
> --- a/drivers/thermal/armada_thermal.c
> +++ b/drivers/thermal/armada_thermal.c
> @@ -53,7 +53,6 @@
>  #define CONTROL0_TSEN_MODE_EXTERNAL	0x2
>  #define CONTROL0_TSEN_MODE_MASK		0x3
>  
> -#define CONTROL1_TSEN_AVG_SHIFT		0
>  #define CONTROL1_TSEN_AVG_MASK		0x7
>  #define CONTROL1_EXT_TSEN_SW_RESET	BIT(7)
>  #define CONTROL1_EXT_TSEN_HW_RESETn	BIT(8)
> @@ -267,8 +266,8 @@ static void armada_cp110_init(struct platform_device *pdev,
>  
>  	/* Average the output value over 2^1 = 2 samples */
>  	regmap_read(priv->syscon, data->syscon_control1_off, &reg);
> -	reg &= ~CONTROL1_TSEN_AVG_MASK << CONTROL1_TSEN_AVG_SHIFT;
> -	reg |= 1 << CONTROL1_TSEN_AVG_SHIFT;
> +	reg &= ~CONTROL1_TSEN_AVG_MASK;
> +	reg |= 1;
>  	regmap_write(priv->syscon, data->syscon_control1_off, reg);
>  }
>  
> 


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH] thermal: armada: Fix -Wshift-negative-value
  2019-06-14 10:11 ` Daniel Lezcano
@ 2019-08-13 17:28   ` Nathan Huckleberry
  2019-08-14 22:12     ` Nick Desaulniers
  0 siblings, 1 reply; 9+ messages in thread
From: Nathan Huckleberry @ 2019-08-13 17:28 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: miquel.raynal, rui.zhang, edubezval, linux-pm, linux-kernel,
	clang-built-linux

Following up to see if this patch is going to be accepted.

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

* Re: [PATCH] thermal: armada: Fix -Wshift-negative-value
  2019-08-13 17:28   ` Nathan Huckleberry
@ 2019-08-14 22:12     ` Nick Desaulniers
  2019-08-14 23:06       ` Daniel Lezcano
  0 siblings, 1 reply; 9+ messages in thread
From: Nick Desaulniers @ 2019-08-14 22:12 UTC (permalink / raw)
  To: Miquel Raynal, Daniel Lezcano, rui.zhang, edubezval
  Cc: linux-pm, LKML, clang-built-linux, Nathan Huckleberry

On Tue, Aug 13, 2019 at 10:28 AM 'Nathan Huckleberry' via Clang Built
Linux <clang-built-linux@googlegroups.com> wrote:
>
> Following up to see if this patch is going to be accepted.

Miquel is listed as the maintainer of this file in MAINTAINERS.
Miquel, can you please pick this up?  Otherwise Zhang, Eduardo, and
Daniel are listed as maintainers for drivers/thermal/.
-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] thermal: armada: Fix -Wshift-negative-value
  2019-08-14 22:12     ` Nick Desaulniers
@ 2019-08-14 23:06       ` Daniel Lezcano
  2019-08-19  8:21         ` Miquel Raynal
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Lezcano @ 2019-08-14 23:06 UTC (permalink / raw)
  To: Nick Desaulniers, Miquel Raynal, rui.zhang, edubezval
  Cc: linux-pm, LKML, clang-built-linux, Nathan Huckleberry

On 15/08/2019 00:12, Nick Desaulniers wrote:
> On Tue, Aug 13, 2019 at 10:28 AM 'Nathan Huckleberry' via Clang Built
> Linux <clang-built-linux@googlegroups.com> wrote:
>>
>> Following up to see if this patch is going to be accepted.
> 
> Miquel is listed as the maintainer of this file in MAINTAINERS.
> Miquel, can you please pick this up?  Otherwise Zhang, Eduardo, and
> Daniel are listed as maintainers for drivers/thermal/.

I'm listed as reviewer, it is up to Zhang or Eduardo to take the patches.


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH] thermal: armada: Fix -Wshift-negative-value
  2019-08-14 23:06       ` Daniel Lezcano
@ 2019-08-19  8:21         ` Miquel Raynal
  2019-08-28  8:53           ` Zhang Rui
  0 siblings, 1 reply; 9+ messages in thread
From: Miquel Raynal @ 2019-08-19  8:21 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Nick Desaulniers, rui.zhang, edubezval, linux-pm, LKML,
	clang-built-linux, Nathan Huckleberry

Hello,

Daniel Lezcano <daniel.lezcano@linaro.org> wrote on Thu, 15 Aug 2019
01:06:21 +0200:

> On 15/08/2019 00:12, Nick Desaulniers wrote:
> > On Tue, Aug 13, 2019 at 10:28 AM 'Nathan Huckleberry' via Clang Built
> > Linux <clang-built-linux@googlegroups.com> wrote:  
> >>
> >> Following up to see if this patch is going to be accepted.  
> > 
> > Miquel is listed as the maintainer of this file in MAINTAINERS.
> > Miquel, can you please pick this up?  Otherwise Zhang, Eduardo, and
> > Daniel are listed as maintainers for drivers/thermal/.  
> 
> I'm listed as reviewer, it is up to Zhang or Eduardo to take the patches.
> 
> 

Sorry for the delay, I don't manage a tree for this driver, I'll let
Zhang or Eduardo take the patch with my

Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>


Thanks,
Miquèl

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

* Re: [PATCH] thermal: armada: Fix -Wshift-negative-value
  2019-08-19  8:21         ` Miquel Raynal
@ 2019-08-28  8:53           ` Zhang Rui
  2019-08-28 18:49             ` Nick Desaulniers
  0 siblings, 1 reply; 9+ messages in thread
From: Zhang Rui @ 2019-08-28  8:53 UTC (permalink / raw)
  To: Miquel Raynal, Daniel Lezcano
  Cc: Nick Desaulniers, edubezval, linux-pm, LKML, clang-built-linux,
	Nathan Huckleberry

On Mon, 2019-08-19 at 10:21 +0200, Miquel Raynal wrote:
> Hello,
> 
> Daniel Lezcano <daniel.lezcano@linaro.org> wrote on Thu, 15 Aug 2019
> 01:06:21 +0200:
> 
> > On 15/08/2019 00:12, Nick Desaulniers wrote:
> > > On Tue, Aug 13, 2019 at 10:28 AM 'Nathan Huckleberry' via Clang
> > > Built
> > > Linux <clang-built-linux@googlegroups.com> wrote:  
> > > > 
> > > > Following up to see if this patch is going to be accepted.  
> > > 
> > > Miquel is listed as the maintainer of this file in MAINTAINERS.
> > > Miquel, can you please pick this up?  Otherwise Zhang, Eduardo,
> > > and
> > > Daniel are listed as maintainers for drivers/thermal/.  
> > 
> > I'm listed as reviewer, it is up to Zhang or Eduardo to take the
> > patches.
> > 
> > 
> 
> Sorry for the delay, I don't manage a tree for this driver, I'll let
> Zhang or Eduardo take the patch with my
> 
> Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
> 

Patch applied.

thanks,
rui
> 
> Thanks,
> Miquèl


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

* Re: [PATCH] thermal: armada: Fix -Wshift-negative-value
  2019-08-28  8:53           ` Zhang Rui
@ 2019-08-28 18:49             ` Nick Desaulniers
  2019-08-29  1:42               ` Zhang Rui
  0 siblings, 1 reply; 9+ messages in thread
From: Nick Desaulniers @ 2019-08-28 18:49 UTC (permalink / raw)
  To: Zhang Rui
  Cc: Miquel Raynal, Daniel Lezcano, edubezval, linux-pm, LKML,
	clang-built-linux, Nathan Huckleberry

On Wed, Aug 28, 2019 at 1:53 AM Zhang Rui <rui.zhang@intel.com> wrote:
>
> On Mon, 2019-08-19 at 10:21 +0200, Miquel Raynal wrote:
> > Hello,
> >
> > Daniel Lezcano <daniel.lezcano@linaro.org> wrote on Thu, 15 Aug 2019
> > 01:06:21 +0200:
> >
> > > On 15/08/2019 00:12, Nick Desaulniers wrote:
> > > > On Tue, Aug 13, 2019 at 10:28 AM 'Nathan Huckleberry' via Clang
> > > > Built
> > > > Linux <clang-built-linux@googlegroups.com> wrote:
> > > > >
> > > > > Following up to see if this patch is going to be accepted.
> > > >
> > > > Miquel is listed as the maintainer of this file in MAINTAINERS.
> > > > Miquel, can you please pick this up?  Otherwise Zhang, Eduardo,
> > > > and
> > > > Daniel are listed as maintainers for drivers/thermal/.
> > >
> > > I'm listed as reviewer, it is up to Zhang or Eduardo to take the
> > > patches.
> > >
> > >
> >
> > Sorry for the delay, I don't manage a tree for this driver, I'll let
> > Zhang or Eduardo take the patch with my
> >
> > Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
> >
>
> Patch applied.
>
> thanks,
> rui

Thanks Rui, did you push the branch?  I guess I would have expected it
in https://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git/log/?h=next?
I'm trying to track where this lands in
https://github.com/ClangBuiltLinux/linux/issues/532.

-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] thermal: armada: Fix -Wshift-negative-value
  2019-08-28 18:49             ` Nick Desaulniers
@ 2019-08-29  1:42               ` Zhang Rui
  0 siblings, 0 replies; 9+ messages in thread
From: Zhang Rui @ 2019-08-29  1:42 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Miquel Raynal, Daniel Lezcano, edubezval, linux-pm, LKML,
	clang-built-linux, Nathan Huckleberry

On Wed, 2019-08-28 at 11:49 -0700, Nick Desaulniers wrote:
> On Wed, Aug 28, 2019 at 1:53 AM Zhang Rui <rui.zhang@intel.com>
> wrote:
> > 
> > On Mon, 2019-08-19 at 10:21 +0200, Miquel Raynal wrote:
> > > Hello,
> > > 
> > > Daniel Lezcano <daniel.lezcano@linaro.org> wrote on Thu, 15 Aug
> > > 2019
> > > 01:06:21 +0200:
> > > 
> > > > On 15/08/2019 00:12, Nick Desaulniers wrote:
> > > > > On Tue, Aug 13, 2019 at 10:28 AM 'Nathan Huckleberry' via
> > > > > Clang
> > > > > Built
> > > > > Linux <clang-built-linux@googlegroups.com> wrote:
> > > > > > 
> > > > > > Following up to see if this patch is going to be accepted.
> > > > > 
> > > > > Miquel is listed as the maintainer of this file in
> > > > > MAINTAINERS.
> > > > > Miquel, can you please pick this up?  Otherwise Zhang,
> > > > > Eduardo,
> > > > > and
> > > > > Daniel are listed as maintainers for drivers/thermal/.
> > > > 
> > > > I'm listed as reviewer, it is up to Zhang or Eduardo to take
> > > > the
> > > > patches.
> > > > 
> > > > 
> > > 
> > > Sorry for the delay, I don't manage a tree for this driver, I'll
> > > let
> > > Zhang or Eduardo take the patch with my
> > > 
> > > Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > > 
> > 
> > Patch applied.
> > 
> > thanks,
> > rui
> 
> Thanks Rui, did you push the branch?  I guess I would have expected
> it
> in 
> https://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git/log/?h=next
> ?
> I'm trying to track where this lands in
> https://github.com/ClangBuiltLinux/linux/issues/532.

Not yet. I will push it to kernel.org after I finish my internal build
test.

thanks,
rui
> 


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

end of thread, other threads:[~2019-08-29  1:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-13 18:49 [PATCH] thermal: armada: Fix -Wshift-negative-value Nathan Huckleberry
2019-06-14 10:11 ` Daniel Lezcano
2019-08-13 17:28   ` Nathan Huckleberry
2019-08-14 22:12     ` Nick Desaulniers
2019-08-14 23:06       ` Daniel Lezcano
2019-08-19  8:21         ` Miquel Raynal
2019-08-28  8:53           ` Zhang Rui
2019-08-28 18:49             ` Nick Desaulniers
2019-08-29  1:42               ` Zhang Rui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).