diff mbox series

[v5,07/14] iio: magnetometer: yas530: Move printk %*ph parameters out from stack

Message ID 0f80659d4a5865a267cf75eaf14a23b8319ddb92.1659909060.git.jahau@rocketmail.com (mailing list archive)
State Superseded
Headers show
Series Add support for magnetometer Yamaha YAS537 | expand

Commit Message

Jakob Hauser Aug. 7, 2022, 11:06 p.m. UTC
Use less stack by modifying %*ph parameters.

Additionally, in the function yas530_get_calibration_data(), the debug dump was
extended to 16 elements as this is the size of the calibration data array of
YAS530.

Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/iio/magnetometer/yamaha-yas530.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andy Shevchenko Aug. 8, 2022, 11:10 a.m. UTC | #1
On Mon, Aug 8, 2022 at 1:07 AM Jakob Hauser <jahau@rocketmail.com> wrote:
>
> Use less stack by modifying %*ph parameters.
>
> Additionally, in the function yas530_get_calibration_data(), the debug dump was

Additionally --> While at it

(The difference is that "additionally" means you need to split to two
changes, which makes a little sense in this case)

> extended to 16 elements as this is the size of the calibration data array of
> YAS530.

Otherwise looks good,
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---
>  drivers/iio/magnetometer/yamaha-yas530.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/magnetometer/yamaha-yas530.c b/drivers/iio/magnetometer/yamaha-yas530.c
> index b27cc2b432ee..48995176fa39 100644
> --- a/drivers/iio/magnetometer/yamaha-yas530.c
> +++ b/drivers/iio/magnetometer/yamaha-yas530.c
> @@ -664,7 +664,7 @@ static int yas530_get_calibration_data(struct yas5xx *yas5xx)
>         ret = regmap_bulk_read(yas5xx->map, YAS530_CAL, data, sizeof(data));
>         if (ret)
>                 return ret;
> -       dev_dbg(yas5xx->dev, "calibration data: %*ph\n", 14, data);
> +       dev_dbg(yas5xx->dev, "calibration data: %16ph\n", data);
>
>         add_device_randomness(data, sizeof(data));
>         yas5xx->version = data[15] & GENMASK(1, 0);
> @@ -711,7 +711,7 @@ static int yas532_get_calibration_data(struct yas5xx *yas5xx)
>         ret = regmap_bulk_read(yas5xx->map, YAS530_CAL, data, sizeof(data));
>         if (ret)
>                 return ret;
> -       dev_dbg(yas5xx->dev, "calibration data: %*ph\n", 14, data);
> +       dev_dbg(yas5xx->dev, "calibration data: %14ph\n", data);
>
>         /* Sanity check, is this all zeroes? */
>         if (memchr_inv(data, 0x00, 13) == NULL) {
Jakob Hauser Aug. 9, 2022, 11:24 p.m. UTC | #2
Hi Andy,

On 08.08.22 13:10, Andy Shevchenko wrote:
> On Mon, Aug 8, 2022 at 1:07 AM Jakob Hauser <jahau@rocketmail.com> wrote:
>>
>> Use less stack by modifying %*ph parameters.
>>
>> Additionally, in the function yas530_get_calibration_data(), the debug dump was
> 
> Additionally --> While at it
> 
> (The difference is that "additionally" means you need to split to two
> changes, which makes a little sense in this case)

OK

>> extended to 16 elements as this is the size of the calibration data array of
>> YAS530.

...

Kind regards,
Jakob
diff mbox series

Patch

diff --git a/drivers/iio/magnetometer/yamaha-yas530.c b/drivers/iio/magnetometer/yamaha-yas530.c
index b27cc2b432ee..48995176fa39 100644
--- a/drivers/iio/magnetometer/yamaha-yas530.c
+++ b/drivers/iio/magnetometer/yamaha-yas530.c
@@ -664,7 +664,7 @@  static int yas530_get_calibration_data(struct yas5xx *yas5xx)
 	ret = regmap_bulk_read(yas5xx->map, YAS530_CAL, data, sizeof(data));
 	if (ret)
 		return ret;
-	dev_dbg(yas5xx->dev, "calibration data: %*ph\n", 14, data);
+	dev_dbg(yas5xx->dev, "calibration data: %16ph\n", data);
 
 	add_device_randomness(data, sizeof(data));
 	yas5xx->version = data[15] & GENMASK(1, 0);
@@ -711,7 +711,7 @@  static int yas532_get_calibration_data(struct yas5xx *yas5xx)
 	ret = regmap_bulk_read(yas5xx->map, YAS530_CAL, data, sizeof(data));
 	if (ret)
 		return ret;
-	dev_dbg(yas5xx->dev, "calibration data: %*ph\n", 14, data);
+	dev_dbg(yas5xx->dev, "calibration data: %14ph\n", data);
 
 	/* Sanity check, is this all zeroes? */
 	if (memchr_inv(data, 0x00, 13) == NULL) {