All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH 0/4] iio: Drop use of %hhx and %hx format strings
@ 2021-05-17 12:55 Jonathan Cameron
  2021-05-17 12:55 ` [PATCH 1/4] iio: imu: inv_mpu6050: Drop use of %hhx format string Jonathan Cameron
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Jonathan Cameron @ 2021-05-17 12:55 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Nathan Chancellor

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Resent because for some reason this didn't reach the mailing list
(I'm not sure it reached anywhere at all!)

A wrong use of one of these in
https://lore.kernel.org/linux-iio/20210514135927.2926482-1-arnd@kernel.org/
included a reference from Nathan to a patch discouraging the use of
these strings in general:
https://lore.kernel.org/lkml/CAHk-=wgoxnmsj8GEVFJSvTwdnWm8wVJthefNk2n6+4TC=20e0Q@mail.gmail.com/

I did a quick grep and established we only have a few instances of these in
IIO anyway, so in the interests of avoiding those existing cases getting
cut and paste into new drivers, let's just clear them out now.

Cc: Nathan Chancellor <nathan@kernel.org>
Jonathan Cameron (4):
  iio: imu: inv_mpu6050: Drop use of %hhx format string.
  iio: light: si1133: Drop remaining uses of %hhx format string.
  iio: light: si1145: Drop use of %hhx format specifier.
  iio: chemical: sgp30: Drop use of %hx in format string.

 drivers/iio/chemical/sgp30.c               |  2 +-
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c |  5 ++---
 drivers/iio/light/si1133.c                 | 14 +++++++-------
 drivers/iio/light/si1145.c                 | 10 +++++-----
 4 files changed, 15 insertions(+), 16 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/4] iio: imu: inv_mpu6050: Drop use of %hhx format string.
  2021-05-17 12:55 [RESEND PATCH 0/4] iio: Drop use of %hhx and %hx format strings Jonathan Cameron
@ 2021-05-17 12:55 ` Jonathan Cameron
  2021-05-17 17:00   ` Nathan Chancellor
  2021-05-17 12:55 ` [PATCH 2/4] iio: light: si1133: Drop remaining uses " Jonathan Cameron
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Jonathan Cameron @ 2021-05-17 12:55 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Nathan Chancellor

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Since:
commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of
unnecessary %h[xudi] and %hh[xudi]")
use of these format strings has been discouraged.

Part of a series removing all uses from IIO in the interestings of
avoiding providing bad examples for people to copy.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Nathan Chancellor <nathan@kernel.org>
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 6244a07048df..3169d3153b83 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -1314,8 +1314,7 @@ static int inv_check_and_setup_chip(struct inv_mpu6050_state *st)
 		for (i = 0; i < INV_NUM_PARTS; ++i) {
 			if (regval == hw_info[i].whoami) {
 				dev_warn(regmap_get_device(st->map),
-					"whoami mismatch got %#02x (%s)"
-					"expected %#02hhx (%s)\n",
+					"whoami mismatch got %#02x (%s) expected %#02x (%s)\n",
 					regval, hw_info[i].name,
 					st->hw->whoami, st->hw->name);
 				break;
@@ -1323,7 +1322,7 @@ static int inv_check_and_setup_chip(struct inv_mpu6050_state *st)
 		}
 		if (i >= INV_NUM_PARTS) {
 			dev_err(regmap_get_device(st->map),
-				"invalid whoami %#02x expected %#02hhx (%s)\n",
+				"invalid whoami %#02x expected %#02x (%s)\n",
 				regval, st->hw->whoami, st->hw->name);
 			return -ENODEV;
 		}
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/4] iio: light: si1133: Drop remaining uses of %hhx format string.
  2021-05-17 12:55 [RESEND PATCH 0/4] iio: Drop use of %hhx and %hx format strings Jonathan Cameron
  2021-05-17 12:55 ` [PATCH 1/4] iio: imu: inv_mpu6050: Drop use of %hhx format string Jonathan Cameron
@ 2021-05-17 12:55 ` Jonathan Cameron
  2021-05-17 17:12   ` Nathan Chancellor
  2021-05-17 12:55 ` [PATCH 3/4] iio: light: si1145: Drop use of %hhx format specifier Jonathan Cameron
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Jonathan Cameron @ 2021-05-17 12:55 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Maxime Roussin-Bélanger, Nathan Chancellor

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Since:
commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of
unnecessary %h[xudi] and %hh[xudi]")
use of these format strings has been discouraged.

