* [PATCH] leds: tca6507: use swap() to make code cleaner
@ 2021-11-15 3:24 Yihao Han
2021-11-15 14:08 ` Pavel Machek
0 siblings, 1 reply; 2+ messages in thread
From: Yihao Han @ 2021-11-15 3:24 UTC (permalink / raw)
To: Pavel Machek, linux-leds, linux-kernel; +Cc: kernel, Yihao Han
Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
opencoding it.
Signed-off-by: Yihao Han <hanyihao@vivo.com>
---
drivers/leds/leds-tca6507.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/leds/leds-tca6507.c b/drivers/leds/leds-tca6507.c
index 225b765830bd..de8eed9b667d 100644
--- a/drivers/leds/leds-tca6507.c
+++ b/drivers/leds/leds-tca6507.c
@@ -242,9 +242,7 @@ static int choose_times(int msec, int *c1p, int *c2p)
if (diff < 65536) {
int actual;
if (msec & 1) {
- c1 = *c2p;
- *c2p = *c1p;
- *c1p = c1;
+ swap(*c2p, *c1p);
}
actual = time_codes[*c1p] + time_codes[*c2p];
if (*c1p < *c2p)
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] leds: tca6507: use swap() to make code cleaner
2021-11-15 3:24 [PATCH] leds: tca6507: use swap() to make code cleaner Yihao Han
@ 2021-11-15 14:08 ` Pavel Machek
0 siblings, 0 replies; 2+ messages in thread
From: Pavel Machek @ 2021-11-15 14:08 UTC (permalink / raw)
To: Yihao Han; +Cc: linux-leds, linux-kernel, kernel
[-- Attachment #1: Type: text/plain, Size: 280 bytes --]
On Sun 2021-11-14 19:24:28, Yihao Han wrote:
> Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
> opencoding it.
>
> Signed-off-by: Yihao Han <hanyihao@vivo.com>
Thanks, applied.
Pavel
--
http://www.livejournal.com/~pavelmachek
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-15 14:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 3:24 [PATCH] leds: tca6507: use swap() to make code cleaner Yihao Han
2021-11-15 14:08 ` Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).