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

drm/panel: Fix build error on !CONFIG_OF

Move helpers outside of CONFIG_OF, so basic allocation also works
without it.

Fixes: ed9c594d495d ("drm/panel: Add new helpers for refcounted panel allocatons")
Fixes: dcba396f6907 ("drm/panel: Add refcount support")
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/r/nyrjnvctqnk6f3x5q7rlmy5nb7iopoti56pgh43zqknici5ms4@cibpldh7epra
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>

+38 -38
+38 -38
drivers/gpu/drm/drm_panel.c
··· 318 318 } 319 319 EXPORT_SYMBOL(drm_panel_get_modes); 320 320 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 - 359 321 static void __drm_panel_free(struct kref *kref) 360 322 { 361 323 struct drm_panel *panel = container_of(kref, struct drm_panel, refcount); ··· 404 442 return container; 405 443 } 406 444 EXPORT_SYMBOL(__devm_drm_panel_alloc); 445 + 446 + #ifdef CONFIG_OF 447 + /** 448 + * of_drm_find_panel - look up a panel using a device tree node 449 + * @np: device tree node of the panel 450 + * 451 + * Searches the set of registered panels for one that matches the given device 452 + * tree node. If a matching panel is found, return a pointer to it. 453 + * 454 + * Return: A pointer to the panel registered for the specified device tree 455 + * node or an ERR_PTR() if no panel matching the device tree node can be found. 456 + * 457 + * Possible error codes returned by this function: 458 + * 459 + * - EPROBE_DEFER: the panel device has not been probed yet, and the caller 460 + * should retry later 461 + * - ENODEV: the device is not available (status != "okay" or "ok") 462 + */ 463 + struct drm_panel *of_drm_find_panel(const struct device_node *np) 464 + { 465 + struct drm_panel *panel; 466 + 467 + if (!of_device_is_available(np)) 468 + return ERR_PTR(-ENODEV); 469 + 470 + mutex_lock(&panel_lock); 471 + 472 + list_for_each_entry(panel, &panel_list, list) { 473 + if (panel->dev->of_node == np) { 474 + mutex_unlock(&panel_lock); 475 + return panel; 476 + } 477 + } 478 + 479 + mutex_unlock(&panel_lock); 480 + return ERR_PTR(-EPROBE_DEFER); 481 + } 482 + EXPORT_SYMBOL(of_drm_find_panel); 407 483 408 484 /** 409 485 * of_drm_get_panel_orientation - look up the orientation of the panel through