treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / video / videomode.c
blob2ecf80c082e4a90bf348378d37788dc7a9679608
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * generic display timing functions
5 * Copyright (c) 2012 Steffen Trumtrar <s.trumtrar@pengutronix.de>, Pengutronix
6 */
8 #include <linux/errno.h>
9 #include <linux/export.h>
10 #include <video/display_timing.h>
11 #include <video/videomode.h>
13 void videomode_from_timing(const struct display_timing *dt,
14 struct videomode *vm)
16 vm->pixelclock = dt->pixelclock.typ;
17 vm->hactive = dt->hactive.typ;
18 vm->hfront_porch = dt->hfront_porch.typ;
19 vm->hback_porch = dt->hback_porch.typ;
20 vm->hsync_len = dt->hsync_len.typ;
22 vm->vactive = dt->vactive.typ;
23 vm->vfront_porch = dt->vfront_porch.typ;
24 vm->vback_porch = dt->vback_porch.typ;
25 vm->vsync_len = dt->vsync_len.typ;
27 vm->flags = dt->flags;
29 EXPORT_SYMBOL_GPL(videomode_from_timing);
31 int videomode_from_timings(const struct display_timings *disp,
32 struct videomode *vm, unsigned int index)
34 struct display_timing *dt;
36 dt = display_timings_get(disp, index);
37 if (!dt)
38 return -EINVAL;
40 videomode_from_timing(dt, vm);
42 return 0;
44 EXPORT_SYMBOL_GPL(videomode_from_timings);