* [PATCH] iio: health: max30100: drop unnecessary cast
@ 2026-03-14 22:33 David Lechner
2026-03-16 11:25 ` Andy Shevchenko
0 siblings, 1 reply; 4+ messages in thread
From: David Lechner @ 2026-03-14 22:33 UTC (permalink / raw)
To: Jonathan Cameron, Nuno Sá, Andy Shevchenko
Cc: linux-iio, linux-kernel, David Lechner
Drop an unnecessary cast in max30100_led_init().
val is defined as unsigned int val[2]; so the cast is not needed, nor
is the address-of operator &.
Also fix alignment with ( while we are touching this.
Signed-off-by: David Lechner <dlechner@baylibre.com>
---
drivers/iio/health/max30100.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/health/max30100.c b/drivers/iio/health/max30100.c
index 7dfdb5eb305e..00dca1c9425c 100644
--- a/drivers/iio/health/max30100.c
+++ b/drivers/iio/health/max30100.c
@@ -274,7 +274,7 @@ static int max30100_led_init(struct max30100_data *data)
int reg, ret;
ret = device_property_read_u32_array(dev, "maxim,led-current-microamp",
- (unsigned int *) &val, 2);
+ val, 2);
if (ret) {
/* Default to 24 mA RED LED, 50 mA IR LED */
reg = (MAX30100_REG_LED_CONFIG_24MA <<
---
base-commit: ff0843ceb1fb11a6b73e0e77b932ef7967aecd4b
change-id: 20260314-iio-health-max301000-drop-int-cast-f34f3493e0f7
Best regards,
--
David Lechner <dlechner@baylibre.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] iio: health: max30100: drop unnecessary cast
2026-03-14 22:33 [PATCH] iio: health: max30100: drop unnecessary cast David Lechner
@ 2026-03-16 11:25 ` Andy Shevchenko
2026-03-21 20:56 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2026-03-16 11:25 UTC (permalink / raw)
To: David Lechner
Cc: Jonathan Cameron, Nuno Sá, Andy Shevchenko, linux-iio, linux-kernel
On Sat, Mar 14, 2026 at 05:33:01PM -0500, David Lechner wrote:
> Drop an unnecessary cast in max30100_led_init().
>
> val is defined as unsigned int val[2]; so the cast is not needed, nor
> is the address-of operator &.
>
> Also fix alignment with ( while we are touching this.
> ret = device_property_read_u32_array(dev, "maxim,led-current-microamp",
> - (unsigned int *) &val, 2);
> + val, 2);
You want to have ARRAY_SIZE() as well.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: health: max30100: drop unnecessary cast
2026-03-16 11:25 ` Andy Shevchenko
@ 2026-03-21 20:56 ` Jonathan Cameron
2026-04-12 14:32 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2026-03-21 20:56 UTC (permalink / raw)
To: Andy Shevchenko
Cc: David Lechner, Nuno Sá, Andy Shevchenko, linux-iio, linux-kernel
On Mon, 16 Mar 2026 13:25:00 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> On Sat, Mar 14, 2026 at 05:33:01PM -0500, David Lechner wrote:
> > Drop an unnecessary cast in max30100_led_init().
> >
> > val is defined as unsigned int val[2]; so the cast is not needed, nor
> > is the address-of operator &.
> >
> > Also fix alignment with ( while we are touching this.
>
> > ret = device_property_read_u32_array(dev, "maxim,led-current-microamp",
> > - (unsigned int *) &val, 2);
> > + val, 2);
>
> You want to have ARRAY_SIZE() as well.
>
Should we make val a u32 val[2]?
Obviously we all know the unsigned int is that big, but in theory that might
not always be so...
This is the only place where it's passed as a pointer rather than value from
one of the elements I think.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: health: max30100: drop unnecessary cast
2026-03-21 20:56 ` Jonathan Cameron
@ 2026-04-12 14:32 ` Jonathan Cameron
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2026-04-12 14:32 UTC (permalink / raw)
To: Andy Shevchenko
Cc: David Lechner, Nuno Sá, Andy Shevchenko, linux-iio, linux-kernel
On Sat, 21 Mar 2026 20:56:46 +0000
Jonathan Cameron <jic23@kernel.org> wrote:
> On Mon, 16 Mar 2026 13:25:00 +0200
> Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
>
> > On Sat, Mar 14, 2026 at 05:33:01PM -0500, David Lechner wrote:
> > > Drop an unnecessary cast in max30100_led_init().
> > >
> > > val is defined as unsigned int val[2]; so the cast is not needed, nor
> > > is the address-of operator &.
> > >
> > > Also fix alignment with ( while we are touching this.
> >
> > > ret = device_property_read_u32_array(dev, "maxim,led-current-microamp",
> > > - (unsigned int *) &val, 2);
> > > + val, 2);
> >
> > You want to have ARRAY_SIZE() as well.
> >
> Should we make val a u32 val[2]?
>
> Obviously we all know the unsigned int is that big, but in theory that might
> not always be so...
>
> This is the only place where it's passed as a pointer rather than value from
> one of the elements I think.
>
David, this question is outstanding so I've marked it 'changes requested'
in patchwork.
Thanks,
Jonathan
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-12 14:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-14 22:33 [PATCH] iio: health: max30100: drop unnecessary cast David Lechner
2026-03-16 11:25 ` Andy Shevchenko
2026-03-21 20:56 ` Jonathan Cameron
2026-04-12 14:32 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®