All of lore.kernel.org
 help / color / mirror / Atom feed
From: ville.syrjala@linux.intel.com
To: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Subject: [PATCH 5/7] drm/i915: Use container_of() in the fbdev code
Date: Fri, 31 May 2013 20:07:05 +0300	[thread overview]
Message-ID: <1370020027-27595-6-git-send-email-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <1370020027-27595-1-git-send-email-ville.syrjala@linux.intel.com>

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

Use container_of() instead of a cast to get struct intel_fbdev
from struct drm_fb_helper.

Also populate the fb_info->par correctly with the drm_fb_helper pointer
instead of the intel_fbdev pointer.

There's no actual functional change since the drm_fb_helper happens to
be the first member inside intel_fbdev.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_fb.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index e8389df..60d0cf6 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -60,8 +60,9 @@ static struct fb_ops intelfb_ops = {
 static int intelfb_create(struct drm_fb_helper *helper,
 			  struct drm_fb_helper_surface_size *sizes)
 {
-	struct intel_fbdev *ifbdev = (struct intel_fbdev *)helper;
-	struct drm_device *dev = ifbdev->helper.dev;
+	struct intel_fbdev *ifbdev =
+		container_of(helper, struct intel_fbdev, helper);
+	struct drm_device *dev = helper->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct fb_info *info;
 	struct drm_framebuffer *fb;
@@ -108,7 +109,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
 		goto out_unpin;
 	}
 
-	info->par = ifbdev;
+	info->par = helper;
 
 	ret = intel_framebuffer_init(dev, &ifbdev->ifb, &mode_cmd, obj);
 	if (ret)
-- 
1.8.1.5

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2013-05-31 17:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-31 17:07 [PATCH 0/7] drm/i915: fbdev mode restoration improvements v2 ville.syrjala
2013-05-31 17:07 ` [PATCH v2 1/7] drm: Add fb_helper->restore_fbdev_mode hook ville.syrjala
2013-06-03  9:50   ` Chris Wilson
2013-05-31 17:07 ` [PATCH 2/7] drm: Add drm_plane_force_disable() ville.syrjala
2013-05-31 17:07 ` [PATCH v2 3/7] drm/i915: Fix fbdev sprite disable code ville.syrjala
2013-06-03  9:53   ` Chris Wilson
2013-06-03 12:00   ` Daniel Vetter
2013-06-03 12:44     ` [Intel-gfx] " Ville Syrjälä
2013-05-31 17:07 ` [PATCH v2 4/7] drm/i915: Use a custom restore_fbdev_mode hook ville.syrjala
2013-06-03 10:08   ` Chris Wilson
2013-05-31 17:07 ` ville.syrjala [this message]
2013-06-03 10:08   ` [PATCH 5/7] drm/i915: Use container_of() in the fbdev code Chris Wilson
2013-06-03 12:01     ` Daniel Vetter
2013-05-31 17:07 ` [PATCH 6/7] drm/i915: s/drm_i915_private_t/struct drm_i915_private/ ville.syrjala
2013-06-03 10:09   ` Chris Wilson
2013-06-03 12:01     ` [Intel-gfx] " Daniel Vetter
2013-05-31 17:07 ` [PATCH v2 7/7] drm: Remove some unused stuff from drm_plane ville.syrjala
  -- strict thread matches above, loose matches on Subject: below --
2013-05-08  9:55 [PATCH 0/7] drm/i915: fbdev mode restoration improvements ville.syrjala
2013-05-08  9:55 ` [PATCH 5/7] drm/i915: Use container_of() in the fbdev code ville.syrjala

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=1370020027-27595-6-git-send-email-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /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.