diff mbox series

[v3,1/3] iio: temperature: ltc2983: Don't hard code defined constants in messages

Message ID 20220210135522.26562-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State Superseded
Headers show
Series [v3,1/3] iio: temperature: ltc2983: Don't hard code defined constants in messages | expand

Commit Message

Andy Shevchenko Feb. 10, 2022, 1:55 p.m. UTC
In a couple of messages the constants, which have their definitions,
are hard coded into the message text. Unhardcode them.

While at it, add a trailing \n where it's currently missing.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
---
v3: added \n, used %u (Joe)
 drivers/iio/temperature/ltc2983.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Jonathan Cameron Feb. 13, 2022, 5:55 p.m. UTC | #1
On Thu, 10 Feb 2022 15:55:20 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> In a couple of messages the constants, which have their definitions,
> are hard coded into the message text. Unhardcode them.
> 
> While at it, add a trailing \n where it's currently missing.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Reviewed-by: Nuno Sá <nuno.sa@analog.com>

Mostly so I can remember what is going on with this patch,
Nuno is OoO and planning to test this series when he returns.

Given that I'll wait on Nuno's testing.

Thanks,

Jonathan

> ---
> v3: added \n, used %u (Joe)
>  drivers/iio/temperature/ltc2983.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/temperature/ltc2983.c b/drivers/iio/temperature/ltc2983.c
> index 301c3f13fb26..94d6dd4db47a 100644
> --- a/drivers/iio/temperature/ltc2983.c
> +++ b/drivers/iio/temperature/ltc2983.c
> @@ -409,8 +409,8 @@ static struct ltc2983_custom_sensor *__ltc2983_custom_sensor_new(
>  	new_custom->size = n_entries * n_size;
>  	/* check Steinhart size */
>  	if (is_steinhart && new_custom->size != LTC2983_CUSTOM_STEINHART_SIZE) {
> -		dev_err(dev, "Steinhart sensors size(%zu) must be 24",
> -							new_custom->size);
> +		dev_err(dev, "Steinhart sensors size(%zu) must be %u\n", new_custom->size,
> +			LTC2983_CUSTOM_STEINHART_SIZE);
>  		return ERR_PTR(-EINVAL);
>  	}
>  	/* Check space on the table. */
> @@ -1299,8 +1299,8 @@ static int ltc2983_parse_dt(struct ltc2983_data *st)
>  		if (sensor.chan < LTC2983_MIN_CHANNELS_NR ||
>  		    sensor.chan > LTC2983_MAX_CHANNELS_NR) {
>  			ret = -EINVAL;
> -			dev_err(dev,
> -				"chan:%d must be from 1 to 20\n", sensor.chan);
> +			dev_err(dev, "chan:%d must be from %u to %u\n", sensor.chan,
> +				LTC2983_MIN_CHANNELS_NR, LTC2983_MAX_CHANNELS_NR);
>  			goto put_child;
>  		} else if (channel_avail_mask & BIT(sensor.chan)) {
>  			ret = -EINVAL;
Andy Shevchenko Feb. 14, 2022, 9:23 a.m. UTC | #2
On Sun, Feb 13, 2022 at 05:55:59PM +0000, Jonathan Cameron wrote:
> On Thu, 10 Feb 2022 15:55:20 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > In a couple of messages the constants, which have their definitions,
> > are hard coded into the message text. Unhardcode them.
> > 
> > While at it, add a trailing \n where it's currently missing.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Reviewed-by: Nuno Sá <nuno.sa@analog.com>
> 
> Mostly so I can remember what is going on with this patch,
> Nuno is OoO and planning to test this series when he returns.
> 
> Given that I'll wait on Nuno's testing.

Me too :-)
Andy Shevchenko March 2, 2022, 3:50 p.m. UTC | #3
On Sun, Feb 13, 2022 at 05:55:59PM +0000, Jonathan Cameron wrote:
> On Thu, 10 Feb 2022 15:55:20 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > In a couple of messages the constants, which have their definitions,
> > are hard coded into the message text. Unhardcode them.
> > 
> > While at it, add a trailing \n where it's currently missing.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Reviewed-by: Nuno Sá <nuno.sa@analog.com>
> 
> Mostly so I can remember what is going on with this patch,
> Nuno is OoO and planning to test this series when he returns.
> 
> Given that I'll wait on Nuno's testing.

Any news?
Nuno Sá March 2, 2022, 7:56 p.m. UTC | #4
On Wed, 2022-03-02 at 17:50 +0200, Andy Shevchenko wrote:
> On Sun, Feb 13, 2022 at 05:55:59PM +0000, Jonathan Cameron wrote:
> > On Thu, 10 Feb 2022 15:55:20 +0200
> > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> > 
> > > In a couple of messages the constants, which have their
> > > definitions,
> > > are hard coded into the message text. Unhardcode them.
> > > 
> > > While at it, add a trailing \n where it's currently missing.
> > > 
> > > Signed-off-by: Andy Shevchenko
> > > <andriy.shevchenko@linux.intel.com>
> > > Reviewed-by: Nuno Sá <nuno.sa@analog.com>
> > 
> > Mostly so I can remember what is going on with this patch,
> > Nuno is OoO and planning to test this series when he returns.
> > 
> > Given that I'll wait on Nuno's testing.
> 
> Any news?
> 
Started to prepare things by the end of the day. Should be tested by
tomorrow.

- Nuno Sá
diff mbox series

Patch

diff --git a/drivers/iio/temperature/ltc2983.c b/drivers/iio/temperature/ltc2983.c
index 301c3f13fb26..94d6dd4db47a 100644
--- a/drivers/iio/temperature/ltc2983.c
+++ b/drivers/iio/temperature/ltc2983.c
@@ -409,8 +409,8 @@  static struct ltc2983_custom_sensor *__ltc2983_custom_sensor_new(
 	new_custom->size = n_entries * n_size;
 	/* check Steinhart size */
 	if (is_steinhart && new_custom->size != LTC2983_CUSTOM_STEINHART_SIZE) {
-		dev_err(dev, "Steinhart sensors size(%zu) must be 24",
-							new_custom->size);
+		dev_err(dev, "Steinhart sensors size(%zu) must be %u\n", new_custom->size,
+			LTC2983_CUSTOM_STEINHART_SIZE);
 		return ERR_PTR(-EINVAL);
 	}
 	/* Check space on the table. */
@@ -1299,8 +1299,8 @@  static int ltc2983_parse_dt(struct ltc2983_data *st)
 		if (sensor.chan < LTC2983_MIN_CHANNELS_NR ||
 		    sensor.chan > LTC2983_MAX_CHANNELS_NR) {
 			ret = -EINVAL;
-			dev_err(dev,
-				"chan:%d must be from 1 to 20\n", sensor.chan);
+			dev_err(dev, "chan:%d must be from %u to %u\n", sensor.chan,
+				LTC2983_MIN_CHANNELS_NR, LTC2983_MAX_CHANNELS_NR);
 			goto put_child;
 		} else if (channel_avail_mask & BIT(sensor.chan)) {
 			ret = -EINVAL;