* [PATCH] iio: tsl2772: remove unused prox_diode_mask variable
@ 2023-03-27 12:08 Tom Rix
2023-03-27 13:07 ` Andy Shevchenko
0 siblings, 1 reply; 4+ messages in thread
From: Tom Rix @ 2023-03-27 12:08 UTC (permalink / raw)
To: jic23, lars, nathan, ndesaulniers, andriy.shevchenko,
u.kleine-koenig
Cc: linux-iio, linux-kernel, llvm, Tom Rix
clang with W=1 reports
drivers/iio/light/tsl2772.c:576:24: error: variable
'prox_diode_mask' set but not used [-Werror,-Wunused-but-set-variable]
int i, ret, num_leds, prox_diode_mask;
^
This variable is not used so remove it.
Signed-off-by: Tom Rix <trix@redhat.com>
---
drivers/iio/light/tsl2772.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/iio/light/tsl2772.c b/drivers/iio/light/tsl2772.c
index ad50baa0202c..c090405c2358 100644
--- a/drivers/iio/light/tsl2772.c
+++ b/drivers/iio/light/tsl2772.c
@@ -573,7 +573,7 @@ static int tsl2772_read_prox_led_current(struct tsl2772_chip *chip)
static int tsl2772_read_prox_diodes(struct tsl2772_chip *chip)
{
struct device *dev = &chip->client->dev;
- int i, ret, num_leds, prox_diode_mask;
+ int i, ret, num_leds;
u32 leds[TSL2772_MAX_PROX_LEDS];
ret = device_property_count_u32(dev, "amstaos,proximity-diodes");
@@ -590,13 +590,8 @@ static int tsl2772_read_prox_diodes(struct tsl2772_chip *chip)
return ret;
}
- prox_diode_mask = 0;
for (i = 0; i < num_leds; i++) {
- if (leds[i] == 0)
- prox_diode_mask |= TSL2772_DIODE0;
- else if (leds[i] == 1)
- prox_diode_mask |= TSL2772_DIODE1;
- else {
+ if (leds[i] > 1) {
dev_err(dev, "Invalid value %d in amstaos,proximity-diodes.\n", leds[i]);
return -EINVAL;
}
--
2.27.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] iio: tsl2772: remove unused prox_diode_mask variable
2023-03-27 12:08 [PATCH] iio: tsl2772: remove unused prox_diode_mask variable Tom Rix
@ 2023-03-27 13:07 ` Andy Shevchenko
2023-04-01 14:20 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2023-03-27 13:07 UTC (permalink / raw)
To: Tom Rix
Cc: jic23, lars, nathan, ndesaulniers, u.kleine-koenig, linux-iio,
linux-kernel, llvm
On Mon, Mar 27, 2023 at 08:08:23AM -0400, Tom Rix wrote:
> clang with W=1 reports
> drivers/iio/light/tsl2772.c:576:24: error: variable
> 'prox_diode_mask' set but not used [-Werror,-Wunused-but-set-variable]
> int i, ret, num_leds, prox_diode_mask;
> ^
> This variable is not used so remove it.
While from the compilation point of view this is a correct fix, I think
we need to hear from the author (or interested stakeholders) about this
feature. Perhaps it should be enabled / fixed differently.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: tsl2772: remove unused prox_diode_mask variable
2023-03-27 13:07 ` Andy Shevchenko
@ 2023-04-01 14:20 ` Jonathan Cameron
2023-04-01 20:23 ` Brian Masney
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2023-04-01 14:20 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Tom Rix, lars, nathan, ndesaulniers, u.kleine-koenig, linux-iio,
linux-kernel, llvm, Chuhong Yuan, Brian Masney, Brian Masney
On Mon, 27 Mar 2023 16:07:48 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> On Mon, Mar 27, 2023 at 08:08:23AM -0400, Tom Rix wrote:
> > clang with W=1 reports
> > drivers/iio/light/tsl2772.c:576:24: error: variable
> > 'prox_diode_mask' set but not used [-Werror,-Wunused-but-set-variable]
> > int i, ret, num_leds, prox_diode_mask;
> > ^
> > This variable is not used so remove it.
>
> While from the compilation point of view this is a correct fix, I think
> we need to hear from the author (or interested stakeholders) about this
> feature. Perhaps it should be enabled / fixed differently.
>
Superficially it looks like this value should have been stored to
chip->settings.prox_diode
+CC people who might know...
Jonathan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: tsl2772: remove unused prox_diode_mask variable
2023-04-01 14:20 ` Jonathan Cameron
@ 2023-04-01 20:23 ` Brian Masney
0 siblings, 0 replies; 4+ messages in thread
From: Brian Masney @ 2023-04-01 20:23 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Andy Shevchenko, Tom Rix, lars, nathan, ndesaulniers,
u.kleine-koenig, linux-iio, linux-kernel, llvm, Chuhong Yuan,
Brian Masney
On Sat, Apr 01, 2023 at 03:20:28PM +0100, Jonathan Cameron wrote:
> On Mon, 27 Mar 2023 16:07:48 +0300
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
>
> > On Mon, Mar 27, 2023 at 08:08:23AM -0400, Tom Rix wrote:
> > > clang with W=1 reports
> > > drivers/iio/light/tsl2772.c:576:24: error: variable
> > > 'prox_diode_mask' set but not used [-Werror,-Wunused-but-set-variable]
> > > int i, ret, num_leds, prox_diode_mask;
> > > ^
> > > This variable is not used so remove it.
> >
> > While from the compilation point of view this is a correct fix, I think
> > we need to hear from the author (or interested stakeholders) about this
> > feature. Perhaps it should be enabled / fixed differently.
> >
>
> Superficially it looks like this value should have been stored to
> chip->settings.prox_diode
>
> +CC people who might know...
Jonathan is correct about the proper fix and is this is my mistake. We
should just need to add this to the bottom of that function:
chip->settings.prox_diode = prox_diode_mask;
Tom: I can fix this up next week, unless I hear from you otherwise that
you'll do it.
Brian
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-04-01 20:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-27 12:08 [PATCH] iio: tsl2772: remove unused prox_diode_mask variable Tom Rix
2023-03-27 13:07 ` Andy Shevchenko
2023-04-01 14:20 ` Jonathan Cameron
2023-04-01 20:23 ` Brian Masney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox