linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pwm: raspberrypi-poe: Fix endianess in firmware struct
@ 2022-04-08 15:38 Uwe Kleine-König
  2022-04-22 16:51 ` Thierry Reding
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2022-04-08 15:38 UTC (permalink / raw)
  To: Thierry Reding, Lee Jones, Nicolas Saenz Julienne; +Cc: linux-pwm, kernel

The reg member of struct raspberrypi_pwm_prop is a little endian 32 bit
quantity. Explicitly convert the (native endian) value to little endian
on assignment as is already done in raspberrypi_pwm_set_property().

This fixes the following sparse warning:

	drivers/pwm/pwm-raspberrypi-poe.c:69:24: warning: incorrect type in initializer (different base types)
	drivers/pwm/pwm-raspberrypi-poe.c:69:24:    expected restricted __le32 [usertype] reg
	drivers/pwm/pwm-raspberrypi-poe.c:69:24:    got unsigned int [usertype] reg

Fixes: 79caa362eab6 ("pwm: Add Raspberry Pi Firmware based PWM bus")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-raspberrypi-poe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-raspberrypi-poe.c b/drivers/pwm/pwm-raspberrypi-poe.c
index e52e29fc8231..6ff73029f367 100644
--- a/drivers/pwm/pwm-raspberrypi-poe.c
+++ b/drivers/pwm/pwm-raspberrypi-poe.c
@@ -66,7 +66,7 @@ static int raspberrypi_pwm_get_property(struct rpi_firmware *firmware,
 					u32 reg, u32 *val)
 {
 	struct raspberrypi_pwm_prop msg = {
-		.reg = reg
+		.reg = cpu_to_le32(reg),
 	};
 	int ret;
 

base-commit: 3123109284176b1532874591f7c81f3837bbdc17
-- 
2.35.1


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

* Re: [PATCH] pwm: raspberrypi-poe: Fix endianess in firmware struct
  2022-04-08 15:38 [PATCH] pwm: raspberrypi-poe: Fix endianess in firmware struct Uwe Kleine-König
@ 2022-04-22 16:51 ` Thierry Reding
  0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2022-04-22 16:51 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Lee Jones, Nicolas Saenz Julienne, linux-pwm, kernel

[-- Attachment #1: Type: text/plain, Size: 896 bytes --]

On Fri, Apr 08, 2022 at 05:38:46PM +0200, Uwe Kleine-König wrote:
> The reg member of struct raspberrypi_pwm_prop is a little endian 32 bit
> quantity. Explicitly convert the (native endian) value to little endian
> on assignment as is already done in raspberrypi_pwm_set_property().
> 
> This fixes the following sparse warning:
> 
> 	drivers/pwm/pwm-raspberrypi-poe.c:69:24: warning: incorrect type in initializer (different base types)
> 	drivers/pwm/pwm-raspberrypi-poe.c:69:24:    expected restricted __le32 [usertype] reg
> 	drivers/pwm/pwm-raspberrypi-poe.c:69:24:    got unsigned int [usertype] reg
> 
> Fixes: 79caa362eab6 ("pwm: Add Raspberry Pi Firmware based PWM bus")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/pwm/pwm-raspberrypi-poe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2022-04-22 16:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-08 15:38 [PATCH] pwm: raspberrypi-poe: Fix endianess in firmware struct Uwe Kleine-König
2022-04-22 16:51 ` Thierry Reding

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).