@@ -963,15 +963,12 @@ int fb_mode_is_equal(const struct fb_videomode *mode1,
963
963
const struct fb_videomode * fb_find_best_mode (const struct fb_var_screeninfo * var ,
964
964
struct list_head * head )
965
965
{
966
- struct list_head * pos ;
967
966
struct fb_modelist * modelist ;
968
967
struct fb_videomode * mode , * best = NULL ;
969
968
u32 diff = -1 ;
970
969
971
- list_for_each ( pos , head ) {
970
+ list_for_each_entry ( modelist , head , list ) {
972
971
u32 d ;
973
-
974
- modelist = list_entry (pos , struct fb_modelist , list );
975
972
mode = & modelist -> mode ;
976
973
977
974
if (mode -> xres >= var -> xres && mode -> yres >= var -> yres ) {
@@ -1001,15 +998,12 @@ const struct fb_videomode *fb_find_best_mode(const struct fb_var_screeninfo *var
1001
998
const struct fb_videomode * fb_find_nearest_mode (const struct fb_videomode * mode ,
1002
999
struct list_head * head )
1003
1000
{
1004
- struct list_head * pos ;
1005
1001
struct fb_modelist * modelist ;
1006
1002
struct fb_videomode * cmode , * best = NULL ;
1007
1003
u32 diff = -1 , diff_refresh = -1 ;
1008
1004
1009
- list_for_each ( pos , head ) {
1005
+ list_for_each_entry ( modelist , head , list ) {
1010
1006
u32 d ;
1011
-
1012
- modelist = list_entry (pos , struct fb_modelist , list );
1013
1007
cmode = & modelist -> mode ;
1014
1008
1015
1009
d = abs (cmode -> xres - mode -> xres ) +
@@ -1041,13 +1035,11 @@ const struct fb_videomode *fb_find_nearest_mode(const struct fb_videomode *mode,
1041
1035
const struct fb_videomode * fb_match_mode (const struct fb_var_screeninfo * var ,
1042
1036
struct list_head * head )
1043
1037
{
1044
- struct list_head * pos ;
1045
1038
struct fb_modelist * modelist ;
1046
1039
struct fb_videomode * m , mode ;
1047
1040
1048
1041
fb_var_to_videomode (& mode , var );
1049
- list_for_each (pos , head ) {
1050
- modelist = list_entry (pos , struct fb_modelist , list );
1042
+ list_for_each_entry (modelist , head , list ) {
1051
1043
m = & modelist -> mode ;
1052
1044
if (fb_mode_is_equal (m , & mode ))
1053
1045
return m ;
@@ -1065,13 +1057,11 @@ const struct fb_videomode *fb_match_mode(const struct fb_var_screeninfo *var,
1065
1057
*/
1066
1058
int fb_add_videomode (const struct fb_videomode * mode , struct list_head * head )
1067
1059
{
1068
- struct list_head * pos ;
1069
1060
struct fb_modelist * modelist ;
1070
1061
struct fb_videomode * m ;
1071
1062
int found = 0 ;
1072
1063
1073
- list_for_each (pos , head ) {
1074
- modelist = list_entry (pos , struct fb_modelist , list );
1064
+ list_for_each_entry (modelist , head , list ) {
1075
1065
m = & modelist -> mode ;
1076
1066
if (fb_mode_is_equal (m , mode )) {
1077
1067
found = 1 ;
@@ -1152,7 +1142,6 @@ void fb_videomode_to_modelist(const struct fb_videomode *modedb, int num,
1152
1142
const struct fb_videomode * fb_find_best_display (const struct fb_monspecs * specs ,
1153
1143
struct list_head * head )
1154
1144
{
1155
- struct list_head * pos ;
1156
1145
struct fb_modelist * modelist ;
1157
1146
const struct fb_videomode * m , * m1 = NULL , * md = NULL , * best = NULL ;
1158
1147
int first = 0 ;
@@ -1161,8 +1150,7 @@ const struct fb_videomode *fb_find_best_display(const struct fb_monspecs *specs,
1161
1150
goto finished ;
1162
1151
1163
1152
/* get the first detailed mode and the very first mode */
1164
- list_for_each (pos , head ) {
1165
- modelist = list_entry (pos , struct fb_modelist , list );
1153
+ list_for_each_entry (modelist , head , list ) {
1166
1154
m = & modelist -> mode ;
1167
1155
1168
1156
if (!first ) {
0 commit comments