All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH] drm: WARN() when drm_connector_attach_property fails
Date: Tue, 15 May 2012 18:09:00 -0300	[thread overview]
Message-ID: <1337116145-15041-2-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1337116145-15041-1-git-send-email-przanoni@gmail.com>

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

Also return void instead of int. We have more than 100 callers and
no one checks for the return value.

If this function fails the property won't be exposed by the get/set
ioctls, but we should probably survive. If this starts happening,
the solution will be to increase DRM_CONNECTOR_MAX_PROPERTY and
recompile the Kernel.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/drm_crtc.c |   10 +++++-----
 include/drm/drm_crtc.h     |    4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

>From the previous patch series sent, the only comment this patch had was this,
from Chris:

> Please add that to the error message and use printk_once() since we only
> really want to annoy the user the first time.

For each time we see the message, we need to increase the value by 1, so instead
of using printk_once, I just added this information to the message. Anyway, we
shouldn't be seeing this message too many times, since we don't add new
properties that often.

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 0a22ef8..37bb7ab 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2819,7 +2819,7 @@ void drm_property_destroy(struct drm_device *dev, struct drm_property *property)
 }
 EXPORT_SYMBOL(drm_property_destroy);
 
-int drm_connector_attach_property(struct drm_connector *connector,
+void drm_connector_attach_property(struct drm_connector *connector,
 			       struct drm_property *property, uint64_t init_val)
 {
 	int i;
@@ -2828,13 +2828,13 @@ int drm_connector_attach_property(struct drm_connector *connector,
 		if (connector->property_ids[i] == 0) {
 			connector->property_ids[i] = property->base.id;
 			connector->property_values[i] = init_val;
-			break;
+			return;
 		}
 	}
 
-	if (i == DRM_CONNECTOR_MAX_PROPERTY)
-		return -EINVAL;
-	return 0;
+	WARN(1, "Failed to attach connector property. Please increase "
+		"DRM_CONNECTOR_MAX_PROPERTY by 1 for each time you see this "
+		"message\n");
 }
 EXPORT_SYMBOL(drm_connector_attach_property);
 
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index f35e7ed..036faec 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -910,8 +910,8 @@ extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
 extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY);
 extern bool drm_crtc_in_use(struct drm_crtc *crtc);
 
-extern int drm_connector_attach_property(struct drm_connector *connector,
-				      struct drm_property *property, uint64_t init_val);
+extern void drm_connector_attach_property(struct drm_connector *connector,
+					  struct drm_property *property, uint64_t init_val);
 extern struct drm_property *drm_property_create(struct drm_device *dev, int flags,
 						const char *name, int num_values);
 extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags,
-- 
1.7.10

  reply	other threads:[~2012-05-15 21:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-15 21:08 [PATCH 1/8] drm: add drm_property_change_is_valid Paulo Zanoni
2012-05-15 21:09 ` Paulo Zanoni [this message]
2012-05-15 21:09 ` [PATCH] drm: create struct drm_object_properties and use it Paulo Zanoni
2012-05-15 21:09 ` [PATCH] drm: add generic ioctls to get/set properties on any object Paulo Zanoni
2012-05-15 21:09 ` [PATCH] drm: make the connector properties code use the object properties code Paulo Zanoni
2012-05-15 21:09 ` [PATCH] drm: add 'count' to struct drm_object_properties Paulo Zanoni
2012-05-15 21:09 ` [PATCH] drm: add CRTC properties Paulo Zanoni
2012-05-15 21:27   ` Paulo Zanoni

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=1337116145-15041-2-git-send-email-przanoni@gmail.com \
    --to=przanoni@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=paulo.r.zanoni@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 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.