diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-10 00:51:32 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-10 00:51:32 +0200 |
commit | 5f097cd249f00683442c3e265d6f27d80fc83563 (patch) | |
tree | 6b354913fcb2a099aa26e017895e1e6fdf6385e2 /drivers/video/of_display_timing.c | |
parent | Merge branch 'akpm' (updates from Andrew Morton) (diff) | |
parent | video: imxfb: Add DT support (diff) | |
download | linux-5f097cd249f00683442c3e265d6f27d80fc83563.tar.xz linux-5f097cd249f00683442c3e265d6f27d80fc83563.zip |
Merge tag 'fbdev-for-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/plagnioj/linux-fbdev
Pull fbdev update from Jean-Christophe PLAGNIOL-VILLARD:
"Various fbdev changes for 3.11
- xilinxfb updates
- Small cleanups and fixes to multiple drivers
- OMAP display subsystem bug updates
- imxfb dt support"
* tag 'fbdev-for-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/plagnioj/linux-fbdev: (95 commits)
video: imxfb: Add DT support
video: i740fb: Make i740fb_init static
fb: make fp_get_options name argument const
video: mmp: fix graphics/video layer enable/mask swap issue
video: mmp: fix memcpy wrong size for mmp_addr issue
radeon: use pdev->pm_cap instead of pci_find_capability(..,PCI_CAP_ID_PM)
aty128fb: use pdev->pm_cap instead of pci_find_capability(..,PCI_CAP_ID_PM)
video: of_display_timing.h: Declare 'display_timing'
fbdev: bfin-lq035q1-fb: Use dev_pm_ops
fbmem: return -EFAULT on copy_to_user() failure
OMAPDSS: DPI: Fix wrong pixel clock limit
video: replace strict_strtoul() with kstrtoul()
uvesafb: Correct/simplify warning message
fb: fix atyfb unused data warnings
fb: fix atyfb build warning
video: imxfb: Make local symbols static
video: udlfb: Make local symbol static
video: udlfb: Use NULL instead of 0
video: smscufx: Use NULL instead of 0
video: remove unnecessary platform_set_drvdata()
...
Diffstat (limited to 'drivers/video/of_display_timing.c')
-rw-r--r-- | drivers/video/of_display_timing.c | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c index 56009bc02b02..9c0f17b2e6fb 100644 --- a/drivers/video/of_display_timing.c +++ b/drivers/video/of_display_timing.c @@ -53,21 +53,16 @@ static int parse_timing_property(struct device_node *np, const char *name, } /** - * of_get_display_timing - parse display_timing entry from device_node + * of_parse_display_timing - parse display_timing entry from device_node * @np: device_node with the properties **/ -static struct display_timing *of_get_display_timing(struct device_node *np) +static int of_parse_display_timing(struct device_node *np, + struct display_timing *dt) { - struct display_timing *dt; u32 val = 0; int ret = 0; - dt = kzalloc(sizeof(*dt), GFP_KERNEL); - if (!dt) { - pr_err("%s: could not allocate display_timing struct\n", - of_node_full_name(np)); - return NULL; - } + memset(dt, 0, sizeof(*dt)); ret |= parse_timing_property(np, "hback-porch", &dt->hback_porch); ret |= parse_timing_property(np, "hfront-porch", &dt->hfront_porch); @@ -101,12 +96,38 @@ static struct display_timing *of_get_display_timing(struct device_node *np) if (ret) { pr_err("%s: error reading timing properties\n", of_node_full_name(np)); - kfree(dt); - return NULL; + return -EINVAL; + } + + return 0; +} + +/** + * of_get_display_timing - parse a display_timing entry + * @np: device_node with the timing subnode + * @name: name of the timing node + * @dt: display_timing struct to fill + **/ +int of_get_display_timing(struct device_node *np, const char *name, + struct display_timing *dt) +{ + struct device_node *timing_np; + + if (!np) { + pr_err("%s: no devicenode given\n", of_node_full_name(np)); + return -EINVAL; } - return dt; + timing_np = of_find_node_by_name(np, name); + if (!timing_np) { + pr_err("%s: could not find node '%s'\n", + of_node_full_name(np), name); + return -ENOENT; + } + + return of_parse_display_timing(timing_np, dt); } +EXPORT_SYMBOL_GPL(of_get_display_timing); /** * of_get_display_timings - parse all display_timing entries from a device_node @@ -174,9 +195,17 @@ struct display_timings *of_get_display_timings(struct device_node *np) for_each_child_of_node(timings_np, entry) { struct display_timing *dt; + int r; - dt = of_get_display_timing(entry); + dt = kzalloc(sizeof(*dt), GFP_KERNEL); if (!dt) { + pr_err("%s: could not allocate display_timing struct\n", + of_node_full_name(np)); + goto timingfail; + } + + r = of_parse_display_timing(entry, dt); + if (r) { /* * to not encourage wrong devicetrees, fail in case of * an error |