@@ -963,15 +963,12 @@ int fb_mode_is_equal(const struct fb_videomode *mode1,
963963const struct fb_videomode * fb_find_best_mode (const struct fb_var_screeninfo * var ,
964964 struct list_head * head )
965965{
966- struct list_head * pos ;
967966 struct fb_modelist * modelist ;
968967 struct fb_videomode * mode , * best = NULL ;
969968 u32 diff = -1 ;
970969
971- list_for_each ( pos , head ) {
970+ list_for_each_entry ( modelist , head , list ) {
972971 u32 d ;
973-
974- modelist = list_entry (pos , struct fb_modelist , list );
975972 mode = & modelist -> mode ;
976973
977974 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
1001998const struct fb_videomode * fb_find_nearest_mode (const struct fb_videomode * mode ,
1002999 struct list_head * head )
10031000{
1004- struct list_head * pos ;
10051001 struct fb_modelist * modelist ;
10061002 struct fb_videomode * cmode , * best = NULL ;
10071003 u32 diff = -1 , diff_refresh = -1 ;
10081004
1009- list_for_each ( pos , head ) {
1005+ list_for_each_entry ( modelist , head , list ) {
10101006 u32 d ;
1011-
1012- modelist = list_entry (pos , struct fb_modelist , list );
10131007 cmode = & modelist -> mode ;
10141008
10151009 d = abs (cmode -> xres - mode -> xres ) +
@@ -1041,13 +1035,11 @@ const struct fb_videomode *fb_find_nearest_mode(const struct fb_videomode *mode,
10411035const struct fb_videomode * fb_match_mode (const struct fb_var_screeninfo * var ,
10421036 struct list_head * head )
10431037{
1044- struct list_head * pos ;
10451038 struct fb_modelist * modelist ;
10461039 struct fb_videomode * m , mode ;
10471040
10481041 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 ) {
10511043 m = & modelist -> mode ;
10521044 if (fb_mode_is_equal (m , & mode ))
10531045 return m ;
@@ -1065,13 +1057,11 @@ const struct fb_videomode *fb_match_mode(const struct fb_var_screeninfo *var,
10651057 */
10661058int fb_add_videomode (const struct fb_videomode * mode , struct list_head * head )
10671059{
1068- struct list_head * pos ;
10691060 struct fb_modelist * modelist ;
10701061 struct fb_videomode * m ;
10711062 int found = 0 ;
10721063
1073- list_for_each (pos , head ) {
1074- modelist = list_entry (pos , struct fb_modelist , list );
1064+ list_for_each_entry (modelist , head , list ) {
10751065 m = & modelist -> mode ;
10761066 if (fb_mode_is_equal (m , mode )) {
10771067 found = 1 ;
@@ -1152,7 +1142,6 @@ void fb_videomode_to_modelist(const struct fb_videomode *modedb, int num,
11521142const struct fb_videomode * fb_find_best_display (const struct fb_monspecs * specs ,
11531143 struct list_head * head )
11541144{
1155- struct list_head * pos ;
11561145 struct fb_modelist * modelist ;
11571146 const struct fb_videomode * m , * m1 = NULL , * md = NULL , * best = NULL ;
11581147 int first = 0 ;
@@ -1161,8 +1150,7 @@ const struct fb_videomode *fb_find_best_display(const struct fb_monspecs *specs,
11611150 goto finished ;
11621151
11631152 /* 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 ) {
11661154 m = & modelist -> mode ;
11671155
11681156 if (!first ) {
0 commit comments