Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: remove unneeded assignment in __iio_format_value
@ 2024-07-30  9:43 Matteo Martelli
  2024-08-03 15:53 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Matteo Martelli @ 2024-07-30  9:43 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen
  Cc: linux-iio, linux-kernel, Matteo Martelli

Trivial cleanup in __iio_format_value() for the IIO_VAL_FRACTIONAL case
where tmp1 = vals[1] assignment is unneeded and irrelevant since tmp1 is
immediately overwritten by the subsequent div_s64_rem() call.

Signed-off-by: Matteo Martelli <matteomartelli3@gmail.com>
---
 drivers/iio/industrialio-core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 0f6cda7ffe45..9e364f9879ef 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -667,7 +667,6 @@ static ssize_t __iio_format_value(char *buf, size_t offset, unsigned int type,
 					     vals[1]);
 	case IIO_VAL_FRACTIONAL:
 		tmp2 = div_s64((s64)vals[0] * 1000000000LL, vals[1]);
-		tmp1 = vals[1];
 		tmp0 = (int)div_s64_rem(tmp2, 1000000000, &tmp1);
 		if ((tmp2 < 0) && (tmp0 == 0))
 			return sysfs_emit_at(buf, offset, "-0.%09u", abs(tmp1));

---
base-commit: 1ebab783647a9e3bf357002d5c4ff060c8474a0a
change-id: 20240730-iio-clean-fmt-value-9c5a42d4fa24

Best regards,
-- 
Matteo Martelli <matteomartelli3@gmail.com>


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

* Re: [PATCH] iio: remove unneeded assignment in __iio_format_value
  2024-07-30  9:43 [PATCH] iio: remove unneeded assignment in __iio_format_value Matteo Martelli
@ 2024-08-03 15:53 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2024-08-03 15:53 UTC (permalink / raw)
  To: Matteo Martelli, linux-iio

On Tue, 30 Jul 2024 11:43:49 +0200
Matteo Martelli <matteomartelli3@gmail.com> wrote:

> Trivial cleanup in __iio_format_value() for the IIO_VAL_FRACTIONAL case
> where tmp1 = vals[1] assignment is unneeded and irrelevant since tmp1 is
> immediately overwritten by the subsequent div_s64_rem() call.
> 
> Signed-off-by: Matteo Martelli <matteomartelli3@gmail.com>
> Link: https://patch.msgid.link/20240730-iio-clean-fmt-value-v1-1-3e1c3deafc33@gmail.com
Applied.
> ---
>  drivers/iio/industrialio-core.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index 0f6cda7ffe45..9e364f9879ef 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -667,7 +667,6 @@ static ssize_t __iio_format_value(char *buf, size_t offset, unsigned int type,
>  					     vals[1]);
>  	case IIO_VAL_FRACTIONAL:
>  		tmp2 = div_s64((s64)vals[0] * 1000000000LL, vals[1]);
> -		tmp1 = vals[1];
>  		tmp0 = (int)div_s64_rem(tmp2, 1000000000, &tmp1);
>  		if ((tmp2 < 0) && (tmp0 == 0))
>  			return sysfs_emit_at(buf, offset, "-0.%09u", abs(tmp1));
> 
> ---
> base-commit: 1ebab783647a9e3bf357002d5c4ff060c8474a0a
> change-id: 20240730-iio-clean-fmt-value-9c5a42d4fa24
> 
> Best regards,


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

end of thread, other threads:[~2024-08-03 15:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-30  9:43 [PATCH] iio: remove unneeded assignment in __iio_format_value Matteo Martelli
2024-08-03 15:53 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox