From: <yang.yang29@zte.com.cn>
To: <zhenyuw@linux.intel.com>
Cc: <zhi.a.wang@intel.com>, <jani.nikula@linux.intel.com>,
<joonas.lahtinen@linux.intel.com>, <rodrigo.vivi@intel.com>,
<tvrtko.ursulin@linux.intel.com>, <airlied@gmail.com>,
<daniel@ffwll.ch>, <intel-gvt-dev@lists.freedesktop.org>,
<intel-gfx@lists.freedesktop.org>,
<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>,
<xu.panda@zte.com.cn>, <yang.yang29@zte.com.cn>
Subject: [PATCH linux-next] drm/i915/gvt: use sysfs_streq() instead of strncmp()
Date: Tue, 22 Nov 2022 20:07:59 +0800 (CST) [thread overview]
Message-ID: <202211222007593082125@zte.com.cn> (raw)
From: Xu Panda <xu.panda@zte.com.cn>
Replace the open-code with sysfs_streq().
Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
Signed-off-by: Yang Yang <yang.yang29@zte.com>
---
drivers/gpu/drm/i915/gvt/cmd_parser.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c
index 0ebf5fbf0e39..7b9a5f7f5363 100644
--- a/drivers/gpu/drm/i915/gvt/cmd_parser.c
+++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c
@@ -917,8 +917,8 @@ static int cmd_reg_handler(struct parser_exec_state *s,
return -EBADRQC;
}
- if (!strncmp(cmd, "srm", 3) ||
- !strncmp(cmd, "lrm", 3)) {
+ if (sysfs_streq(cmd, "srm") ||
+ sysfs_streq(cmd, "lrm")) {
if (offset == i915_mmio_reg_offset(GEN8_L3SQCREG4) ||
offset == 0x21f0 ||
(IS_BROADWELL(gvt->gt->i915) &&
@@ -931,8 +931,8 @@ static int cmd_reg_handler(struct parser_exec_state *s,
}
}
- if (!strncmp(cmd, "lrr-src", 7) ||
- !strncmp(cmd, "lrr-dst", 7)) {
+ if (sysfs_streq(cmd, "lrr-src") ||
+ sysfs_streq(cmd, "lrr-dst")) {
if (IS_BROADWELL(gvt->gt->i915) && offset == 0x215c)
return 0;
else {
@@ -941,12 +941,12 @@ static int cmd_reg_handler(struct parser_exec_state *s,
}
}
- if (!strncmp(cmd, "pipe_ctrl", 9)) {
+ if (sysfs_streq(cmd, "pipe_ctrl")) {
/* TODO: add LRI POST logic here */
return 0;
}
- if (strncmp(cmd, "lri", 3))
+ if (!sysfs_streq(cmd, "lri"))
return -EPERM;
/* below are all lri handlers */
@@ -1011,7 +1011,7 @@ static int cmd_reg_handler(struct parser_exec_state *s,
*/
if (GRAPHICS_VER(s->engine->i915) == 9 &&
intel_gvt_mmio_is_sr_in_ctx(gvt, offset) &&
- !strncmp(cmd, "lri", 3)) {
+ sysfs_streq(cmd, "lri")) {
intel_gvt_read_gpa(s->vgpu,
s->workload->ring_context_gpa + 12, &ctx_sr_ctl, 4);
/* check inhibit context */
--
2.15.2
reply other threads:[~2022-11-22 12:08 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=202211222007593082125@zte.com.cn \
--to=yang.yang29@zte.com.cn \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-gvt-dev@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=tvrtko.ursulin@linux.intel.com \
--cc=xu.panda@zte.com.cn \
--cc=zhenyuw@linux.intel.com \
--cc=zhi.a.wang@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