diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-07-30 03:59:16 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2014-03-19 05:03:05 -0400 |
commit | 4b13defce85d4e3cbd7ddfd701856a78772de373 (patch) | |
tree | 7b182100703e0d3c92606a298a89df8c166c5030 | |
parent | 3e22b355343d808bb09cc47b5ecb261af3b5753b (diff) |
OMAPFB: clean up default display search
Separate the code for finding the default display into a function for
clarity and to make it easier to extend it in the future.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Archit Taneja <archit@ti.com>
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb-main.c | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index fcb9e932d00c..b7469636f15c 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c | |||
@@ -2417,6 +2417,34 @@ static int omapfb_init_connections(struct omapfb2_device *fbdev, | |||
2417 | return 0; | 2417 | return 0; |
2418 | } | 2418 | } |
2419 | 2419 | ||
2420 | static struct omap_dss_device * | ||
2421 | omapfb_find_default_display(struct omapfb2_device *fbdev) | ||
2422 | { | ||
2423 | const char *def_name; | ||
2424 | int i; | ||
2425 | |||
2426 | /* search with the display name from the user or the board file */ | ||
2427 | |||
2428 | def_name = omapdss_get_default_display_name(); | ||
2429 | |||
2430 | if (def_name) { | ||
2431 | for (i = 0; i < fbdev->num_displays; ++i) { | ||
2432 | struct omap_dss_device *dssdev; | ||
2433 | |||
2434 | dssdev = fbdev->displays[i].dssdev; | ||
2435 | |||
2436 | if (dssdev->name && strcmp(def_name, dssdev->name) == 0) | ||
2437 | return dssdev; | ||
2438 | } | ||
2439 | |||
2440 | /* def_name given but not found */ | ||
2441 | return NULL; | ||
2442 | } | ||
2443 | |||
2444 | /* return the first display we have in the list */ | ||
2445 | return fbdev->displays[0].dssdev; | ||
2446 | } | ||
2447 | |||
2420 | static int omapfb_probe(struct platform_device *pdev) | 2448 | static int omapfb_probe(struct platform_device *pdev) |
2421 | { | 2449 | { |
2422 | struct omapfb2_device *fbdev = NULL; | 2450 | struct omapfb2_device *fbdev = NULL; |
@@ -2494,23 +2522,7 @@ static int omapfb_probe(struct platform_device *pdev) | |||
2494 | for (i = 0; i < fbdev->num_managers; i++) | 2522 | for (i = 0; i < fbdev->num_managers; i++) |
2495 | fbdev->managers[i] = omap_dss_get_overlay_manager(i); | 2523 | fbdev->managers[i] = omap_dss_get_overlay_manager(i); |
2496 | 2524 | ||
2497 | def_display = NULL; | 2525 | def_display = omapfb_find_default_display(fbdev); |
2498 | |||
2499 | for (i = 0; i < fbdev->num_displays; ++i) { | ||
2500 | struct omap_dss_device *dssdev; | ||
2501 | const char *def_name; | ||
2502 | |||
2503 | def_name = omapdss_get_default_display_name(); | ||
2504 | |||
2505 | dssdev = fbdev->displays[i].dssdev; | ||
2506 | |||
2507 | if (def_name == NULL || | ||
2508 | (dssdev->name && strcmp(def_name, dssdev->name) == 0)) { | ||
2509 | def_display = dssdev; | ||
2510 | break; | ||
2511 | } | ||
2512 | } | ||
2513 | |||
2514 | if (def_display == NULL) { | 2526 | if (def_display == NULL) { |
2515 | dev_err(fbdev->dev, "failed to find default display\n"); | 2527 | dev_err(fbdev->dev, "failed to find default display\n"); |
2516 | r = -EPROBE_DEFER; | 2528 | r = -EPROBE_DEFER; |