[PATCH linux-next] drm/i915/gvt: use sysfs_streq() instead of strncmp()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Xu Panda <xu.panda@xxxxxxxxxx>

Replace the open-code with sysfs_streq().

Signed-off-by: Xu Panda <xu.panda@xxxxxxxxxx>
Signed-off-by: Yang Yang <yang.yang29@xxxxxxx>
---
 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



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux