All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: Don't pass the index to drm_property_add_enum()
@ 2018-03-16 19:04 Ville Syrjala
  2018-03-16 19:22 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Ville Syrjala @ 2018-03-16 19:04 UTC (permalink / raw)
  To: dri-devel; +Cc: nouveau, intel-gfx, Ben Skeggs

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

drm_property_add_enum() can calculate the index itself just fine,
so no point in having the caller pass it in.

Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: nouveau@lists.freedesktop.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_connector.c           |  6 +++---
 drivers/gpu/drm/drm_property.c            | 27 +++++++++++++--------------
 drivers/gpu/drm/gma500/cdv_device.c       |  4 ++--
 drivers/gpu/drm/gma500/psb_intel_sdvo.c   |  2 +-
 drivers/gpu/drm/i915/intel_sdvo.c         |  5 ++---
 drivers/gpu/drm/nouveau/nouveau_display.c |  4 +---
 include/drm/drm_property.h                |  2 +-
 7 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index b3cde897cd80..dfc8ca1e9413 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -1069,7 +1069,7 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
 		goto nomem;
 
 	for (i = 0; i < num_modes; i++)
-		drm_property_add_enum(dev->mode_config.tv_mode_property, i,
+		drm_property_add_enum(dev->mode_config.tv_mode_property,
 				      i, modes[i]);
 
 	dev->mode_config.tv_brightness_property =
@@ -1156,7 +1156,7 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
 {
 	struct drm_device *dev = connector->dev;
 	struct drm_property *scaling_mode_property;
-	int i, j = 0;
+	int i;
 	const unsigned valid_scaling_mode_mask =
 		(1U << ARRAY_SIZE(drm_scaling_mode_enum_list)) - 1;
 
@@ -1177,7 +1177,7 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
 		if (!(BIT(i) & scaling_mode_mask))
 			continue;
 
-		ret = drm_property_add_enum(scaling_mode_property, j++,
+		ret = drm_property_add_enum(scaling_mode_property,
 					    drm_scaling_mode_enum_list[i].type,
 					    drm_scaling_mode_enum_list[i].name);
 
diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
index 8f4672daac7f..1f8031e30f53 100644
--- a/drivers/gpu/drm/drm_property.c
+++ b/drivers/gpu/drm/drm_property.c
@@ -169,9 +169,9 @@ struct drm_property *drm_property_create_enum(struct drm_device *dev,
 		return NULL;
 
 	for (i = 0; i < num_values; i++) {
-		ret = drm_property_add_enum(property, i,
-				      props[i].type,
-				      props[i].name);
+		ret = drm_property_add_enum(property,
+					    props[i].type,
+					    props[i].name);
 		if (ret) {
 			drm_property_destroy(dev, property);
 			return NULL;
@@ -209,7 +209,7 @@ struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
 						 uint64_t supported_bits)
 {
 	struct drm_property *property;
-	int i, ret, index = 0;
+	int i, ret;
 	int num_values = hweight64(supported_bits);
 
 	flags |= DRM_MODE_PROP_BITMASK;
@@ -221,14 +221,9 @@ struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
 		if (!(supported_bits & (1ULL << props[i].type)))
 			continue;
 
-		if (WARN_ON(index >= num_values)) {
-			drm_property_destroy(dev, property);
-			return NULL;
-		}
-
-		ret = drm_property_add_enum(property, index++,
-				      props[i].type,
-				      props[i].name);
+		ret = drm_property_add_enum(property,
+					    props[i].type,
+					    props[i].name);
 		if (ret) {
 			drm_property_destroy(dev, property);
 			return NULL;
@@ -376,7 +371,6 @@ EXPORT_SYMBOL(drm_property_create_bool);
 /**
  * drm_property_add_enum - add a possible value to an enumeration property
  * @property: enumeration property to change
- * @index: index of the new enumeration
  * @value: value of the new enumeration
  * @name: symbolic name of the new enumeration
  *
@@ -388,10 +382,11 @@ EXPORT_SYMBOL(drm_property_create_bool);
  * Returns:
  * Zero on success, error code on failure.
  */
-int drm_property_add_enum(struct drm_property *property, int index,
+int drm_property_add_enum(struct drm_property *property,
 			  uint64_t value, const char *name)
 {
 	struct drm_property_enum *prop_enum;
+	int index = 0;
 
 	if (WARN_ON(strlen(name) >= DRM_PROP_NAME_LEN))
 		return -EINVAL;
@@ -411,8 +406,12 @@ int drm_property_add_enum(struct drm_property *property, int index,
 	list_for_each_entry(prop_enum, &property->enum_list, head) {
 		if (WARN_ON(prop_enum->value == value))
 			return -EINVAL;
+		index++;
 	}
 
+	if (WARN_ON(index >= property->num_values))
+		return -EINVAL;
+
 	prop_enum = kzalloc(sizeof(struct drm_property_enum), GFP_KERNEL);
 	if (!prop_enum)
 		return -ENOMEM;
diff --git a/drivers/gpu/drm/gma500/cdv_device.c b/drivers/gpu/drm/gma500/cdv_device.c
index 3a3bf752e03a..34b85767e4da 100644
--- a/drivers/gpu/drm/gma500/cdv_device.c
+++ b/drivers/gpu/drm/gma500/cdv_device.c
@@ -485,7 +485,7 @@ void cdv_intel_attach_force_audio_property(struct drm_connector *connector)
 			return;
 
 		for (i = 0; i < ARRAY_SIZE(force_audio_names); i++)
-			drm_property_add_enum(prop, i, i-1, force_audio_names[i]);
+			drm_property_add_enum(prop, i-1, force_audio_names[i]);
 
 		dev_priv->force_audio_property = prop;
 	}
@@ -514,7 +514,7 @@ void cdv_intel_attach_broadcast_rgb_property(struct drm_connector *connector)
 			return;
 
 		for (i = 0; i < ARRAY_SIZE(broadcast_rgb_names); i++)
-			drm_property_add_enum(prop, i, i, broadcast_rgb_names[i]);
+			drm_property_add_enum(prop, i, broadcast_rgb_names[i]);
 
 		dev_priv->broadcast_rgb_property = prop;
 	}
diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
index 84507912be84..674182805697 100644
--- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c
+++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
@@ -2281,7 +2281,7 @@ static bool psb_intel_sdvo_tv_create_property(struct psb_intel_sdvo *psb_intel_s
 
 	for (i = 0; i < psb_intel_sdvo_connector->format_supported_num; i++)
 		drm_property_add_enum(
-				psb_intel_sdvo_connector->tv_format, i,
+				psb_intel_sdvo_connector->tv_format,
 				i, tv_format_names[psb_intel_sdvo_connector->tv_format_supported[i]]);
 
 	psb_intel_sdvo->tv_format_index = psb_intel_sdvo_connector->tv_format_supported[0];
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 96e213ec202d..25005023c243 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -2779,9 +2779,8 @@ static bool intel_sdvo_tv_create_property(struct intel_sdvo *intel_sdvo,
 		return false;
 
 	for (i = 0; i < intel_sdvo_connector->format_supported_num; i++)
-		drm_property_add_enum(
-				intel_sdvo_connector->tv_format, i,
-				i, tv_format_names[intel_sdvo_connector->tv_format_supported[i]]);
+		drm_property_add_enum(intel_sdvo_connector->tv_format, i,
+				      tv_format_names[intel_sdvo_connector->tv_format_supported[i]]);
 
 	intel_sdvo_connector->base.base.state->tv.mode = intel_sdvo_connector->tv_format_supported[0];
 	drm_object_attach_property(&intel_sdvo_connector->base.base.base,
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 009713404cc4..7d0bec8dd03d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -338,11 +338,9 @@ static struct nouveau_drm_prop_enum_list dither_depth[] = {
 	if (c) {                                                               \
 		p = drm_property_create(dev, DRM_MODE_PROP_ENUM, n, c);        \
 		l = (list);                                                    \
-		c = 0;                                                         \
 		while (p && l->gen_mask) {                                     \
 			if (l->gen_mask & (1 << (gen))) {                      \
-				drm_property_add_enum(p, c, l->type, l->name); \
-				c++;                                           \
+				drm_property_add_enum(p, l->type, l->name);    \
 			}                                                      \
 			l++;                                                   \
 		}                                                              \
diff --git a/include/drm/drm_property.h b/include/drm/drm_property.h
index d1423c7f3c73..9e2cea518572 100644
--- a/include/drm/drm_property.h
+++ b/include/drm/drm_property.h
@@ -260,7 +260,7 @@ struct drm_property *drm_property_create_object(struct drm_device *dev,
 						uint32_t type);
 struct drm_property *drm_property_create_bool(struct drm_device *dev,
 					      u32 flags, const char *name);
-int drm_property_add_enum(struct drm_property *property, int index,
+int drm_property_add_enum(struct drm_property *property,
 			  uint64_t value, const char *name);
 void drm_property_destroy(struct drm_device *dev, struct drm_property *property);
 
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* ✗ Fi.CI.CHECKPATCH: warning for drm: Don't pass the index to drm_property_add_enum()
  2018-03-16 19:04 [PATCH] drm: Don't pass the index to drm_property_add_enum() Ville Syrjala
@ 2018-03-16 19:22 ` Patchwork
  2018-03-16 19:38 ` ✓ Fi.CI.BAT: success " Patchwork
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2018-03-16 19:22 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx

== Series Details ==

Series: drm: Don't pass the index to drm_property_add_enum()
URL   : https://patchwork.freedesktop.org/series/40122/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
f153106cd56b drm: Don't pass the index to drm_property_add_enum()
-:135: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
#135: FILE: drivers/gpu/drm/gma500/cdv_device.c:488:
+			drm_property_add_enum(prop, i-1, force_audio_names[i]);
 			                             ^

-:173: WARNING:LONG_LINE: line over 100 characters
#173: FILE: drivers/gpu/drm/i915/intel_sdvo.c:2783:
+				      tv_format_names[intel_sdvo_connector->tv_format_supported[i]]);

total: 0 errors, 1 warnings, 1 checks, 147 lines checked

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 9+ messages in thread

* ✓ Fi.CI.BAT: success for drm: Don't pass the index to drm_property_add_enum()
  2018-03-16 19:04 [PATCH] drm: Don't pass the index to drm_property_add_enum() Ville Syrjala
  2018-03-16 19:22 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
@ 2018-03-16 19:38 ` Patchwork
  2018-03-17  0:57 ` ✓ Fi.CI.IGT: " Patchwork
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2018-03-16 19:38 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx

== Series Details ==

Series: drm: Don't pass the index to drm_property_add_enum()
URL   : https://patchwork.freedesktop.org/series/40122/
State : success

== Summary ==

Series 40122v1 drm: Don't pass the index to drm_property_add_enum()
https://patchwork.freedesktop.org/api/1.0/series/40122/revisions/1/mbox/

fi-bdw-5557u     total:285  pass:264  dwarn:0   dfail:0   fail:0   skip:21  time:431s
fi-bdw-gvtdvm    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:443s
fi-blb-e6850     total:285  pass:220  dwarn:1   dfail:0   fail:0   skip:64  time:383s
fi-bsw-n3050     total:285  pass:239  dwarn:0   dfail:0   fail:0   skip:46  time:544s
fi-bwr-2160      total:285  pass:180  dwarn:0   dfail:0   fail:0   skip:105 time:297s
fi-bxt-j4205     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:514s
fi-byt-j1900     total:285  pass:250  dwarn:0   dfail:0   fail:0   skip:35  time:518s
fi-byt-n2820     total:285  pass:246  dwarn:0   dfail:0   fail:0   skip:39  time:503s
fi-cfl-8700k     total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:412s
fi-cfl-s2        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:580s
fi-cfl-u         total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:510s
fi-cnl-drrs      total:285  pass:254  dwarn:3   dfail:0   fail:0   skip:28  time:529s
fi-cnl-y3        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:584s
fi-elk-e7500     total:285  pass:225  dwarn:1   dfail:0   fail:0   skip:59  time:420s
fi-gdg-551       total:285  pass:177  dwarn:0   dfail:0   fail:0   skip:108 time:320s
fi-glk-1         total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:539s
fi-hsw-4770      total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:404s
fi-ilk-650       total:285  pass:225  dwarn:0   dfail:0   fail:0   skip:60  time:424s
fi-ivb-3520m     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:474s
fi-ivb-3770      total:285  pass:252  dwarn:0   dfail:0   fail:0   skip:33  time:428s
fi-kbl-7500u     total:285  pass:260  dwarn:1   dfail:0   fail:0   skip:24  time:480s
fi-kbl-7567u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:468s
fi-kbl-r         total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:516s
fi-pnv-d510      total:285  pass:219  dwarn:1   dfail:0   fail:0   skip:65  time:654s
fi-skl-6260u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:446s
fi-skl-6600u     total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:532s
fi-skl-6700hq    total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:544s
fi-skl-6700k2    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:508s
fi-skl-6770hq    total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:504s
fi-skl-guc       total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:432s
fi-skl-gvtdvm    total:285  pass:262  dwarn:0   dfail:0   fail:0   skip:23  time:446s
fi-snb-2520m     total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:570s
fi-snb-2600      total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:408s

66a3be2efe097a5aa8617214ac99fef81d623fe7 drm-tip: 2018y-03m-16d-16h-32m-51s UTC integration manifest
f153106cd56b drm: Don't pass the index to drm_property_add_enum()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8381/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 9+ messages in thread

* ✓ Fi.CI.IGT: success for drm: Don't pass the index to drm_property_add_enum()
  2018-03-16 19:04 [PATCH] drm: Don't pass the index to drm_property_add_enum() Ville Syrjala
  2018-03-16 19:22 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
  2018-03-16 19:38 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2018-03-17  0:57 ` Patchwork
  2018-04-23 13:59 ` [PATCH] " Lisovskiy, Stanislav
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2018-03-17  0:57 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx

== Series Details ==

Series: drm: Don't pass the index to drm_property_add_enum()
URL   : https://patchwork.freedesktop.org/series/40122/
State : success

== Summary ==

---- Possible new issues:

Test kms_cursor_crc:
        Subgroup cursor-128x128-suspend:
                skip       -> PASS       (shard-snb)

---- Known issues:

Test drv_suspend:
        Subgroup debugfs-reader:
                pass       -> SKIP       (shard-snb) fdo#102365
Test kms_sysfs_edid_timing:
                pass       -> WARN       (shard-apl) fdo#100047
Test perf:
        Subgroup blocking:
                fail       -> PASS       (shard-hsw) fdo#102252

fdo#102365 https://bugs.freedesktop.org/show_bug.cgi?id=102365
fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252

shard-apl        total:3442 pass:1814 dwarn:1   dfail:0   fail:7   skip:1619 time:13058s
shard-hsw        total:3442 pass:1768 dwarn:1   dfail:0   fail:1   skip:1671 time:12043s
shard-snb        total:3442 pass:1358 dwarn:1   dfail:0   fail:2   skip:2081 time:7251s
Blacklisted hosts:
shard-kbl        total:3382 pass:1902 dwarn:1   dfail:0   fail:7   skip:1471 time:9556s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8381/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] drm: Don't pass the index to drm_property_add_enum()
  2018-03-16 19:04 [PATCH] drm: Don't pass the index to drm_property_add_enum() Ville Syrjala
                   ` (2 preceding siblings ...)
  2018-03-17  0:57 ` ✓ Fi.CI.IGT: " Patchwork
@ 2018-04-23 13:59 ` Lisovskiy, Stanislav
       [not found]   ` <A98B49F3E938DC4A837FD9A548D117E612880037-kPTMFJFq+rFT4JjzTwqWc7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
  2018-04-23 14:27 ` ✗ Fi.CI.BAT: failure for drm: Don't pass the index to drm_property_add_enum() (rev2) Patchwork
  2018-04-26 13:29 ` ✗ Fi.CI.BAT: failure for drm: Don't pass the index to drm_property_add_enum() (rev3) Patchwork
  5 siblings, 1 reply; 9+ messages in thread
From: Lisovskiy, Stanislav @ 2018-04-23 13:59 UTC (permalink / raw)
  To: Ville Syrjala, dri-devel; +Cc: nouveau, intel-gfx, Ben Skeggs

Acked-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>

Best Regards,

Lisovskiy Stanislav

Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo>

________________________________________
From: Ville Syrjala [ville.syrjala@linux.intel.com]
Sent: Friday, March 16, 2018 9:04 PM
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org; Patrik Jakobsson; Ben Skeggs; nouveau@lists.freedesktop.org
Subject: [PATCH] drm: Don't pass the index to drm_property_add_enum()

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

drm_property_add_enum() can calculate the index itself just fine,
so no point in having the caller pass it in.

Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: nouveau@lists.freedesktop.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_connector.c           |  6 +++---
 drivers/gpu/drm/drm_property.c            | 27 +++++++++++++--------------
 drivers/gpu/drm/gma500/cdv_device.c       |  4 ++--
 drivers/gpu/drm/gma500/psb_intel_sdvo.c   |  2 +-
 drivers/gpu/drm/i915/intel_sdvo.c         |  5 ++---
 drivers/gpu/drm/nouveau/nouveau_display.c |  4 +---
 include/drm/drm_property.h                |  2 +-
 7 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index b3cde897cd80..dfc8ca1e9413 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -1069,7 +1069,7 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
                goto nomem;

        for (i = 0; i < num_modes; i++)
-               drm_property_add_enum(dev->mode_config.tv_mode_property, i,
+               drm_property_add_enum(dev->mode_config.tv_mode_property,
                                      i, modes[i]);

        dev->mode_config.tv_brightness_property =
@@ -1156,7 +1156,7 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
 {
        struct drm_device *dev = connector->dev;
        struct drm_property *scaling_mode_property;
-       int i, j = 0;
+       int i;
        const unsigned valid_scaling_mode_mask =
                (1U << ARRAY_SIZE(drm_scaling_mode_enum_list)) - 1;

@@ -1177,7 +1177,7 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
                if (!(BIT(i) & scaling_mode_mask))
                        continue;

-               ret = drm_property_add_enum(scaling_mode_property, j++,
+               ret = drm_property_add_enum(scaling_mode_property,
                                            drm_scaling_mode_enum_list[i].type,
                                            drm_scaling_mode_enum_list[i].name);

diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
index 8f4672daac7f..1f8031e30f53 100644
--- a/drivers/gpu/drm/drm_property.c
+++ b/drivers/gpu/drm/drm_property.c
@@ -169,9 +169,9 @@ struct drm_property *drm_property_create_enum(struct drm_device *dev,
                return NULL;

        for (i = 0; i < num_values; i++) {
-               ret = drm_property_add_enum(property, i,
-                                     props[i].type,
-                                     props[i].name);
+               ret = drm_property_add_enum(property,
+                                           props[i].type,
+                                           props[i].name);
                if (ret) {
                        drm_property_destroy(dev, property);
                        return NULL;
@@ -209,7 +209,7 @@ struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
                                                 uint64_t supported_bits)
 {
        struct drm_property *property;
-       int i, ret, index = 0;
+       int i, ret;
        int num_values = hweight64(supported_bits);

        flags |= DRM_MODE_PROP_BITMASK;
@@ -221,14 +221,9 @@ struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
                if (!(supported_bits & (1ULL << props[i].type)))
                        continue;

-               if (WARN_ON(index >= num_values)) {
-                       drm_property_destroy(dev, property);
-                       return NULL;
-               }
-
-               ret = drm_property_add_enum(property, index++,
-                                     props[i].type,
-                                     props[i].name);
+               ret = drm_property_add_enum(property,
+                                           props[i].type,
+                                           props[i].name);
                if (ret) {
                        drm_property_destroy(dev, property);
                        return NULL;
@@ -376,7 +371,6 @@ EXPORT_SYMBOL(drm_property_create_bool);
 /**
  * drm_property_add_enum - add a possible value to an enumeration property
  * @property: enumeration property to change
- * @index: index of the new enumeration
  * @value: value of the new enumeration
  * @name: symbolic name of the new enumeration
  *
@@ -388,10 +382,11 @@ EXPORT_SYMBOL(drm_property_create_bool);
  * Returns:
  * Zero on success, error code on failure.
  */
-int drm_property_add_enum(struct drm_property *property, int index,
+int drm_property_add_enum(struct drm_property *property,
                          uint64_t value, const char *name)
 {
        struct drm_property_enum *prop_enum;
+       int index = 0;

        if (WARN_ON(strlen(name) >= DRM_PROP_NAME_LEN))
                return -EINVAL;
@@ -411,8 +406,12 @@ int drm_property_add_enum(struct drm_property *property, int index,
        list_for_each_entry(prop_enum, &property->enum_list, head) {
                if (WARN_ON(prop_enum->value == value))
                        return -EINVAL;
+               index++;
        }

+       if (WARN_ON(index >= property->num_values))
+               return -EINVAL;
+
        prop_enum = kzalloc(sizeof(struct drm_property_enum), GFP_KERNEL);
        if (!prop_enum)
                return -ENOMEM;
diff --git a/drivers/gpu/drm/gma500/cdv_device.c b/drivers/gpu/drm/gma500/cdv_device.c
index 3a3bf752e03a..34b85767e4da 100644
--- a/drivers/gpu/drm/gma500/cdv_device.c
+++ b/drivers/gpu/drm/gma500/cdv_device.c
@@ -485,7 +485,7 @@ void cdv_intel_attach_force_audio_property(struct drm_connector *connector)
                        return;

                for (i = 0; i < ARRAY_SIZE(force_audio_names); i++)
-                       drm_property_add_enum(prop, i, i-1, force_audio_names[i]);
+                       drm_property_add_enum(prop, i-1, force_audio_names[i]);

                dev_priv->force_audio_property = prop;
        }
@@ -514,7 +514,7 @@ void cdv_intel_attach_broadcast_rgb_property(struct drm_connector *connector)
                        return;

                for (i = 0; i < ARRAY_SIZE(broadcast_rgb_names); i++)
-                       drm_property_add_enum(prop, i, i, broadcast_rgb_names[i]);
+                       drm_property_add_enum(prop, i, broadcast_rgb_names[i]);

                dev_priv->broadcast_rgb_property = prop;
        }
diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
index 84507912be84..674182805697 100644
--- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c
+++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
@@ -2281,7 +2281,7 @@ static bool psb_intel_sdvo_tv_create_property(struct psb_intel_sdvo *psb_intel_s

        for (i = 0; i < psb_intel_sdvo_connector->format_supported_num; i++)
                drm_property_add_enum(
-                               psb_intel_sdvo_connector->tv_format, i,
+                               psb_intel_sdvo_connector->tv_format,
                                i, tv_format_names[psb_intel_sdvo_connector->tv_format_supported[i]]);

        psb_intel_sdvo->tv_format_index = psb_intel_sdvo_connector->tv_format_supported[0];
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 96e213ec202d..25005023c243 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -2779,9 +2779,8 @@ static bool intel_sdvo_tv_create_property(struct intel_sdvo *intel_sdvo,
                return false;

        for (i = 0; i < intel_sdvo_connector->format_supported_num; i++)
-               drm_property_add_enum(
-                               intel_sdvo_connector->tv_format, i,
-                               i, tv_format_names[intel_sdvo_connector->tv_format_supported[i]]);
+               drm_property_add_enum(intel_sdvo_connector->tv_format, i,
+                                     tv_format_names[intel_sdvo_connector->tv_format_supported[i]]);

        intel_sdvo_connector->base.base.state->tv.mode = intel_sdvo_connector->tv_format_supported[0];
        drm_object_attach_property(&intel_sdvo_connector->base.base.base,
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 009713404cc4..7d0bec8dd03d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -338,11 +338,9 @@ static struct nouveau_drm_prop_enum_list dither_depth[] = {
        if (c) {                                                               \
                p = drm_property_create(dev, DRM_MODE_PROP_ENUM, n, c);        \
                l = (list);                                                    \
-               c = 0;                                                         \
                while (p && l->gen_mask) {                                     \
                        if (l->gen_mask & (1 << (gen))) {                      \
-                               drm_property_add_enum(p, c, l->type, l->name); \
-                               c++;                                           \
+                               drm_property_add_enum(p, l->type, l->name);    \
                        }                                                      \
                        l++;                                                   \
                }                                                              \
diff --git a/include/drm/drm_property.h b/include/drm/drm_property.h
index d1423c7f3c73..9e2cea518572 100644
--- a/include/drm/drm_property.h
+++ b/include/drm/drm_property.h
@@ -260,7 +260,7 @@ struct drm_property *drm_property_create_object(struct drm_device *dev,
                                                uint32_t type);
 struct drm_property *drm_property_create_bool(struct drm_device *dev,
                                              u32 flags, const char *name);
-int drm_property_add_enum(struct drm_property *property, int index,
+int drm_property_add_enum(struct drm_property *property,
                          uint64_t value, const char *name);
 void drm_property_destroy(struct drm_device *dev, struct drm_property *property);

--
2.16.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* ✗ Fi.CI.BAT: failure for drm: Don't pass the index to drm_property_add_enum() (rev2)
  2018-03-16 19:04 [PATCH] drm: Don't pass the index to drm_property_add_enum() Ville Syrjala
                   ` (3 preceding siblings ...)
  2018-04-23 13:59 ` [PATCH] " Lisovskiy, Stanislav
@ 2018-04-23 14:27 ` Patchwork
  2018-04-26 13:29 ` ✗ Fi.CI.BAT: failure for drm: Don't pass the index to drm_property_add_enum() (rev3) Patchwork
  5 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2018-04-23 14:27 UTC (permalink / raw)
  To: Lisovskiy, Stanislav; +Cc: intel-gfx

== Series Details ==

Series: drm: Don't pass the index to drm_property_add_enum() (rev2)
URL   : https://patchwork.freedesktop.org/series/40122/
State : failure

== Summary ==

Applying: drm: Don't pass the index to drm_property_add_enum()
error: patch failed: drivers/gpu/drm/drm_connector.c:1069
error: drivers/gpu/drm/drm_connector.c: patch does not apply
error: patch failed: drivers/gpu/drm/drm_property.c:169
error: drivers/gpu/drm/drm_property.c: patch does not apply
error: patch failed: drivers/gpu/drm/gma500/cdv_device.c:485
error: drivers/gpu/drm/gma500/cdv_device.c: patch does not apply
error: patch failed: drivers/gpu/drm/gma500/psb_intel_sdvo.c:2281
error: drivers/gpu/drm/gma500/psb_intel_sdvo.c: patch does not apply
error: patch failed: drivers/gpu/drm/i915/intel_sdvo.c:2779
error: drivers/gpu/drm/i915/intel_sdvo.c: patch does not apply
error: patch failed: drivers/gpu/drm/nouveau/nouveau_display.c:338
error: drivers/gpu/drm/nouveau/nouveau_display.c: patch does not apply
error: patch failed: include/drm/drm_property.h:260
error: include/drm/drm_property.h: patch does not apply
error: Did you hand edit your patch?
It does not apply to blobs recorded in its index.
Using index info to reconstruct a base tree...
M	include/drm/drm_property.h
Patch failed at 0001 drm: Don't pass the index to drm_property_add_enum()
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] drm: Don't pass the index to drm_property_add_enum()
       [not found]   ` <A98B49F3E938DC4A837FD9A548D117E612880037-kPTMFJFq+rFT4JjzTwqWc7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2018-04-26 12:45     ` Lisovskiy, Stanislav
       [not found]       ` <A98B49F3E938DC4A837FD9A548D117E6128815E8-kPTMFJFq+rFT4JjzTwqWc7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Lisovskiy, Stanislav @ 2018-04-26 12:45 UTC (permalink / raw)
  To: Ville Syrjala, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Ben Skeggs

Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>

Best Regards,

Lisovskiy Stanislav

Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo

________________________________________
From: Intel-gfx [intel-gfx-bounces@lists.freedesktop.org] on behalf of Lisovskiy, Stanislav [stanislav.lisovskiy@intel.com]
Sent: Monday, April 23, 2018 4:59 PM
To: Ville Syrjala; dri-devel@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org; intel-gfx@lists.freedesktop.org; Ben Skeggs
Subject: Re: [Intel-gfx] [PATCH] drm: Don't pass the index to drm_property_add_enum()

Acked-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>

Best Regards,

Lisovskiy Stanislav

Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo>

________________________________________
From: Ville Syrjala [ville.syrjala@linux.intel.com]
Sent: Friday, March 16, 2018 9:04 PM
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org; Patrik Jakobsson; Ben Skeggs; nouveau@lists.freedesktop.org
Subject: [PATCH] drm: Don't pass the index to drm_property_add_enum()

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

drm_property_add_enum() can calculate the index itself just fine,
so no point in having the caller pass it in.

Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: nouveau@lists.freedesktop.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_connector.c           |  6 +++---
 drivers/gpu/drm/drm_property.c            | 27 +++++++++++++--------------
 drivers/gpu/drm/gma500/cdv_device.c       |  4 ++--
 drivers/gpu/drm/gma500/psb_intel_sdvo.c   |  2 +-
 drivers/gpu/drm/i915/intel_sdvo.c         |  5 ++---
 drivers/gpu/drm/nouveau/nouveau_display.c |  4 +---
 include/drm/drm_property.h                |  2 +-
 7 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index b3cde897cd80..dfc8ca1e9413 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -1069,7 +1069,7 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
                goto nomem;

        for (i = 0; i < num_modes; i++)
-               drm_property_add_enum(dev->mode_config.tv_mode_property, i,
+               drm_property_add_enum(dev->mode_config.tv_mode_property,
                                      i, modes[i]);

        dev->mode_config.tv_brightness_property =
@@ -1156,7 +1156,7 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
 {
        struct drm_device *dev = connector->dev;
        struct drm_property *scaling_mode_property;
-       int i, j = 0;
+       int i;
        const unsigned valid_scaling_mode_mask =
                (1U << ARRAY_SIZE(drm_scaling_mode_enum_list)) - 1;

@@ -1177,7 +1177,7 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
                if (!(BIT(i) & scaling_mode_mask))
                        continue;

-               ret = drm_property_add_enum(scaling_mode_property, j++,
+               ret = drm_property_add_enum(scaling_mode_property,
                                            drm_scaling_mode_enum_list[i].type,
                                            drm_scaling_mode_enum_list[i].name);

diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
index 8f4672daac7f..1f8031e30f53 100644
--- a/drivers/gpu/drm/drm_property.c
+++ b/drivers/gpu/drm/drm_property.c
@@ -169,9 +169,9 @@ struct drm_property *drm_property_create_enum(struct drm_device *dev,
                return NULL;

        for (i = 0; i < num_values; i++) {
-               ret = drm_property_add_enum(property, i,
-                                     props[i].type,
-                                     props[i].name);
+               ret = drm_property_add_enum(property,
+                                           props[i].type,
+                                           props[i].name);
                if (ret) {
                        drm_property_destroy(dev, property);
                        return NULL;
@@ -209,7 +209,7 @@ struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
                                                 uint64_t supported_bits)
 {
        struct drm_property *property;
-       int i, ret, index = 0;
+       int i, ret;
        int num_values = hweight64(supported_bits);

        flags |= DRM_MODE_PROP_BITMASK;
@@ -221,14 +221,9 @@ struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
                if (!(supported_bits & (1ULL << props[i].type)))
                        continue;

-               if (WARN_ON(index >= num_values)) {
-                       drm_property_destroy(dev, property);
-                       return NULL;
-               }
-
-               ret = drm_property_add_enum(property, index++,
-                                     props[i].type,
-                                     props[i].name);
+               ret = drm_property_add_enum(property,
+                                           props[i].type,
+                                           props[i].name);
                if (ret) {
                        drm_property_destroy(dev, property);
                        return NULL;
@@ -376,7 +371,6 @@ EXPORT_SYMBOL(drm_property_create_bool);
 /**
  * drm_property_add_enum - add a possible value to an enumeration property
  * @property: enumeration property to change
- * @index: index of the new enumeration
  * @value: value of the new enumeration
  * @name: symbolic name of the new enumeration
  *
@@ -388,10 +382,11 @@ EXPORT_SYMBOL(drm_property_create_bool);
  * Returns:
  * Zero on success, error code on failure.
  */
-int drm_property_add_enum(struct drm_property *property, int index,
+int drm_property_add_enum(struct drm_property *property,
                          uint64_t value, const char *name)
 {
        struct drm_property_enum *prop_enum;
+       int index = 0;

        if (WARN_ON(strlen(name) >= DRM_PROP_NAME_LEN))
                return -EINVAL;
@@ -411,8 +406,12 @@ int drm_property_add_enum(struct drm_property *property, int index,
        list_for_each_entry(prop_enum, &property->enum_list, head) {
                if (WARN_ON(prop_enum->value == value))
                        return -EINVAL;
+               index++;
        }

+       if (WARN_ON(index >= property->num_values))
+               return -EINVAL;
+
        prop_enum = kzalloc(sizeof(struct drm_property_enum), GFP_KERNEL);
        if (!prop_enum)
                return -ENOMEM;
diff --git a/drivers/gpu/drm/gma500/cdv_device.c b/drivers/gpu/drm/gma500/cdv_device.c
index 3a3bf752e03a..34b85767e4da 100644
--- a/drivers/gpu/drm/gma500/cdv_device.c
+++ b/drivers/gpu/drm/gma500/cdv_device.c
@@ -485,7 +485,7 @@ void cdv_intel_attach_force_audio_property(struct drm_connector *connector)
                        return;

                for (i = 0; i < ARRAY_SIZE(force_audio_names); i++)
-                       drm_property_add_enum(prop, i, i-1, force_audio_names[i]);
+                       drm_property_add_enum(prop, i-1, force_audio_names[i]);

                dev_priv->force_audio_property = prop;
        }
@@ -514,7 +514,7 @@ void cdv_intel_attach_broadcast_rgb_property(struct drm_connector *connector)
                        return;

                for (i = 0; i < ARRAY_SIZE(broadcast_rgb_names); i++)
-                       drm_property_add_enum(prop, i, i, broadcast_rgb_names[i]);
+                       drm_property_add_enum(prop, i, broadcast_rgb_names[i]);

                dev_priv->broadcast_rgb_property = prop;
        }
diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
index 84507912be84..674182805697 100644
--- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c
+++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
@@ -2281,7 +2281,7 @@ static bool psb_intel_sdvo_tv_create_property(struct psb_intel_sdvo *psb_intel_s

        for (i = 0; i < psb_intel_sdvo_connector->format_supported_num; i++)
                drm_property_add_enum(
-                               psb_intel_sdvo_connector->tv_format, i,
+                               psb_intel_sdvo_connector->tv_format,
                                i, tv_format_names[psb_intel_sdvo_connector->tv_format_supported[i]]);

        psb_intel_sdvo->tv_format_index = psb_intel_sdvo_connector->tv_format_supported[0];
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 96e213ec202d..25005023c243 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -2779,9 +2779,8 @@ static bool intel_sdvo_tv_create_property(struct intel_sdvo *intel_sdvo,
                return false;

        for (i = 0; i < intel_sdvo_connector->format_supported_num; i++)
-               drm_property_add_enum(
-                               intel_sdvo_connector->tv_format, i,
-                               i, tv_format_names[intel_sdvo_connector->tv_format_supported[i]]);
+               drm_property_add_enum(intel_sdvo_connector->tv_format, i,
+                                     tv_format_names[intel_sdvo_connector->tv_format_supported[i]]);

        intel_sdvo_connector->base.base.state->tv.mode = intel_sdvo_connector->tv_format_supported[0];
        drm_object_attach_property(&intel_sdvo_connector->base.base.base,
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 009713404cc4..7d0bec8dd03d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -338,11 +338,9 @@ static struct nouveau_drm_prop_enum_list dither_depth[] = {
        if (c) {                                                               \
                p = drm_property_create(dev, DRM_MODE_PROP_ENUM, n, c);        \
                l = (list);                                                    \
-               c = 0;                                                         \
                while (p && l->gen_mask) {                                     \
                        if (l->gen_mask & (1 << (gen))) {                      \
-                               drm_property_add_enum(p, c, l->type, l->name); \
-                               c++;                                           \
+                               drm_property_add_enum(p, l->type, l->name);    \
                        }                                                      \
                        l++;                                                   \
                }                                                              \
diff --git a/include/drm/drm_property.h b/include/drm/drm_property.h
index d1423c7f3c73..9e2cea518572 100644
--- a/include/drm/drm_property.h
+++ b/include/drm/drm_property.h
@@ -260,7 +260,7 @@ struct drm_property *drm_property_create_object(struct drm_device *dev,
                                                uint32_t type);
 struct drm_property *drm_property_create_bool(struct drm_device *dev,
                                              u32 flags, const char *name);
-int drm_property_add_enum(struct drm_property *property, int index,
+int drm_property_add_enum(struct drm_property *property,
                          uint64_t value, const char *name);
 void drm_property_destroy(struct drm_device *dev, struct drm_property *property);

--
2.16.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* ✗ Fi.CI.BAT: failure for drm: Don't pass the index to drm_property_add_enum() (rev3)
  2018-03-16 19:04 [PATCH] drm: Don't pass the index to drm_property_add_enum() Ville Syrjala
                   ` (4 preceding siblings ...)
  2018-04-23 14:27 ` ✗ Fi.CI.BAT: failure for drm: Don't pass the index to drm_property_add_enum() (rev2) Patchwork
@ 2018-04-26 13:29 ` Patchwork
  5 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2018-04-26 13:29 UTC (permalink / raw)
  To: Lisovskiy, Stanislav; +Cc: intel-gfx

== Series Details ==

Series: drm: Don't pass the index to drm_property_add_enum() (rev3)
URL   : https://patchwork.freedesktop.org/series/40122/
State : failure

== Summary ==

Applying: drm: Don't pass the index to drm_property_add_enum()
error: patch failed: drivers/gpu/drm/drm_connector.c:1069
error: drivers/gpu/drm/drm_connector.c: patch does not apply
error: patch failed: drivers/gpu/drm/drm_property.c:169
error: drivers/gpu/drm/drm_property.c: patch does not apply
error: patch failed: drivers/gpu/drm/gma500/cdv_device.c:485
error: drivers/gpu/drm/gma500/cdv_device.c: patch does not apply
error: patch failed: drivers/gpu/drm/gma500/psb_intel_sdvo.c:2281
error: drivers/gpu/drm/gma500/psb_intel_sdvo.c: patch does not apply
error: patch failed: drivers/gpu/drm/i915/intel_sdvo.c:2779
error: drivers/gpu/drm/i915/intel_sdvo.c: patch does not apply
error: patch failed: drivers/gpu/drm/nouveau/nouveau_display.c:338
error: drivers/gpu/drm/nouveau/nouveau_display.c: patch does not apply
error: patch failed: include/drm/drm_property.h:260
error: include/drm/drm_property.h: patch does not apply
error: Did you hand edit your patch?
It does not apply to blobs recorded in its index.
Using index info to reconstruct a base tree...
M	drivers/gpu/drm/gma500/psb_intel_sdvo.c
M	include/drm/drm_property.h
Patch failed at 0001 drm: Don't pass the index to drm_property_add_enum()
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] drm: Don't pass the index to drm_property_add_enum()
       [not found]       ` <A98B49F3E938DC4A837FD9A548D117E6128815E8-kPTMFJFq+rFT4JjzTwqWc7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2018-04-27 14:11         ` Ville Syrjälä
  0 siblings, 0 replies; 9+ messages in thread
From: Ville Syrjälä @ 2018-04-27 14:11 UTC (permalink / raw)
  To: Lisovskiy, Stanislav
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Ben Skeggs,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Thu, Apr 26, 2018 at 12:45:13PM +0000, Lisovskiy, Stanislav wrote:
> Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>

Thanks. Pushed to drm-misc-next.

> 
> Best Regards,
> 
> Lisovskiy Stanislav
> 
> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo
> 
> ________________________________________
> From: Intel-gfx [intel-gfx-bounces@lists.freedesktop.org] on behalf of Lisovskiy, Stanislav [stanislav.lisovskiy@intel.com]
> Sent: Monday, April 23, 2018 4:59 PM
> To: Ville Syrjala; dri-devel@lists.freedesktop.org
> Cc: nouveau@lists.freedesktop.org; intel-gfx@lists.freedesktop.org; Ben Skeggs
> Subject: Re: [Intel-gfx] [PATCH] drm: Don't pass the index to drm_property_add_enum()
> 
> Acked-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> 
> Best Regards,
> 
> Lisovskiy Stanislav
> 
> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo>
> 
> ________________________________________
> From: Ville Syrjala [ville.syrjala@linux.intel.com]
> Sent: Friday, March 16, 2018 9:04 PM
> To: dri-devel@lists.freedesktop.org
> Cc: intel-gfx@lists.freedesktop.org; Patrik Jakobsson; Ben Skeggs; nouveau@lists.freedesktop.org
> Subject: [PATCH] drm: Don't pass the index to drm_property_add_enum()
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> drm_property_add_enum() can calculate the index itself just fine,
> so no point in having the caller pass it in.
> 
> Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: nouveau@lists.freedesktop.org
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_connector.c           |  6 +++---
>  drivers/gpu/drm/drm_property.c            | 27 +++++++++++++--------------
>  drivers/gpu/drm/gma500/cdv_device.c       |  4 ++--
>  drivers/gpu/drm/gma500/psb_intel_sdvo.c   |  2 +-
>  drivers/gpu/drm/i915/intel_sdvo.c         |  5 ++---
>  drivers/gpu/drm/nouveau/nouveau_display.c |  4 +---
>  include/drm/drm_property.h                |  2 +-
>  7 files changed, 23 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index b3cde897cd80..dfc8ca1e9413 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -1069,7 +1069,7 @@ int drm_mode_create_tv_properties(struct drm_device *dev,
>                 goto nomem;
> 
>         for (i = 0; i < num_modes; i++)
> -               drm_property_add_enum(dev->mode_config.tv_mode_property, i,
> +               drm_property_add_enum(dev->mode_config.tv_mode_property,
>                                       i, modes[i]);
> 
>         dev->mode_config.tv_brightness_property =
> @@ -1156,7 +1156,7 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
>  {
>         struct drm_device *dev = connector->dev;
>         struct drm_property *scaling_mode_property;
> -       int i, j = 0;
> +       int i;
>         const unsigned valid_scaling_mode_mask =
>                 (1U << ARRAY_SIZE(drm_scaling_mode_enum_list)) - 1;
> 
> @@ -1177,7 +1177,7 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
>                 if (!(BIT(i) & scaling_mode_mask))
>                         continue;
> 
> -               ret = drm_property_add_enum(scaling_mode_property, j++,
> +               ret = drm_property_add_enum(scaling_mode_property,
>                                             drm_scaling_mode_enum_list[i].type,
>                                             drm_scaling_mode_enum_list[i].name);
> 
> diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
> index 8f4672daac7f..1f8031e30f53 100644
> --- a/drivers/gpu/drm/drm_property.c
> +++ b/drivers/gpu/drm/drm_property.c
> @@ -169,9 +169,9 @@ struct drm_property *drm_property_create_enum(struct drm_device *dev,
>                 return NULL;
> 
>         for (i = 0; i < num_values; i++) {
> -               ret = drm_property_add_enum(property, i,
> -                                     props[i].type,
> -                                     props[i].name);
> +               ret = drm_property_add_enum(property,
> +                                           props[i].type,
> +                                           props[i].name);
>                 if (ret) {
>                         drm_property_destroy(dev, property);
>                         return NULL;
> @@ -209,7 +209,7 @@ struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
>                                                  uint64_t supported_bits)
>  {
>         struct drm_property *property;
> -       int i, ret, index = 0;
> +       int i, ret;
>         int num_values = hweight64(supported_bits);
> 
>         flags |= DRM_MODE_PROP_BITMASK;
> @@ -221,14 +221,9 @@ struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
>                 if (!(supported_bits & (1ULL << props[i].type)))
>                         continue;
> 
> -               if (WARN_ON(index >= num_values)) {
> -                       drm_property_destroy(dev, property);
> -                       return NULL;
> -               }
> -
> -               ret = drm_property_add_enum(property, index++,
> -                                     props[i].type,
> -                                     props[i].name);
> +               ret = drm_property_add_enum(property,
> +                                           props[i].type,
> +                                           props[i].name);
>                 if (ret) {
>                         drm_property_destroy(dev, property);
>                         return NULL;
> @@ -376,7 +371,6 @@ EXPORT_SYMBOL(drm_property_create_bool);
>  /**
>   * drm_property_add_enum - add a possible value to an enumeration property
>   * @property: enumeration property to change
> - * @index: index of the new enumeration
>   * @value: value of the new enumeration
>   * @name: symbolic name of the new enumeration
>   *
> @@ -388,10 +382,11 @@ EXPORT_SYMBOL(drm_property_create_bool);
>   * Returns:
>   * Zero on success, error code on failure.
>   */
> -int drm_property_add_enum(struct drm_property *property, int index,
> +int drm_property_add_enum(struct drm_property *property,
>                           uint64_t value, const char *name)
>  {
>         struct drm_property_enum *prop_enum;
> +       int index = 0;
> 
>         if (WARN_ON(strlen(name) >= DRM_PROP_NAME_LEN))
>                 return -EINVAL;
> @@ -411,8 +406,12 @@ int drm_property_add_enum(struct drm_property *property, int index,
>         list_for_each_entry(prop_enum, &property->enum_list, head) {
>                 if (WARN_ON(prop_enum->value == value))
>                         return -EINVAL;
> +               index++;
>         }
> 
> +       if (WARN_ON(index >= property->num_values))
> +               return -EINVAL;
> +
>         prop_enum = kzalloc(sizeof(struct drm_property_enum), GFP_KERNEL);
>         if (!prop_enum)
>                 return -ENOMEM;
> diff --git a/drivers/gpu/drm/gma500/cdv_device.c b/drivers/gpu/drm/gma500/cdv_device.c
> index 3a3bf752e03a..34b85767e4da 100644
> --- a/drivers/gpu/drm/gma500/cdv_device.c
> +++ b/drivers/gpu/drm/gma500/cdv_device.c
> @@ -485,7 +485,7 @@ void cdv_intel_attach_force_audio_property(struct drm_connector *connector)
>                         return;
> 
>                 for (i = 0; i < ARRAY_SIZE(force_audio_names); i++)
> -                       drm_property_add_enum(prop, i, i-1, force_audio_names[i]);
> +                       drm_property_add_enum(prop, i-1, force_audio_names[i]);
> 
>                 dev_priv->force_audio_property = prop;
>         }
> @@ -514,7 +514,7 @@ void cdv_intel_attach_broadcast_rgb_property(struct drm_connector *connector)
>                         return;
> 
>                 for (i = 0; i < ARRAY_SIZE(broadcast_rgb_names); i++)
> -                       drm_property_add_enum(prop, i, i, broadcast_rgb_names[i]);
> +                       drm_property_add_enum(prop, i, broadcast_rgb_names[i]);
> 
>                 dev_priv->broadcast_rgb_property = prop;
>         }
> diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
> index 84507912be84..674182805697 100644
> --- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c
> +++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
> @@ -2281,7 +2281,7 @@ static bool psb_intel_sdvo_tv_create_property(struct psb_intel_sdvo *psb_intel_s
> 
>         for (i = 0; i < psb_intel_sdvo_connector->format_supported_num; i++)
>                 drm_property_add_enum(
> -                               psb_intel_sdvo_connector->tv_format, i,
> +                               psb_intel_sdvo_connector->tv_format,
>                                 i, tv_format_names[psb_intel_sdvo_connector->tv_format_supported[i]]);
> 
>         psb_intel_sdvo->tv_format_index = psb_intel_sdvo_connector->tv_format_supported[0];
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index 96e213ec202d..25005023c243 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -2779,9 +2779,8 @@ static bool intel_sdvo_tv_create_property(struct intel_sdvo *intel_sdvo,
>                 return false;
> 
>         for (i = 0; i < intel_sdvo_connector->format_supported_num; i++)
> -               drm_property_add_enum(
> -                               intel_sdvo_connector->tv_format, i,
> -                               i, tv_format_names[intel_sdvo_connector->tv_format_supported[i]]);
> +               drm_property_add_enum(intel_sdvo_connector->tv_format, i,
> +                                     tv_format_names[intel_sdvo_connector->tv_format_supported[i]]);
> 
>         intel_sdvo_connector->base.base.state->tv.mode = intel_sdvo_connector->tv_format_supported[0];
>         drm_object_attach_property(&intel_sdvo_connector->base.base.base,
> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
> index 009713404cc4..7d0bec8dd03d 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
> @@ -338,11 +338,9 @@ static struct nouveau_drm_prop_enum_list dither_depth[] = {
>         if (c) {                                                               \
>                 p = drm_property_create(dev, DRM_MODE_PROP_ENUM, n, c);        \
>                 l = (list);                                                    \
> -               c = 0;                                                         \
>                 while (p && l->gen_mask) {                                     \
>                         if (l->gen_mask & (1 << (gen))) {                      \
> -                               drm_property_add_enum(p, c, l->type, l->name); \
> -                               c++;                                           \
> +                               drm_property_add_enum(p, l->type, l->name);    \
>                         }                                                      \
>                         l++;                                                   \
>                 }                                                              \
> diff --git a/include/drm/drm_property.h b/include/drm/drm_property.h
> index d1423c7f3c73..9e2cea518572 100644
> --- a/include/drm/drm_property.h
> +++ b/include/drm/drm_property.h
> @@ -260,7 +260,7 @@ struct drm_property *drm_property_create_object(struct drm_device *dev,
>                                                 uint32_t type);
>  struct drm_property *drm_property_create_bool(struct drm_device *dev,
>                                               u32 flags, const char *name);
> -int drm_property_add_enum(struct drm_property *property, int index,
> +int drm_property_add_enum(struct drm_property *property,
>                           uint64_t value, const char *name);
>  void drm_property_destroy(struct drm_device *dev, struct drm_property *property);
> 
> --
> 2.16.1
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-04-27 14:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-16 19:04 [PATCH] drm: Don't pass the index to drm_property_add_enum() Ville Syrjala
2018-03-16 19:22 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2018-03-16 19:38 ` ✓ Fi.CI.BAT: success " Patchwork
2018-03-17  0:57 ` ✓ Fi.CI.IGT: " Patchwork
2018-04-23 13:59 ` [PATCH] " Lisovskiy, Stanislav
     [not found]   ` <A98B49F3E938DC4A837FD9A548D117E612880037-kPTMFJFq+rFT4JjzTwqWc7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2018-04-26 12:45     ` Lisovskiy, Stanislav
     [not found]       ` <A98B49F3E938DC4A837FD9A548D117E6128815E8-kPTMFJFq+rFT4JjzTwqWc7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2018-04-27 14:11         ` Ville Syrjälä
2018-04-23 14:27 ` ✗ Fi.CI.BAT: failure for drm: Don't pass the index to drm_property_add_enum() (rev2) Patchwork
2018-04-26 13:29 ` ✗ Fi.CI.BAT: failure for drm: Don't pass the index to drm_property_add_enum() (rev3) Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.