Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

videomode: remove timing_entry_index

Display timing's fields have minimum, typical and maximum values. These
can be accessed by using timing_entry_index enum, and
display_timing_get_value() function.

There's no real need for this extra complexity. The values can be
accessed more easily by just using the min/typ/max fields.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>

+9 -34
+9 -9
drivers/video/videomode.c
··· 20 20 if (!dt) 21 21 return -EINVAL; 22 22 23 - vm->pixelclock = display_timing_get_value(&dt->pixelclock, TE_TYP); 24 - vm->hactive = display_timing_get_value(&dt->hactive, TE_TYP); 25 - vm->hfront_porch = display_timing_get_value(&dt->hfront_porch, TE_TYP); 26 - vm->hback_porch = display_timing_get_value(&dt->hback_porch, TE_TYP); 27 - vm->hsync_len = display_timing_get_value(&dt->hsync_len, TE_TYP); 23 + vm->pixelclock = dt->pixelclock.typ; 24 + vm->hactive = dt->hactive.typ; 25 + vm->hfront_porch = dt->hfront_porch.typ; 26 + vm->hback_porch = dt->hback_porch.typ; 27 + vm->hsync_len = dt->hsync_len.typ; 28 28 29 - vm->vactive = display_timing_get_value(&dt->vactive, TE_TYP); 30 - vm->vfront_porch = display_timing_get_value(&dt->vfront_porch, TE_TYP); 31 - vm->vback_porch = display_timing_get_value(&dt->vback_porch, TE_TYP); 32 - vm->vsync_len = display_timing_get_value(&dt->vsync_len, TE_TYP); 29 + vm->vactive = dt->vactive.typ; 30 + vm->vfront_porch = dt->vfront_porch.typ; 31 + vm->vback_porch = dt->vback_porch.typ; 32 + vm->vsync_len = dt->vsync_len.typ; 33 33 34 34 vm->flags = dt->flags; 35 35
-25
include/video/display_timing.h
··· 39 39 u32 max; 40 40 }; 41 41 42 - enum timing_entry_index { 43 - TE_MIN = 0, 44 - TE_TYP = 1, 45 - TE_MAX = 2, 46 - }; 47 - 48 42 /* 49 43 * Single "mode" entry. This describes one set of signal timings a display can 50 44 * have in one setting. This struct can later be converted to struct videomode ··· 84 90 85 91 struct display_timing **timings; 86 92 }; 87 - 88 - /* get value specified by index from struct timing_entry */ 89 - static inline u32 display_timing_get_value(const struct timing_entry *te, 90 - enum timing_entry_index index) 91 - { 92 - switch (index) { 93 - case TE_MIN: 94 - return te->min; 95 - break; 96 - case TE_TYP: 97 - return te->typ; 98 - break; 99 - case TE_MAX: 100 - return te->max; 101 - break; 102 - default: 103 - return te->typ; 104 - } 105 - } 106 93 107 94 /* get one entry from struct display_timings */ 108 95 static inline struct display_timing *display_timings_get(const struct