Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
76a21cfa
Commit
76a21cfa
authored
Aug 14, 2002
by
Petr Vandrovec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use container_of instead of simple typecast when we convert pointers from
pointer to fb_info to pointers to matrox_fb_info.
parent
d5f14f25
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
33 deletions
+31
-33
drivers/video/matrox/matroxfb_base.c
drivers/video/matrox/matroxfb_base.c
+14
-14
drivers/video/matrox/matroxfb_base.h
drivers/video/matrox/matroxfb_base.h
+1
-2
drivers/video/matrox/matroxfb_crtc2.c
drivers/video/matrox/matroxfb_crtc2.c
+15
-16
drivers/video/matrox/matroxfb_maven.c
drivers/video/matrox/matroxfb_maven.c
+1
-1
No files found.
drivers/video/matrox/matroxfb_base.c
View file @
76a21cfa
...
...
@@ -238,7 +238,7 @@ static void matroxfb_remove(WPMINFO int dummy) {
static
int
matroxfb_open
(
struct
fb_info
*
info
,
int
user
)
{
#define minfo (
(struct matrox_fb_info*)info
)
#define minfo (
container_of(info, struct matrox_fb_info, fbcon)
)
DBG_LOOP
(
"matroxfb_open"
)
if
(
ACCESS_FBINFO
(
dead
))
{
...
...
@@ -251,7 +251,7 @@ static int matroxfb_open(struct fb_info *info, int user)
static
int
matroxfb_release
(
struct
fb_info
*
info
,
int
user
)
{
#define minfo (
(struct matrox_fb_info*)info
)
#define minfo (
container_of(info, struct matrox_fb_info, fbcon)
)
DBG_LOOP
(
"matroxfb_release"
)
if
(
!
(
--
ACCESS_FBINFO
(
usecount
))
&&
ACCESS_FBINFO
(
dead
))
{
...
...
@@ -263,7 +263,7 @@ static int matroxfb_release(struct fb_info *info, int user)
static
int
matroxfb_pan_display
(
struct
fb_var_screeninfo
*
var
,
int
con
,
struct
fb_info
*
info
)
{
#define minfo (
(struct matrox_fb_info*)info
)
#define minfo (
container_of(info, struct matrox_fb_info, fbcon)
)
DBG
(
"matroxfb_pan_display"
)
...
...
@@ -289,7 +289,7 @@ static int matroxfb_pan_display(struct fb_var_screeninfo *var, int con,
static
int
matroxfb_updatevar
(
int
con
,
struct
fb_info
*
info
)
{
#define minfo (
(struct matrox_fb_info*)info
)
#define minfo (
container_of(info, struct matrox_fb_info, fbcon)
)
DBG
(
"matroxfb_updatevar"
);
matrox_pan_var
(
PMINFO
&
fb_display
[
con
].
var
);
...
...
@@ -566,7 +566,7 @@ static int matroxfb_setcolreg(unsigned regno, unsigned red, unsigned green,
{
struct
display
*
p
;
#ifdef CONFIG_FB_MATROX_MULTIHEAD
struct
matrox_fb_info
*
minfo
=
(
struct
matrox_fb_info
*
)
fb_info
;
struct
matrox_fb_info
*
minfo
=
container_of
(
fb_info
,
struct
matrox_fb_info
,
fbcon
)
;
#endif
DBG
(
"matroxfb_setcolreg"
)
...
...
@@ -650,7 +650,7 @@ static int matroxfb_get_fix(struct fb_fix_screeninfo *fix, int con,
struct
display
*
p
;
DBG
(
"matroxfb_get_fix"
)
#define minfo (
(struct matrox_fb_info*)info
)
#define minfo (
container_of(info, struct matrox_fb_info, fbcon)
)
if
(
ACCESS_FBINFO
(
dead
))
{
return
-
ENXIO
;
...
...
@@ -683,7 +683,7 @@ static int matroxfb_get_fix(struct fb_fix_screeninfo *fix, int con,
static
int
matroxfb_get_var
(
struct
fb_var_screeninfo
*
var
,
int
con
,
struct
fb_info
*
info
)
{
#define minfo (
(struct matrox_fb_info*)info
)
#define minfo (
container_of(info, struct matrox_fb_info, fbcon)
)
DBG
(
"matroxfb_get_var"
)
if
(
con
<
0
)
...
...
@@ -697,7 +697,7 @@ static int matroxfb_get_var(struct fb_var_screeninfo *var, int con,
static
int
matroxfb_set_var
(
struct
fb_var_screeninfo
*
var
,
int
con
,
struct
fb_info
*
info
)
{
#define minfo (
(struct matrox_fb_info*)info
)
#define minfo (
container_of(info, struct matrox_fb_info, fbcon)
)
int
err
;
int
visual
;
int
cmap_len
;
...
...
@@ -864,7 +864,7 @@ static int matrox_getcolreg(unsigned regno, unsigned *red, unsigned *green,
DBG
(
"matrox_getcolreg"
)
#define minfo (
(struct matrox_fb_info*)info
)
#define minfo (
container_of(info, struct matrox_fb_info, fbcon)
)
/*
* Read a single color register and split it into colors/transparent.
* Return != 0 for invalid regno.
...
...
@@ -884,7 +884,7 @@ static int matrox_getcolreg(unsigned regno, unsigned *red, unsigned *green,
static
int
matroxfb_get_cmap
(
struct
fb_cmap
*
cmap
,
int
kspc
,
int
con
,
struct
fb_info
*
info
)
{
#define minfo (
(struct matrox_fb_info*)info
)
#define minfo (
container_of(info, struct matrox_fb_info, fbcon)
)
struct
display
*
dsp
=
(
con
<
0
)
?
ACCESS_FBINFO
(
fbcon
.
disp
)
:
fb_display
+
con
;
...
...
@@ -910,7 +910,7 @@ static int matroxfb_set_cmap(struct fb_cmap *cmap, int kspc, int con,
{
unsigned
int
cmap_len
;
struct
display
*
dsp
=
(
con
<
0
)
?
info
->
disp
:
(
fb_display
+
con
);
#define minfo (
(struct matrox_fb_info*)info
)
#define minfo (
container_of(info, struct matrox_fb_info, fbcon)
)
DBG
(
"matroxfb_set_cmap"
)
...
...
@@ -965,7 +965,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file,
unsigned
int
cmd
,
unsigned
long
arg
,
int
con
,
struct
fb_info
*
info
)
{
#define minfo (
(struct matrox_fb_info*)info
)
#define minfo (
container_of(info, struct matrox_fb_info, fbcon)
)
DBG
(
"matroxfb_ioctl"
)
if
(
ACCESS_FBINFO
(
dead
))
{
...
...
@@ -1173,7 +1173,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file,
static
int
matroxfb_blank
(
int
blank
,
struct
fb_info
*
info
)
{
#define minfo (
(struct matrox_fb_info*)info
)
#define minfo (
container_of(info, struct matrox_fb_info, fbcon)
)
int
seq
;
int
crtc
;
CRITFLAGS
...
...
@@ -1220,7 +1220,7 @@ static struct fb_ops matroxfb_ops = {
int
matroxfb_switch
(
int
con
,
struct
fb_info
*
info
)
{
#define minfo (
(struct matrox_fb_info*)info
)
#define minfo (
container_of(info, struct matrox_fb_info, fbcon)
)
struct
fb_cmap
*
cmap
;
struct
display
*
p
;
...
...
drivers/video/matrox/matroxfb_base.h
View file @
76a21cfa
...
...
@@ -426,7 +426,6 @@ struct matroxfb_driver;
struct
matroxfb_dh_fb_info
;
struct
matrox_fb_info
{
/* fb_info must be first */
struct
fb_info
fbcon
;
struct
list_head
next_fb
;
...
...
@@ -622,7 +621,7 @@ struct matrox_fb_info {
#define PMINFO PMINFO2 ,
static
inline
struct
matrox_fb_info
*
mxinfo
(
const
struct
display
*
p
)
{
return
(
struct
matrox_fb_info
*
)
p
->
fb_info
;
return
container_of
(
p
->
fb_info
,
struct
matrox_fb_info
,
fbcon
)
;
}
#define PMXINFO(p) mxinfo(p),
...
...
drivers/video/matrox/matroxfb_crtc2.c
View file @
76a21cfa
...
...
@@ -28,7 +28,7 @@ MODULE_PARM_DESC(mem, "Memory size reserved for dualhead (default=8MB)");
static
int
matroxfb_dh_getcolreg
(
unsigned
regno
,
unsigned
*
red
,
unsigned
*
green
,
unsigned
*
blue
,
unsigned
*
transp
,
struct
fb_info
*
info
)
{
#define m2info (
(struct matroxfb_dh_fb_info*)info
)
#define m2info (
container_of(info, struct matroxfb_dh_fb_info, fbcon)
)
if
(
regno
>=
16
)
return
1
;
*
red
=
m2info
->
palette
[
regno
].
red
;
...
...
@@ -41,7 +41,7 @@ static int matroxfb_dh_getcolreg(unsigned regno, unsigned *red, unsigned *green,
static
int
matroxfb_dh_setcolreg
(
unsigned
regno
,
unsigned
red
,
unsigned
green
,
unsigned
blue
,
unsigned
transp
,
struct
fb_info
*
info
)
{
#define m2info (
(struct matroxfb_dh_fb_info*)info
)
#define m2info (
container_of(info, struct matroxfb_dh_fb_info, fbcon)
)
struct
display
*
p
;
if
(
regno
>=
16
)
...
...
@@ -185,8 +185,8 @@ static void matroxfb_dh_pan_var(struct matroxfb_dh_fb_info* m2info,
unsigned
int
pos
;
unsigned
int
linelen
;
unsigned
int
pixelsize
;
MINFO_FROM
(
m2info
->
primary_dev
);
#define minfo (m2info->primary_dev)
pixelsize
=
var
->
bits_per_pixel
>>
3
;
linelen
=
var
->
xres_virtual
*
pixelsize
;
pos
=
var
->
yoffset
*
linelen
+
var
->
xoffset
*
pixelsize
;
...
...
@@ -197,7 +197,6 @@ static void matroxfb_dh_pan_var(struct matroxfb_dh_fb_info* m2info,
}
else
{
mga_outl
(
0x3C28
,
pos
);
}
#undef minfo
}
static
int
matroxfb_dh_decode_var
(
struct
matroxfb_dh_fb_info
*
m2info
,
...
...
@@ -301,7 +300,7 @@ static void initMatroxDH(struct matroxfb_dh_fb_info* m2info, struct display* p)
}
static
int
matroxfb_dh_open
(
struct
fb_info
*
info
,
int
user
)
{
#define m2info (
(struct matroxfb_dh_fb_info*)info
)
#define m2info (
container_of(info, struct matroxfb_dh_fb_info, fbcon)
)
MINFO_FROM
(
m2info
->
primary_dev
);
if
(
MINFO
)
{
...
...
@@ -314,7 +313,7 @@ static int matroxfb_dh_open(struct fb_info* info, int user) {
}
static
int
matroxfb_dh_release
(
struct
fb_info
*
info
,
int
user
)
{
#define m2info (
(struct matroxfb_dh_fb_info*)info
)
#define m2info (
container_of(info, struct matroxfb_dh_fb_info, fbcon)
)
MINFO_FROM
(
m2info
->
primary_dev
);
if
(
MINFO
)
{
...
...
@@ -325,7 +324,7 @@ static int matroxfb_dh_release(struct fb_info* info, int user) {
static
int
matroxfb_dh_get_fix
(
struct
fb_fix_screeninfo
*
fix
,
int
con
,
struct
fb_info
*
info
)
{
#define m2info (
(struct matroxfb_dh_fb_info*)info
)
#define m2info (
container_of(info, struct matroxfb_dh_fb_info, fbcon)
)
struct
display
*
p
;
if
(
con
>=
0
)
...
...
@@ -354,7 +353,7 @@ static int matroxfb_dh_get_fix(struct fb_fix_screeninfo* fix, int con,
static
int
matroxfb_dh_get_var
(
struct
fb_var_screeninfo
*
var
,
int
con
,
struct
fb_info
*
info
)
{
#define m2info (
(struct matroxfb_dh_fb_info*)info
)
#define m2info (
container_of(info, struct matroxfb_dh_fb_info, fbcon)
)
if
(
con
<
0
)
*
var
=
m2info
->
fbcon
.
disp
->
var
;
else
...
...
@@ -365,7 +364,7 @@ static int matroxfb_dh_get_var(struct fb_var_screeninfo* var, int con,
static
int
matroxfb_dh_set_var
(
struct
fb_var_screeninfo
*
var
,
int
con
,
struct
fb_info
*
info
)
{
#define m2info (
(struct matroxfb_dh_fb_info*)info
)
#define m2info (
container_of(info, struct matroxfb_dh_fb_info, fbcon)
)
struct
display
*
p
;
int
chgvar
;
int
visual
;
...
...
@@ -464,7 +463,7 @@ static int matroxfb_dh_set_var(struct fb_var_screeninfo* var, int con,
static
int
matroxfb_dh_get_cmap
(
struct
fb_cmap
*
cmap
,
int
kspc
,
int
con
,
struct
fb_info
*
info
)
{
#define m2info (
(struct matroxfb_dh_fb_info*)info
)
#define m2info (
container_of(info, struct matroxfb_dh_fb_info, fbcon)
)
struct
display
*
dsp
;
if
(
con
<
0
)
...
...
@@ -483,7 +482,7 @@ static int matroxfb_dh_get_cmap(struct fb_cmap* cmap, int kspc, int con,
static
int
matroxfb_dh_set_cmap
(
struct
fb_cmap
*
cmap
,
int
kspc
,
int
con
,
struct
fb_info
*
info
)
{
#define m2info (
(struct matroxfb_dh_fb_info*)info
)
#define m2info (
container_of(info, struct matroxfb_dh_fb_info, fbcon)
)
struct
display
*
dsp
;
if
(
con
<
0
)
...
...
@@ -507,7 +506,7 @@ static int matroxfb_dh_set_cmap(struct fb_cmap* cmap, int kspc, int con,
static
int
matroxfb_dh_pan_display
(
struct
fb_var_screeninfo
*
var
,
int
con
,
struct
fb_info
*
info
)
{
#define m2info (
(struct matroxfb_dh_fb_info*)info
)
#define m2info (
container_of(info, struct matroxfb_dh_fb_info, fbcon)
)
if
(
var
->
xoffset
+
fb_display
[
con
].
var
.
xres
>
fb_display
[
con
].
var
.
xres_virtual
||
var
->
yoffset
+
fb_display
[
con
].
var
.
yres
>
fb_display
[
con
].
var
.
yres_virtual
)
return
-
EINVAL
;
...
...
@@ -540,7 +539,7 @@ static int matroxfb_dh_ioctl(struct inode* inode,
unsigned
long
arg
,
int
con
,
struct
fb_info
*
info
)
{
#define m2info (
(struct matroxfb_dh_fb_info*)info
)
#define m2info (
container_of(info, struct matroxfb_dh_fb_info, fbcon)
)
MINFO_FROM
(
m2info
->
primary_dev
);
DBG
(
"matroxfb_crtc2_ioctl"
)
...
...
@@ -655,7 +654,7 @@ static int matroxfb_dh_ioctl(struct inode* inode,
}
static
int
matroxfb_dh_blank
(
int
blank
,
struct
fb_info
*
info
)
{
#define m2info (
(struct matroxfb_dh_fb_info*)info
)
#define m2info (
container_of(info, struct matroxfb_dh_fb_info, fbcon)
)
switch
(
blank
)
{
case
1
:
case
2
:
...
...
@@ -684,7 +683,7 @@ static struct fb_ops matroxfb_dh_ops = {
};
static
int
matroxfb_dh_switch
(
int
con
,
struct
fb_info
*
info
)
{
#define m2info (
(struct matroxfb_dh_fb_info*)info
)
#define m2info (
container_of(info, struct matroxfb_dh_fb_info, fbcon)
)
struct
fb_cmap
*
cmap
;
struct
display
*
p
;
...
...
@@ -707,7 +706,7 @@ static int matroxfb_dh_switch(int con, struct fb_info* info) {
}
static
int
matroxfb_dh_updatevar
(
int
con
,
struct
fb_info
*
info
)
{
#define m2info (
(struct matroxfb_dh_fb_info*)info
)
#define m2info (
container_of(info, struct matroxfb_dh_fb_info, fbcon)
)
matroxfb_dh_pan_var
(
m2info
,
&
fb_display
[
con
].
var
);
return
0
;
#undef m2info
...
...
drivers/video/matrox/matroxfb_maven.c
View file @
76a21cfa
...
...
@@ -903,7 +903,7 @@ static struct matrox_altout maven_altout = {
static
int
maven_init_client
(
struct
i2c_client
*
clnt
)
{
struct
i2c_adapter
*
a
=
clnt
->
adapter
;
struct
maven_data
*
md
=
clnt
->
data
;
MINFO_FROM
(
((
struct
i2c_bit_adapter
*
)
a
)
->
minfo
);
MINFO_FROM
(
container_of
(
a
,
struct
i2c_bit_adapter
,
adapter
)
->
minfo
);
md
->
primary_head
=
MINFO
;
md
->
client
=
clnt
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment