* [PATCH v2 0/2] iio: adc: ad7380: fix sparse warnings
@ 2024-01-29 19:56 David Lechner
2024-01-29 19:56 ` [PATCH v2 1/2] iio: adc: ad7380: make ad7380_regmap_config static David Lechner
2024-01-29 19:56 ` [PATCH v2 2/2] iio: adc: ad7380: don't use bool in FIELD_PREP David Lechner
0 siblings, 2 replies; 4+ messages in thread
From: David Lechner @ 2024-01-29 19:56 UTC (permalink / raw)
To: Jonathan Cameron
Cc: David Lechner, Michael Hennerich, Nuno Sá, linux-iio,
linux-kernel
This fixes the sparse warnings reported in [1].
[1] https://lore.kernel.org/oe-kbuild-all/202401280629.5kknB57C-lkp@intel.com/
v2 changes:
* fix typo in "iio: adc: ad7380: don't use bool in FIELD_PREP"
David Lechner (2):
iio: adc: ad7380: make ad7380_regmap_config static
iio: adc: ad7380: don't use bool in FIELD_PREP
drivers/iio/adc/ad7380.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] iio: adc: ad7380: make ad7380_regmap_config static
2024-01-29 19:56 [PATCH v2 0/2] iio: adc: ad7380: fix sparse warnings David Lechner
@ 2024-01-29 19:56 ` David Lechner
2024-01-29 19:56 ` [PATCH v2 2/2] iio: adc: ad7380: don't use bool in FIELD_PREP David Lechner
1 sibling, 0 replies; 4+ messages in thread
From: David Lechner @ 2024-01-29 19:56 UTC (permalink / raw)
To: Jonathan Cameron
Cc: David Lechner, Michael Hennerich, Nuno Sá, linux-iio,
linux-kernel, kernel test robot
ad7380_regmap_config is not used outside of ad7380.c, so make it static.
Fixes sparse warning:
drivers/iio/adc/ad7380.c:205:28: sparse: sparse: symbol
'ad7380_regmap_config' was not declared. Should it be static?
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202401280629.5kknB57C-lkp@intel.com/
Signed-off-by: David Lechner <dlechner@baylibre.com>
---
drivers/iio/adc/ad7380.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c
index 80712aaa9548..44b8b18ab213 100644
--- a/drivers/iio/adc/ad7380.c
+++ b/drivers/iio/adc/ad7380.c
@@ -202,7 +202,7 @@ static int ad7380_regmap_reg_read(void *context, unsigned int reg,
return 0;
}
-const struct regmap_config ad7380_regmap_config = {
+static const struct regmap_config ad7380_regmap_config = {
.reg_bits = 3,
.val_bits = 12,
.reg_read = ad7380_regmap_reg_read,
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] iio: adc: ad7380: don't use bool in FIELD_PREP
2024-01-29 19:56 [PATCH v2 0/2] iio: adc: ad7380: fix sparse warnings David Lechner
2024-01-29 19:56 ` [PATCH v2 1/2] iio: adc: ad7380: make ad7380_regmap_config static David Lechner
@ 2024-01-29 19:56 ` David Lechner
2024-02-04 14:46 ` Jonathan Cameron
1 sibling, 1 reply; 4+ messages in thread
From: David Lechner @ 2024-01-29 19:56 UTC (permalink / raw)
To: Jonathan Cameron
Cc: David Lechner, Michael Hennerich, Nuno Sá, linux-iio,
linux-kernel, kernel test robot
Although this technically works, it is better to avoid using bool as
a bit value.
Fixes sparse warning:
drivers/iio/adc/ad7380.c:353:34: sparse: sparse: dubious: x & !y
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202401280629.5kknB57C-lkp@intel.com/
Signed-off-by: David Lechner <dlechner@baylibre.com>
---
v2 changes:
* use correct terinary operator syntax (had typo of : instead of ?)
drivers/iio/adc/ad7380.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c
index 44b8b18ab213..abd746aef868 100644
--- a/drivers/iio/adc/ad7380.c
+++ b/drivers/iio/adc/ad7380.c
@@ -350,7 +350,8 @@ static int ad7380_init(struct ad7380_state *st)
/* select internal or external reference voltage */
ret = regmap_update_bits(st->regmap, AD7380_REG_ADDR_CONFIG1,
AD7380_CONFIG1_REFSEL,
- FIELD_PREP(AD7380_CONFIG1_REFSEL, !!st->vref));
+ FIELD_PREP(AD7380_CONFIG1_REFSEL,
+ st->vref ? 1 : 0));
if (ret < 0)
return ret;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 2/2] iio: adc: ad7380: don't use bool in FIELD_PREP
2024-01-29 19:56 ` [PATCH v2 2/2] iio: adc: ad7380: don't use bool in FIELD_PREP David Lechner
@ 2024-02-04 14:46 ` Jonathan Cameron
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2024-02-04 14:46 UTC (permalink / raw)
To: David Lechner
Cc: Michael Hennerich, Nuno Sá, linux-iio, linux-kernel,
kernel test robot
On Mon, 29 Jan 2024 13:56:08 -0600
David Lechner <dlechner@baylibre.com> wrote:
> Although this technically works, it is better to avoid using bool as
> a bit value.
>
> Fixes sparse warning:
>
> drivers/iio/adc/ad7380.c:353:34: sparse: sparse: dubious: x & !y
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202401280629.5kknB57C-lkp@intel.com/
> Signed-off-by: David Lechner <dlechner@baylibre.com>
Applied.
> ---
>
> v2 changes:
> * use correct terinary operator syntax (had typo of : instead of ?)
>
> drivers/iio/adc/ad7380.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c
> index 44b8b18ab213..abd746aef868 100644
> --- a/drivers/iio/adc/ad7380.c
> +++ b/drivers/iio/adc/ad7380.c
> @@ -350,7 +350,8 @@ static int ad7380_init(struct ad7380_state *st)
> /* select internal or external reference voltage */
> ret = regmap_update_bits(st->regmap, AD7380_REG_ADDR_CONFIG1,
> AD7380_CONFIG1_REFSEL,
> - FIELD_PREP(AD7380_CONFIG1_REFSEL, !!st->vref));
> + FIELD_PREP(AD7380_CONFIG1_REFSEL,
> + st->vref ? 1 : 0));
> if (ret < 0)
> return ret;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-04 14:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-29 19:56 [PATCH v2 0/2] iio: adc: ad7380: fix sparse warnings David Lechner
2024-01-29 19:56 ` [PATCH v2 1/2] iio: adc: ad7380: make ad7380_regmap_config static David Lechner
2024-01-29 19:56 ` [PATCH v2 2/2] iio: adc: ad7380: don't use bool in FIELD_PREP David Lechner
2024-02-04 14:46 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox