[PATCH 18/22] drm: Return the connector from drm_connector_get()

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

 



From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

Make drm_connector_get() return the connector. This allows the nice
pattern of 'foo->connector = drm_connector_get(connector)'

Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
---
 drivers/gpu/drm/drm_atomic.c    | 3 +--
 drivers/gpu/drm/drm_fb_helper.c | 7 +++----
 include/drm/drm_connector.h     | 7 ++++++-
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index b1983e7b65d2..56925b93f598 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1139,11 +1139,10 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
 	if (!connector_state)
 		return ERR_PTR(-ENOMEM);
 
-	drm_connector_get(connector);
 	c->state = connector_state;
 	c->old_state = connector->state;
 	c->new_state = connector_state;
-	c->ptr = connector;
+	c->ptr = drm_connector_get(connector);
 	connector_state->state = state;
 
 	state->num_connector = state->connectors.num_elems;
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 721511da4de6..f520c235a6fb 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -138,8 +138,7 @@ static int __drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper,
 	if (!fb_conn)
 		return -ENOMEM;
 
-	drm_connector_get(connector);
-	fb_conn->connector = connector;
+	fb_conn->connector = drm_connector_get(connector);
 	fb_helper->connector_info[fb_helper->connector_count++] = fb_conn;
 
 	return 0;
@@ -2338,8 +2337,8 @@ static void drm_setup_crtcs(struct drm_fb_helper *fb_helper,
 			fb_crtc->y = offset->y;
 			modeset->mode = drm_mode_duplicate(dev,
 							   fb_crtc->desired_mode);
-			drm_connector_get(connector);
-			modeset->connectors[modeset->num_connectors++] = connector;
+			modeset->connectors[modeset->num_connectors++] =
+				drm_connector_get(connector);
 			modeset->fb = fb_helper->fb;
 			modeset->x = offset->x;
 			modeset->y = offset->y;
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index a0d862d23082..8f26166f78b4 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -916,10 +916,15 @@ static inline struct drm_connector *drm_connector_lookup(struct drm_device *dev,
  * @connector: DRM connector
  *
  * This function increments the connector's refcount.
+
+ * Returns:
+ *
+ * The connector.
  */
-static inline void drm_connector_get(struct drm_connector *connector)
+static inline struct drm_connector *drm_connector_get(struct drm_connector *connector)
 {
 	drm_mode_object_get(&connector->base);
+	return connector;
 }
 
 /**
-- 
2.13.0

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux