From: Thorsten Blum <thorsten.blum@linux.dev>
To: Eric Piel <eric.piel@tremplin-utc.net>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Thorsten Blum <thorsten.blum@linux.dev>, linux-kernel@vger.kernel.org
Subject: [PATCH] misc: lis3lv02d: Use min to simplify lis3lv02d_misc_read
Date: Thu, 16 Oct 2025 13:42:33 +0200 [thread overview]
Message-ID: <20251016114234.72221-1-thorsten.blum@linux.dev> (raw)
Use min() to simplify lis3lv02d_misc_read().
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/misc/lis3lv02d/lis3lv02d.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/lis3lv02d/lis3lv02d.c b/drivers/misc/lis3lv02d/lis3lv02d.c
index 6957091ab6de..1a634ac1a241 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d.c
@@ -12,6 +12,7 @@
#include <linux/kernel.h>
#include <linux/sched/signal.h>
#include <linux/dmi.h>
+#include <linux/minmax.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/interrupt.h>
@@ -629,10 +630,7 @@ static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf,
schedule();
}
- if (data < 255)
- byte_data = data;
- else
- byte_data = 255;
+ byte_data = min(data, 255);
/* make sure we are not going into copy_to_user() with
* TASK_INTERRUPTIBLE state */
--
2.50.1
reply other threads:[~2025-10-16 11:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251016114234.72221-1-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=arnd@arndb.de \
--cc=eric.piel@tremplin-utc.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox