diff mbox series

[v2,2/4] iio: light: si1133: Drop remaining uses of %hhx format string.

Message ID 20210603180612.3635250-3-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.

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

Comments

Nathan Chancellor June 9, 2021, 3:27 p.m. UTC | #1
On Thu, Jun 03, 2021 at 07:06:10PM +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.
> 
> 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 copied 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 0accea7090ee..f8c9b2cc322e 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: 0x%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: 0x%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: 0x%02x\n",
>  			 cmd);
>  		return -EINVAL;
>  	case SI1133_ERR_INVALID_CMD:
> -		dev_warn(dev, "Invalid command %#02hhx\n", cmd);
> +		dev_warn(dev, "Invalid command 0x%02x\n", cmd);
>  		return -EINVAL;
>  	default:
> -		dev_warn(dev, "Unknown error %#02hhx\n", cmd);
> +		dev_warn(dev, "Unknown error 0x%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 0x%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 0x%02x, ret=%d\n",
>  				 cmd, err);
>  			goto out;
>  		}
> -- 
> 2.31.1
diff mbox series

Patch

diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c
index 0accea7090ee..f8c9b2cc322e 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: 0x%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: 0x%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: 0x%02x\n",
 			 cmd);
 		return -EINVAL;
 	case SI1133_ERR_INVALID_CMD:
-		dev_warn(dev, "Invalid command %#02hhx\n", cmd);
+		dev_warn(dev, "Invalid command 0x%02x\n", cmd);
 		return -EINVAL;
 	default:
-		dev_warn(dev, "Unknown error %#02hhx\n", cmd);
+		dev_warn(dev, "Unknown error 0x%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 0x%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 0x%02x, ret=%d\n",
 				 cmd, err);
 			goto out;
 		}