* [PATCH v3] w1: w1_therm: use swap() to make code cleaner
@ 2021-12-21 0:15 davidcomponentone
2021-12-21 8:32 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: davidcomponentone @ 2021-12-21 0:15 UTC (permalink / raw)
To: zbr
Cc: davidcomponentone, gregkh, yangyingliang, ivan.zaentsev,
yang.guang5, dan.carpenter, unixbhaskar, linux-kernel, Zeal Robot
From: Yang Guang <yang.guang5@zte.com.cn>
Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
opencoding it.
---
Changes from v1->v2:
- Delete the curly {} braces.
Changes from v2->v3::
- Add --- line before version info.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: David Yang <davidcomponentone@gmail.com>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
---
drivers/w1/slaves/w1_therm.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index ca70c5f03206..565578002d79 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -1785,7 +1785,7 @@ static ssize_t alarms_store(struct device *device,
u8 new_config_register[3]; /* array of data to be written */
int temp, ret;
char *token = NULL;
- s8 tl, th, tt; /* 1 byte per value + temp ring order */
+ s8 tl, th; /* 1 byte per value + temp ring order */
char *p_args, *orig;
p_args = orig = kmalloc(size, GFP_KERNEL);
@@ -1836,9 +1836,8 @@ static ssize_t alarms_store(struct device *device,
th = int_to_short(temp);
/* Reorder if required th and tl */
- if (tl > th) {
- tt = tl; tl = th; th = tt;
- }
+ if (tl > th)
+ swap(tl, th);
/*
* Read the scratchpad to change only the required bits
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v3] w1: w1_therm: use swap() to make code cleaner
2021-12-21 0:15 [PATCH v3] w1: w1_therm: use swap() to make code cleaner davidcomponentone
@ 2021-12-21 8:32 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2021-12-21 8:32 UTC (permalink / raw)
To: davidcomponentone
Cc: zbr, yangyingliang, ivan.zaentsev, yang.guang5, dan.carpenter,
unixbhaskar, linux-kernel, Zeal Robot
On Tue, Dec 21, 2021 at 08:15:28AM +0800, davidcomponentone@gmail.com wrote:
> From: Yang Guang <yang.guang5@zte.com.cn>
>
> Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
> opencoding it.
>
> ---
> Changes from v1->v2:
> - Delete the curly {} braces.
>
> Changes from v2->v3::
> - Add --- line before version info.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: David Yang <davidcomponentone@gmail.com>
> Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
Why the signed-off-by below the --- line? That means it will be cut off
and not present in the patch at all :(
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-21 8:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-21 0:15 [PATCH v3] w1: w1_therm: use swap() to make code cleaner davidcomponentone
2021-12-21 8:32 ` Greg KH
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.