diff mbox series

[v2,3/4] iio: imu: inv_mpu6050: Drop use of %hhx format string.

Message ID 20210603180612.3635250-4-jic23@kernel.org (mailing list archive)
State Accepted, archived
Headers show
Series iio: Drop use of %hhx and %hx format strings | expand

Commit Message

Jonathan Cameron June 3, 2021, 6:06 p.m. UTC
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.

Use the 0x02x form as the length specifier when used with # includes
the 0x prefix and is very unlikely to be what was intended by the author.

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(-)

Comments

Nathan Chancellor June 9, 2021, 3:28 p.m. UTC | #1
On Thu, Jun 03, 2021 at 07:06:11PM +0100, 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.
> 
> Use the 0x02x form as the length specifier when used with # includes
> the 0x prefix and is very unlikely to be what was intended by the author.
> 
> 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 64704b55f6eb..b7254d9e0fe2 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 0x%02x (%s) expected 0x%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 0x%02x expected 0x%02x (%s)\n",
>  				regval, st->hw->whoami, st->hw->name);
>  			return -ENODEV;
>  		}
> -- 
> 2.31.1
diff mbox series

Patch

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 64704b55f6eb..b7254d9e0fe2 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 0x%02x (%s) expected 0x%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 0x%02x expected 0x%02x (%s)\n",
 				regval, st->hw->whoami, st->hw->name);
 			return -ENODEV;
 		}