As there are not that many in IIO, this is part of an effort to clear
them out so we don't have any instances that might get coppied into
new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com>
Cc: Nathan Chancellor <nathan@kernel.org>
---
 drivers/iio/light/si1133.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c
index fd302480262b..0af36176907d 100644
--- a/drivers/iio/light/si1133.c
+++ b/drivers/iio/light/si1133.c
@@ -352,22 +352,22 @@ static int si1133_parse_response_err(struct device *dev, u32 resp, u8 cmd)
 
 	switch (resp) {
 	case SI1133_ERR_OUTPUT_BUFFER_OVERFLOW:
-		dev_warn(dev, "Output buffer overflow: %#02hhx\n", cmd);
+		dev_warn(dev, "Output buffer overflow: %#02x\n", cmd);
 		return -EOVERFLOW;
 	case SI1133_ERR_SATURATION_ADC_OR_OVERFLOW_ACCUMULATION:
-		dev_warn(dev, "Saturation of the ADC or overflow of accumulation: %#02hhx\n",
+		dev_warn(dev, "Saturation of the ADC or overflow of accumulation: %#02x\n",
 			 cmd);
 		return -EOVERFLOW;
 	case SI1133_ERR_INVALID_LOCATION_CMD:
 		dev_warn(dev,
-			 "Parameter access to an invalid location: %#02hhx\n",
+			 "Parameter access to an invalid location: %#02x\n",
 			 cmd);
 		return -EINVAL;
 	case SI1133_ERR_INVALID_CMD:
-		dev_warn(dev, "Invalid command %#02hhx\n", cmd);
+		dev_warn(dev, "Invalid command %#02x\n", cmd);
 		return -EINVAL;
 	default:
-		dev_warn(dev, "Unknown error %#02hhx\n", cmd);
+		dev_warn(dev, "Unknown error %#02x\n", cmd);
 		return -EINVAL;
 	}
 }
@@ -400,7 +400,7 @@ static int si1133_command(struct si1133_data *data, u8 cmd)
 
 	err = regmap_write(data->regmap, SI1133_REG_COMMAND, cmd);
 	if (err) {
-		dev_warn(dev, "Failed to write command %#02hhx, ret=%d\n", cmd,
+		dev_warn(dev, "Failed to write command %#02x, ret=%d\n", cmd,
 			 err);
 		goto out;
 	}
@@ -425,7 +425,7 @@ static int si1133_command(struct si1133_data *data, u8 cmd)
 					       SI1133_CMD_TIMEOUT_MS * 1000);
 		if (err) {
 			dev_warn(dev,
-				 "Failed to read command %#02hhx, ret=%d\n",
+				 "Failed to read command %#02x, ret=%d\n",
 				 cmd, err);
 			goto out;
 		}
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/4] iio: light: si1145: Drop use of %hhx format specifier.
  2021-05-17 12:55 [RESEND PATCH 0/4] iio: Drop use of %hhx and %hx format strings Jonathan Cameron
  2021-05-17 12:55 ` [PATCH 1/4] iio: imu: inv_mpu6050: Drop use of %hhx format string Jonathan Cameron
  2021-05-17 12:55 ` [PATCH 2/4] iio: light: si1133: Drop remaining uses " Jonathan Cameron
@ 2021-05-17 12:55 ` Jonathan Cameron
  2021-05-17 17:12   ` Nathan Chancellor
  2021-05-17 12:55 ` [PATCH 4/4] iio: chemical: sgp30: Drop use of %hx in format string Jonathan Cameron
  2021-05-22 18:20 ` [RESEND PATCH 0/4] iio: Drop use of %hhx and %hx format strings Jonathan Cameron
  4 siblings, 1 reply; 11+ messages in thread
