All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Crofts <joshua.crofts1@gmail.com>
To: David Lechner <dlechner@baylibre.com>
Cc: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com>,
	jic23@kernel.org, nuno.sa@analog.com, andy@kernel.org,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Giorgi Tchankvetadze <giorgi@tchankvetadze.com>
Subject: Re: [PATCH] iio: light: veml3328: remove redundant cast in read_avail
Date: Mon, 27 Jul 2026 17:28:12 +0200	[thread overview]
Message-ID: <20260727172812.00004210@gmail.com> (raw)
In-Reply-To: <90018da7-8d84-4bfd-b2e1-f832ca03f764@baylibre.com>

On Mon, 27 Jul 2026 08:15:59 -0500
David Lechner <dlechner@baylibre.com> wrote:

> On 7/27/26 6:27 AM, Giorgi Tchankvetadze wrote:
> > From: Giorgi Tchankvetadze <giorgi@tchankvetadze.com>
> > 
> > veml3328_scale_vals is declared as a const int array, so
> > veml3328_scale_vals[it_inx] already decays to const int *,
> > matching the type of *vals. The explicit (const int *) cast
> > is therefore redundant and can be dropped.
> > 
> > No functional change.
> > 
> > Signed-off-by: Giorgi Tchankvetadze <giorgi@tchankvetadze.com>
> > ---
> >  drivers/iio/light/veml3328.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/light/veml3328.c b/drivers/iio/light/veml3328.c
> > index 7ff1753925c4..a3c49beee93a 100644
> > --- a/drivers/iio/light/veml3328.c
> > +++ b/drivers/iio/light/veml3328.c
> > @@ -228,7 +228,7 @@ static int veml3328_read_avail(struct iio_dev *indio_dev,
> >  			return -EINVAL;
> >  
> >  		*length = 8;
> > -		*vals = (const int *)veml3328_scale_vals[it_inx];
> > +		*vals = veml3328_scale_vals[it_inx];
> >  		*type = IIO_VAL_INT_PLUS_MICRO;
> >  		return IIO_AVAIL_LIST;
> >  	}  
> 
> We'll see if there are other opinions (before sending a v2)...
> 
> Usually, we would declare the array like:
> 
> static const int veml3328_scale_vals[4][4][2] ...
> 
> in which case this cast would be needed.
> 

I don't really see a reason to do this... but up to Giorgi
to send a new patch or stick with the cast removal, I'm
indifferent.


-- 
Kind regards,
Joshua Crofts

      parent reply	other threads:[~2026-07-27 15:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27 11:27 [PATCH] iio: light: veml3328: remove redundant cast in read_avail Giorgi Tchankvetadze
2026-07-27 13:15 ` David Lechner
2026-07-27 13:50   ` Giorgi Tchankvetadze
2026-07-27 15:28   ` Joshua Crofts [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260727172812.00004210@gmail.com \
    --to=joshua.crofts1@gmail.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=giorgi@tchankvetadze.com \
    --cc=giorgitchankvetadze1997@gmail.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.