mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Javier M. Mellid" <jmunhoz@igalia.com>
To: gregkh@linuxfoundation.org, gewang@siliconmotion.com
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	"Javier M. Mellid" <jmunhoz@igalia.com>
Subject: [PATCH 2/2] staging: sm7xxfb: erase hardcode cast between smtcfb_info and fb_info
Date: Wed, 27 Jun 2012 14:10:15 +0200	[thread overview]
Message-ID: <1340799015-3138-3-git-send-email-jmunhoz@igalia.com> (raw)
In-Reply-To: <1340799015-3138-1-git-send-email-jmunhoz@igalia.com>

From: "Javier M. Mellid" <jmunhoz@igalia.com>

This patch erases hardcode cast between smtcfb_info and fb_info in order
to get a more robust and less rigid smtcfb_info structure. fb_info
doesn't need to be the first field in smtcfb_info after this patch.

Tested with SM712.

Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
---
 drivers/staging/sm7xxfb/sm7xxfb.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c
index c603e8c..e3511ec 100644
--- a/drivers/staging/sm7xxfb/sm7xxfb.c
+++ b/drivers/staging/sm7xxfb/sm7xxfb.c
@@ -40,8 +40,8 @@ struct screen_info smtc_screen_info;
 * Private structure
 */
 struct smtcfb_info {
-	struct fb_info fb;
 	struct pci_dev *pdev;
+	struct fb_info fb;
 	u16 chip_id;
 	u8  chip_rev_id;
 
@@ -328,9 +328,11 @@ static int smtc_blank(int blank_mode, struct fb_info *info)
 static int smtc_setcolreg(unsigned regno, unsigned red, unsigned green,
 			  unsigned blue, unsigned trans, struct fb_info *info)
 {
-	struct smtcfb_info *sfb = (struct smtcfb_info *)info;
+	struct smtcfb_info *sfb;
 	u32 val;
 
+	sfb = info->par;
+
 	if (regno > 255)
 		return 1;
 
@@ -623,9 +625,7 @@ static int smtc_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 
 static int smtc_set_par(struct fb_info *info)
 {
-	struct smtcfb_info *sfb = (struct smtcfb_info *)info;
-
-	smtcfb_setmode(sfb);
+	smtcfb_setmode(info->par);
 
 	return 0;
 }
-- 
1.7.10


  parent reply	other threads:[~2012-06-27 12:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-27 12:10 [PATCH 0/2] staging: sm7xxfb: code improvements and cleanup Javier M. Mellid
2012-06-27 12:10 ` [PATCH 1/2] staging: sm7xxfb: rename vars holding device and revision ids Javier M. Mellid
2012-06-27 12:10 ` Javier M. Mellid [this message]
2012-07-06 23:08   ` [PATCH 2/2] staging: sm7xxfb: erase hardcode cast between smtcfb_info and fb_info Greg KH

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=1340799015-3138-3-git-send-email-jmunhoz@igalia.com \
    --to=jmunhoz@igalia.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gewang@siliconmotion.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®