From: Fabian Frederick <fabf@skynet.be>
To: linux-kernel@vger.kernel.org
Cc: daniel.vetter@intel.com, Fabian Frederick <fabf@skynet.be>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
Tomi Valkeinen <tomi.valkeinen@ti.com>,
linux-fbdev@vger.kernel.org
Subject: [PATCH 3/6] video: fbdev: controlfb.c: use container_of to resolve fb_info_control from fb_info
Date: Wed, 17 Sep 2014 19:00:16 +0000 [thread overview]
Message-ID: <1410980419-5326-4-git-send-email-fabf@skynet.be> (raw)
In-Reply-To: <1410980419-5326-1-git-send-email-fabf@skynet.be>
Use container_of instead of casting first structure member.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
PPC32 cross-compiled but untested.
drivers/video/fbdev/controlfb.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c
index fdadef9..080fdd2 100644
--- a/drivers/video/fbdev/controlfb.c
+++ b/drivers/video/fbdev/controlfb.c
@@ -218,7 +218,8 @@ static int controlfb_check_var (struct fb_var_screeninfo *var, struct fb_info *i
*/
static int controlfb_set_par (struct fb_info *info)
{
- struct fb_info_control *p = (struct fb_info_control *) info;
+ struct fb_info_control *p + container_of(info, struct fb_info_control, info);
struct fb_par_control par;
int err;
@@ -258,7 +259,8 @@ static int controlfb_pan_display(struct fb_var_screeninfo *var,
struct fb_info *info)
{
unsigned int xoffset, hstep;
- struct fb_info_control *p = (struct fb_info_control *)info;
+ struct fb_info_control *p + container_of(info, struct fb_info_control, info);
struct fb_par_control *par = &p->par;
/*
@@ -309,7 +311,8 @@ static int controlfb_mmap(struct fb_info *info,
static int controlfb_blank(int blank_mode, struct fb_info *info)
{
- struct fb_info_control *p = (struct fb_info_control *) info;
+ struct fb_info_control *p + container_of(info, struct fb_info_control, info);
unsigned ctrl;
ctrl = ld_le32(CNTRL_REG(p,ctrl));
@@ -342,7 +345,8 @@ static int controlfb_blank(int blank_mode, struct fb_info *info)
static int controlfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *info)
{
- struct fb_info_control *p = (struct fb_info_control *) info;
+ struct fb_info_control *p + container_of(info, struct fb_info_control, info);
__u8 r, g, b;
if (regno > 255)
@@ -833,7 +837,8 @@ static int control_var_to_par(struct fb_var_screeninfo *var,
unsigned hperiod, hssync, hsblank, hesync, heblank, piped, heq, hlfln,
hserr, vperiod, vssync, vesync, veblank, vsblank, vswin, vewin;
unsigned long pixclock;
- struct fb_info_control *p = (struct fb_info_control *) fb_info;
+ struct fb_info_control *p + container_of(fb_info, struct fb_info_control, info);
struct control_regvals *r = &par->regvals;
switch (var->bits_per_pixel) {
--
2.1.0
next prev parent reply other threads:[~2014-09-17 19:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-17 19:00 [PATCH 0/6] video: fbdev: use container_of where possible Fabian Frederick
2014-09-17 19:00 ` [PATCH 1/6] video: fbdev: stifb.c: use container_of to resolve stifb_info from fb_info Fabian Frederick
2014-09-30 10:08 ` Tomi Valkeinen
2014-09-17 19:00 ` [PATCH 2/6] video: fbdev: sa1100fb.c: use container_of to resolve sa1100fb_info " Fabian Frederick
2014-09-17 19:00 ` Fabian Frederick [this message]
2014-09-17 19:00 ` [PATCH 4/6] video: fbdev: cyber2000fb.c: use container_of to resolve cfb_info " Fabian Frederick
2014-09-17 19:00 ` [PATCH 5/6] video: fbdev: pxafb.c: use container_of to resolve pxafb_info/layer " Fabian Frederick
2014-09-17 19:00 ` [PATCH 6/6] video: fbdev: valkyriefb.c: use container_of to resolve fb_info_valkyrie " Fabian Frederick
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=1410980419-5326-4-git-send-email-fabf@skynet.be \
--to=fabf@skynet.be \
--cc=daniel.vetter@intel.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=plagnioj@jcrosoft.com \
--cc=tomi.valkeinen@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).