From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-kernel@vger.kernel.org
Cc: Kees Cook <kees@kernel.org>, Tony Luck <tony.luck@intel.com>,
"Guilherme G. Piccoli" <gpiccoli@igalia.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 1/1] pstore: Use match_string() helper to simplify the code
Date: Tue, 10 Nov 2026 16:18:44 +0100 [thread overview]
Message-ID: <20261110151844.661926-1-andriy.shevchenko@linux.intel.com> (raw)
match_string() returns the array index of a matching string.
Use it instead of the open-coded implementation.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
fs/pstore/platform.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 1ad6e40f4952..4c0943a8e15e 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -17,9 +17,9 @@
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/pstore.h>
-#include <linux/string.h>
#include <linux/timer.h>
#include <linux/slab.h>
+#include <linux/string_helpers.h>
#include <linux/uaccess.h>
#include <linux/jiffies.h>
#include <linux/vmalloc.h>
@@ -130,10 +130,9 @@ enum pstore_type_id pstore_name_to_type(const char *name)
{
int i;
- for (i = 0; i < PSTORE_TYPE_MAX; i++) {
- if (!strcmp(pstore_type_names[i], name))
- return i;
- }
+ i = match_string(pstore_type_names, PSTORE_TYPE_MAX, name);
+ if (i >= 0);
+ return i;
return PSTORE_TYPE_MAX;
}
--
2.50.1
reply other threads:[~2026-11-10 15:18 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=20261110151844.661926-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=gpiccoli@igalia.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
/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
all inboxes | Powered by JetHome®