Skip to content

Commit 8f47efd

Browse files
committed
drm/panel: Fix build error on !CONFIG_OF
Move helpers outside of CONFIG_OF, so basic allocation also works without it. Fixes: ed9c594 ("drm/panel: Add new helpers for refcounted panel allocatons") Fixes: dcba396 ("drm/panel: Add refcount support") Reviewed-by: Maxime Ripard <[email protected]> Link: https://lore.kernel.org/r/nyrjnvctqnk6f3x5q7rlmy5nb7iopoti56pgh43zqknici5ms4@cibpldh7epra Signed-off-by: Lucas De Marchi <[email protected]>
1 parent 6c3c8b3 commit 8f47efd

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

drivers/gpu/drm/drm_panel.c

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -318,44 +318,6 @@ int drm_panel_get_modes(struct drm_panel *panel,
318318
}
319319
EXPORT_SYMBOL(drm_panel_get_modes);
320320

321-
#ifdef CONFIG_OF
322-
/**
323-
* of_drm_find_panel - look up a panel using a device tree node
324-
* @np: device tree node of the panel
325-
*
326-
* Searches the set of registered panels for one that matches the given device
327-
* tree node. If a matching panel is found, return a pointer to it.
328-
*
329-
* Return: A pointer to the panel registered for the specified device tree
330-
* node or an ERR_PTR() if no panel matching the device tree node can be found.
331-
*
332-
* Possible error codes returned by this function:
333-
*
334-
* - EPROBE_DEFER: the panel device has not been probed yet, and the caller
335-
* should retry later
336-
* - ENODEV: the device is not available (status != "okay" or "ok")
337-
*/
338-
struct drm_panel *of_drm_find_panel(const struct device_node *np)
339-
{
340-
struct drm_panel *panel;
341-
342-
if (!of_device_is_available(np))
343-
return ERR_PTR(-ENODEV);
344-
345-
mutex_lock(&panel_lock);
346-
347-
list_for_each_entry(panel, &panel_list, list) {
348-
if (panel->dev->of_node == np) {
349-
mutex_unlock(&panel_lock);
350-
return panel;
351-
}
352-
}
353-
354-
mutex_unlock(&panel_lock);
355-
return ERR_PTR(-EPROBE_DEFER);
356-
}
357-
EXPORT_SYMBOL(of_drm_find_panel);
358-
359321
static void __drm_panel_free(struct kref *kref)
360322
{
361323
struct drm_panel *panel = container_of(kref, struct drm_panel, refcount);
@@ -443,6 +405,44 @@ void *__devm_drm_panel_alloc(struct device *dev, size_t size, size_t offset,
443405
}
444406
EXPORT_SYMBOL(__devm_drm_panel_alloc);
445407

408+
#ifdef CONFIG_OF
409+
/**
410+
* of_drm_find_panel - look up a panel using a device tree node
411+
* @np: device tree node of the panel
412+
*
413+
* Searches the set of registered panels for one that matches the given device
414+
* tree node. If a matching panel is found, return a pointer to it.
415+
*
416+
* Return: A pointer to the panel registered for the specified device tree
417+
* node or an ERR_PTR() if no panel matching the device tree node can be found.
418+
*
419+
* Possible error codes returned by this function:
420+
*
421+
* - EPROBE_DEFER: the panel device has not been probed yet, and the caller
422+
* should retry later
423+
* - ENODEV: the device is not available (status != "okay" or "ok")
424+
*/
425+
struct drm_panel *of_drm_find_panel(const struct device_node *np)
426+
{
427+
struct drm_panel *panel;
428+
429+
if (!of_device_is_available(np))
430+
return ERR_PTR(-ENODEV);
431+
432+
mutex_lock(&panel_lock);
433+
434+
list_for_each_entry(panel, &panel_list, list) {
435+
if (panel->dev->of_node == np) {
436+
mutex_unlock(&panel_lock);
437+
return panel;
438+
}
439+
}
440+
441+
mutex_unlock(&panel_lock);
442+
return ERR_PTR(-EPROBE_DEFER);
443+
}
444+
EXPORT_SYMBOL(of_drm_find_panel);
445+
446446
/**
447447
* of_drm_get_panel_orientation - look up the orientation of the panel through
448448
* the "rotation" binding from a device tree node

0 commit comments

Comments
 (0)