From: Jonathan Cameron @ 2021-05-17 12:55 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Nathan Chancellor

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Since:
commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of
unnecessary %h[xudi] and %hh[xudi]")
use of these format strings has been discouraged.  As there are only
a few such instances in IIO, this is part of a series clearing them
out so they don't get copied into new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Nathan Chancellor <nathan@kernel.org>
---
 drivers/iio/light/si1145.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/light/si1145.c b/drivers/iio/light/si1145.c
index 3fb52402fcc3..a3c41ce9c156 100644
--- a/drivers/iio/light/si1145.c
+++ b/drivers/iio/light/si1145.c
@@ -271,7 +271,7 @@ static int si1145_command(struct si1145_data *data, u8 cmd)
 		if ((ret & ~SI1145_RSP_COUNTER_MASK) == 0) {
 			if (ret == data->rsp_seq) {
 				if (time_after(jiffies, stop_jiffies)) {
-					dev_warn(dev, "timeout on command %#02hhx\n",
+					dev_warn(dev, "timeout on command %#02x\n",
 						 cmd);
 					ret = -ETIMEDOUT;
 					break;
@@ -291,12 +291,12 @@ static int si1145_command(struct si1145_data *data, u8 cmd)
 			ret = -EIO;
 		} else {
 			if (ret == SI1145_RSP_INVALID_SETTING) {
-				dev_warn(dev, "INVALID_SETTING error on command %#02hhx\n",
+				dev_warn(dev, "INVALID_SETTING error on command %#02x\n",
 					 cmd);
 				ret = -EINVAL;
 			} else {
 				/* All overflows are treated identically */
-				dev_dbg(dev, "overflow, ret=%d, cmd=%#02hhx\n",
+				dev_dbg(dev, "overflow, ret=%d, cmd=%#02x\n",
 					ret, cmd);
 				ret = -EOVERFLOW;
 			}
@@ -1299,10 +1299,10 @@ static int si1145_probe(struct i2c_client *client,
 						SI1145_REG_SEQ_ID);
 	if (ret < 0)
 		return ret;
-	dev_info(&client->dev, "device ID part %#02hhx rev %#02hhx seq %#02hhx\n",
+	dev_info(&client->dev, "device ID part %#02x rev %#02x seq %#02x\n",
 			part_id, rev_id, seq_id);
 	if (part_id != data->part_info->part) {
-		dev_err(&client->dev, "part ID mismatch got %#02hhx, expected %#02x\n",
+		dev_err(&client->dev, "part ID mismatch got %#02x, expected %#02x\n",
 				part_id, data->part_info->part);
 		return -ENODEV;
 	}
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/4] iio: chemical: sgp30: Drop use of %hx in format string.
  2021-05-17 12:55 [RESEND PATCH 0/4] iio: Drop use of %hhx and %hx format strings Jonathan Cameron
                   ` (2 preceding siblings ...)
  2021-05-17 12:55 ` [PATCH 3/4] iio: light: si1145: Drop use of %hhx format specifier Jonathan Cameron
@ 2021-05-17 12:55 ` Jonathan Cameron
  2021-05-17 17:13   ` Nathan Chancellor
  2021-05-22 18:20 ` [RESEND PATCH 0/4] iio: Drop use of %hhx and %hx format strings Jonathan Cameron
  4 siblings, 1 reply; 11+ messages in thread
From: Jonathan Cameron @ 2021-05-17 12:55 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Nathan Chancellor, Andreas Brauchli

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Since:
commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of
unnecessary %h[xudi] and %hh[xudi]")
use of these format strings has been discouraged.

As there are only a few such uses in IIO, lets clear them all out and
avoid chance of them getting copied into new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Andreas Brauchli <andreas.brauchli@sensirion.com>
---
 drivers/iio/chemical/sgp30.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/chemical/sgp30.c b/drivers/iio/chemical/sgp30.c
index 1029c457be15..2343d444604d 100644
--- a/drivers/iio/chemical/sgp30.c
+++ b/drivers/iio/chemical/sgp30.c
@@ -425,7 +425,7 @@ static int sgp_check_compat(struct sgp_data *data,
 
 	product = SGP_VERS_PRODUCT(data);
 	if (product != product_id) {
-		dev_err(dev, "sensor reports a different product: 0x%04hx\n",
+		dev_err(dev, "sensor reports a different product: 0x%04x\n",
 			product);
 		return -ENODEV;
 	}
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/4] iio: imu: inv_mpu6050: Drop use of %hhx format string.
  2021-05-17 12:55 ` [PATCH 1/4] iio: imu: inv_mpu6050: Drop use of %hhx format string Jonathan Cameron
@ 2021-05-17 17:00   ` Nathan Chancellor
  0 siblings, 0 replies; 11+ messages in thread
From: Nathan Chancellor @ 2021-05-17 17:00 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio; +Cc: Jonathan Cameron

On 5/17/2021 5:55 AM, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Since:
> commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of
> unnecessary %h[xudi] and %hh[xudi]")
> use of these format strings has been discouraged.
> 
> Part of a series removing all uses from IIO in the interestings of
> avoiding providing bad examples for people to copy.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>   drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> index 6244a07048df..3169d3153b83 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> @@ -1314,8 +1314,7 @@ static int inv_check_and_setup_chip(struct inv_mpu6050_state *st)
>   		for (i = 0; i < INV_NUM_PARTS; ++i) {
>   			if (regval == hw_info[i].whoami) {
>   				dev_warn(regmap_get_device(st->map),
> -					"whoami mismatch got %#02x (%s)"
> -					"expected %#02hhx (%s)\n",
> +					"whoami mismatch got %#02x (%s) expected %#02x (%s)\n",
>   					regval, hw_info[i].name,
>   					st->hw->whoami, st->hw->name);
>   				break;
> @@ -1323,7 +1322,7 @@ static int inv_check_and_setup_chip(struct inv_mpu6050_state *st)
>   		}
>   		if (i >= INV_NUM_PARTS) {
>   			dev_err(regmap_get_device(st->map),
> -				"invalid whoami %#02x expected %#02hhx (%s)\n",
> +				"invalid whoami %#02x expected %#02x (%s)\n",
>   				regval, st->hw->whoami, st->hw->name);
>   			return -ENODEV;
>   		}
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/4] iio: light: si1133: Drop remaining uses of %hhx format string.
  2021-05-17 12:55 ` [PATCH 2/4] iio: light: si1133: Drop remaining uses " Jonathan Cameron
@ 2021-05-17 17:12   ` Nathan Chancellor
  0 siblings, 0 replies; 11+ messages in thread
From: Nathan Chancellor @ 2021-05-17 17:12 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio
  Cc: Jonathan Cameron, Maxime Roussin-Bélanger

On 5/17/2021 5:55 AM, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Since:
> commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of
> unnecessary %h[xudi] and %hh[xudi]")
> use of these format strings has been discouraged.
> 
> As there are not that many in IIO, this is part of an effort to clear
> them out so we don't have any instances that might get coppied into
> new drivers.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com>
> Cc: Nathan Chancellor <nathan@kernel.org>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>   drivers/iio/light/si1133.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c
> index fd302480262b..0af36176907d 100644
> --- a/drivers/iio/light/si1133.c
> +++ b/drivers/iio/light/si1133.c
> @@ -352,22 +352,22 @@ static int si1133_parse_response_err(struct device *dev, u32 resp, u8 cmd)
>   
>   	switch (resp) {
>   	case SI1133_ERR_OUTPUT_BUFFER_OVERFLOW:
> -		dev_warn(dev, "Output buffer overflow: %#02hhx\n", cmd);
> +		dev_warn(dev, "Output buffer overflow: %#02x\n", cmd);
>   		return -EOVERFLOW;
>   	case SI1133_ERR_SATURATION_ADC_OR_OVERFLOW_ACCUMULATION:
> -		dev_warn(dev, "Saturation of the ADC or overflow of accumulation: %#02hhx\n",
> +		dev_warn(dev, "Saturation of the ADC or overflow of accumulation: %#02x\n",
>   			 cmd);
>   		return -EOVERFLOW;
>   	case SI1133_ERR_INVALID_LOCATION_CMD:
>   		dev_warn(dev,
> -			 "Parameter access to an invalid location: %#02hhx\n",
> +			 "Parameter access to an invalid location: %#02x\n",
>   			 cmd);
>   		return -EINVAL;
>   	case SI1133_ERR_INVALID_CMD:
> -		dev_warn(dev, "Invalid command %#02hhx\n", cmd);
> +		dev_warn(dev, "Invalid command %#02x\n", cmd);
>   		return -EINVAL;
>   	default:
> -		dev_warn(dev, "Unknown error %#02hhx\n", cmd);
> +		dev_warn(dev, "Unknown error %#02x\n", cmd);
>   		return -EINVAL;
>   	}
>   }
> @@ -400,7 +400,7 @@ static int si1133_command(struct si1133_data *data, u8 cmd)
>   
>   	err = regmap_write(data->regmap, SI1133_REG_COMMAND, cmd);
>   	if (err) {
> -		dev_warn(dev, "Failed to write command %#02hhx, ret=%d\n", cmd,
> +		dev_warn(dev, "Failed to write command %#02x, ret=%d\n", cmd,
>   			 err);
>   		goto out;
>   	}
> @@ -425,7 +425,7 @@ static int si1133_command(struct si1133_data *data, u8 cmd)
>   					       SI1133_CMD_TIMEOUT_MS * 1000);
>   		if (err) {
>   			dev_warn(dev,
> -				 "Failed to read command %#02hhx, ret=%d\n",
> +				 "Failed to read command %#02x, ret=%d\n",
>   				 cmd, err);
>   			goto out;
>   		}
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/4] iio: light: si1145: Drop use of %hhx format specifier.
  2021-05-17 12:55 ` [PATCH 3/4] iio: light: si1145: Drop use of %hhx format specifier Jonathan Cameron
@ 2021-05-17 17:12   ` Nathan Chancellor
  0 siblings, 0 replies; 11+ messages in thread
From: Nathan Chancellor @ 2021-05-17 17:12 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio; +Cc: Jonathan Cameron

On 5/17/2021 5:55 AM, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Since:
> commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of
> unnecessary %h[xudi] and %hh[xudi]")
> use of these format strings has been discouraged.  As there are only
> a few such instances in IIO, this is part of a series clearing them
> out so they don't get copied into new drivers.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Nathan Chancellor <nathan@kernel.org>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>   drivers/iio/light/si1145.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/light/si1145.c b/drivers/iio/light/si1145.c
> index 3fb52402fcc3..a3c41ce9c156 100644
> --- a/drivers/iio/light/si1145.c
> +++ b/drivers/iio/light/si1145.c
> @@ -271,7 +271,7 @@ static int si1145_command(struct si1145_data *data, u8 cmd)
>   		if ((ret & ~SI1145_RSP_COUNTER_MASK) == 0) {
>   			if (ret == data->rsp_seq) {
>   				if (time_after(jiffies, stop_jiffies)) {
> -					dev_warn(dev, "timeout on command %#02hhx\n",
> +					dev_warn(dev, "timeout on command %#02x\n",
>   						 cmd);
>   					ret = -ETIMEDOUT;
>   					break;
> @@ -291,12 +291,12 @@ static int si1145_command(struct si1145_data *data, u8 cmd)
>   			ret = -EIO;
>   		} else {
>   			if (ret == SI1145_RSP_INVALID_SETTING) {
> -				dev_warn(dev, "INVALID_SETTING error on command %#02hhx\n",
> +				dev_warn(dev, "INVALID_SETTING error on command %#02x\n",
>   					 cmd);
>   				ret = -EINVAL;
>   			} else {
>   				/* All overflows are treated identically */
> -				dev_dbg(dev, "overflow, ret=%d, cmd=%#02hhx\n",
> +				dev_dbg(dev, "overflow, ret=%d, cmd=%#02x\n",
>   					ret, cmd);
>   				ret = -EOVERFLOW;
>   			}
> @@ -1299,10 +1299,10 @@ static int si1145_probe(struct i2c_client *client,
>   						SI1145_REG_SEQ_ID);
>   	if (ret < 0)
>   		return ret;
> -	dev_info(&client->dev, "device ID part %#02hhx rev %#02hhx seq %#02hhx\n",
> +	dev_info(&client->dev, "device ID part %#02x rev %#02x seq %#02x\n",
>   			part_id, rev_id, seq_id);
>   	if (part_id != data->part_info->part) {
> -		dev_err(&client->dev, "part ID mismatch got %#02hhx, expected %#02x\n",
> +		dev_err(&client->dev, "part ID mismatch got %#02x, expected %#02x\n",
>   				part_id, data->part_info->part);
>   		return -ENODEV;
>   	}
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/4] iio: chemical: sgp30: Drop use of %hx in format string.
  2021-05-17 12:55 ` [PATCH 4/4] iio: chemical: sgp30: Drop use of %hx in format string Jonathan Cameron
@ 2021-05-17 17:13   ` Nathan Chancellor
  0 siblings, 0 replies; 11+ messages in thread
From: Nathan Chancellor @ 2021-05-17 17:13 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio; +Cc: Jonathan Cameron, Andreas Brauchli

On 5/17/2021 5:55 AM, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Since:
> commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of
> unnecessary %h[xudi] and %hh[xudi]")
> use of these format strings has been discouraged.
> 
> As there are only a few such uses in IIO, lets clear them all out and
> avoid chance of them getting copied into new drivers.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Nathan Chancellor <nathan@kernel.org>
> Cc: Andreas Brauchli <andreas.brauchli@sensirion.com>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>   drivers/iio/chemical/sgp30.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/chemical/sgp30.c b/drivers/iio/chemical/sgp30.c
> index 1029c457be15..2343d444604d 100644
> --- a/drivers/iio/chemical/sgp30.c
> +++ b/drivers/iio/chemical/sgp30.c
> @@ -425,7 +425,7 @@ static int sgp_check_compat(struct sgp_data *data,
>   
>   	product = SGP_VERS_PRODUCT(data);
>   	if (product != product_id) {
> -		dev_err(dev, "sensor reports a different product: 0x%04hx\n",
> +		dev_err(dev, "sensor reports a different product: 0x%04x\n",
>   			product);
>   		return -ENODEV;
>   	}
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RESEND PATCH 0/4] iio: Drop use of %hhx and %hx format strings
  2021-05-17 12:55 [RESEND PATCH 0/4] iio: Drop use of %hhx and %hx format strings Jonathan Cameron
                   ` (3 preceding siblings ...)
  2021-05-17 12:55 ` [PATCH 4/4] iio: chemical: sgp30: Drop use of %hx in format string Jonathan Cameron
@ 2021-05-22 18:20 ` Jonathan Cameron
  2021-06-03 18:08   ` Jonathan Cameron
  4 siblings, 1 reply; 11+ messages in thread
From: Jonathan Cameron @ 2021-05-22 18:20 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Nathan Chancellor

On Mon, 17 May 2021 13:55:50 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Resent because for some reason this didn't reach the mailing list
> (I'm not sure it reached anywhere at all!)
> 
> A wrong use of one of these in
> https://lore.kernel.org/linux-iio/20210514135927.2926482-1-arnd@kernel.org/
> included a reference from Nathan to a patch discouraging the use of
> these strings in general:
> https://lore.kernel.org/lkml/CAHk-=wgoxnmsj8GEVFJSvTwdnWm8wVJthefNk2n6+4TC=20e0Q@mail.gmail.com/
> 
> I did a quick grep and established we only have a few instances of these in
> IIO anyway, so in the interests of avoiding those existing cases getting
> cut and paste into new drivers, let's just clear them out now.

Series applied to the togreg branch of iio.git and pushed out as testing to
let 0-day poke at it before I push it out for linux-next.

Thanks,

Jonathan

> 
> Cc: Nathan Chancellor <nathan@kernel.org>
> Jonathan Cameron (4):
>   iio: imu: inv_mpu6050: Drop use of %hhx format string.
>   iio: light: si1133: Drop remaining uses of %hhx format string.
>   iio: light: si1145: Drop use of %hhx format specifier.
>   iio: chemical: sgp30: Drop use of %hx in format string.
> 
>  drivers/iio/chemical/sgp30.c               |  2 +-
>  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c |  5 ++---
>  drivers/iio/light/si1133.c                 | 14 +++++++-------
>  drivers/iio/light/si1145.c                 | 10 +++++-----
>  4 files changed, 15 insertions(+), 16 deletions(-)
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RESEND PATCH 0/4] iio: Drop use of %hhx and %hx format strings
  2021-05-22 18:20 ` [RESEND PATCH 0/4] iio: Drop use of %hhx and %hx format strings Jonathan Cameron
@ 2021-06-03 18:08   ` Jonathan Cameron
  0 siblings, 0 replies; 11+ messages in thread
From: Jonathan Cameron @ 2021-06-03 18:08 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Nathan Chancellor

On Sat, 22 May 2021 19:20:31 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Mon, 17 May 2021 13:55:50 +0100
> Jonathan Cameron <jic23@kernel.org> wrote:
> 
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > Resent because for some reason this didn't reach the mailing list
> > (I'm not sure it reached anywhere at all!)
> > 
> > A wrong use of one of these in
> > https://lore.kernel.org/linux-iio/20210514135927.2926482-1-arnd@kernel.org/
> > included a reference from Nathan to a patch discouraging the use of
> > these strings in general:
> > https://lore.kernel.org/lkml/CAHk-=wgoxnmsj8GEVFJSvTwdnWm8wVJthefNk2n6+4TC=20e0Q@mail.gmail.com/
> > 
> > I did a quick grep and established we only have a few instances of these in
> > IIO anyway, so in the interests of avoiding those existing cases getting
> > cut and paste into new drivers, let's just clear them out now.  
> 
> Series applied to the togreg branch of iio.git and pushed out as testing to
> let 0-day poke at it before I push it out for linux-next.

And I dropped 3 of these, because as Joe Perches pointed out
%#02x is a very odd specifier to use as the length includes the 0x prefix
and thus might as well not be there at all.
Intention was almost certainly either
%#04x or 0x%02x  

I prefer the second one so have rerolled the first 3 of these to take that
approach. The 4th is unaffected so I have left it applied.

Thanks,

Jonathan

> 
> Thanks,
> 
> Jonathan
> 
> > 
> > Cc: Nathan Chancellor <nathan@kernel.org>
> > Jonathan Cameron (4):
> >   iio: imu: inv_mpu6050: Drop use of %hhx format string.
> >   iio: light: si1133: Drop remaining uses of %hhx format string.
> >   iio: light: si1145: Drop use of %hhx format specifier.
> >   iio: chemical: sgp30: Drop use of %hx in format string.
> > 
> >  drivers/iio/chemical/sgp30.c               |  2 +-
> >  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c |  5 ++---
> >  drivers/iio/light/si1133.c                 | 14 +++++++-------
> >  drivers/iio/light/si1145.c                 | 10 +++++-----
> >  4 files changed, 15 insertions(+), 16 deletions(-)
> >   
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-06-03 18:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17 12:55 [RESEND PATCH 0/4] iio: Drop use of %hhx and %hx format strings Jonathan Cameron
2021-05-17 12:55 ` [PATCH 1/4] iio: imu: inv_mpu6050: Drop use of %hhx format string Jonathan Cameron
2021-05-17 17:00   ` Nathan Chancellor
2021-05-17 12:55 ` [PATCH 2/4] iio: light: si1133: Drop remaining uses " Jonathan Cameron
2021-05-17 17:12   ` Nathan Chancellor
2021-05-17 12:55 ` [PATCH 3/4] iio: light: si1145: Drop use of %hhx format specifier Jonathan Cameron
2021-05-17 17:12   ` Nathan Chancellor
2021-05-17 12:55 ` [PATCH 4/4] iio: chemical: sgp30: Drop use of %hx in format string Jonathan Cameron
2021-05-17 17:13   ` Nathan Chancellor
2021-05-22 18:20 ` [RESEND PATCH 0/4] iio: Drop use of %hhx and %hx format strings Jonathan Cameron
2021-06-03 18:08   ` Jonathan Cameron

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.