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

drm: remove drm_fb_helper_modinit

drm_fb_helper_modinit has a lot of boilerplate for what is not very
simple functionality. Just open code it in the only caller using
IS_ENABLED and IS_MODULE, and skip the find_module check as a
request_module is harmless if the module is already loaded (and not
other caller has this find_module check either).

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jessica Yu <jeyu@kernel.org>

authored by

Christoph Hellwig and committed by
Jessica Yu
bf22c9ec 8b1b4ecc

+11 -43
-10
drivers/gpu/drm/drm_crtc_helper_internal.h
··· 32 32 #include <drm/drm_encoder.h> 33 33 #include <drm/drm_modes.h> 34 34 35 - /* drm_fb_helper.c */ 36 - #ifdef CONFIG_DRM_FBDEV_EMULATION 37 - int drm_fb_helper_modinit(void); 38 - #else 39 - static inline int drm_fb_helper_modinit(void) 40 - { 41 - return 0; 42 - } 43 - #endif 44 - 45 35 /* drm_dp_aux_dev.c */ 46 36 #ifdef CONFIG_DRM_DP_AUX_CHARDEV 47 37 int drm_dp_aux_dev_init(void);
-21
drivers/gpu/drm/drm_fb_helper.c
··· 2499 2499 drm_client_register(&fb_helper->client); 2500 2500 } 2501 2501 EXPORT_SYMBOL(drm_fbdev_generic_setup); 2502 - 2503 - /* The Kconfig DRM_KMS_HELPER selects FRAMEBUFFER_CONSOLE (if !EXPERT) 2504 - * but the module doesn't depend on any fb console symbols. At least 2505 - * attempt to load fbcon to avoid leaving the system without a usable console. 2506 - */ 2507 - int __init drm_fb_helper_modinit(void) 2508 - { 2509 - #if defined(CONFIG_FRAMEBUFFER_CONSOLE_MODULE) && !defined(CONFIG_EXPERT) 2510 - const char name[] = "fbcon"; 2511 - struct module *fbcon; 2512 - 2513 - mutex_lock(&module_mutex); 2514 - fbcon = find_module(name); 2515 - mutex_unlock(&module_mutex); 2516 - 2517 - if (!fbcon) 2518 - request_module_nowait(name); 2519 - #endif 2520 - return 0; 2521 - } 2522 - EXPORT_SYMBOL(drm_fb_helper_modinit);
+11 -12
drivers/gpu/drm/drm_kms_helper_common.c
··· 64 64 65 65 static int __init drm_kms_helper_init(void) 66 66 { 67 - int ret; 67 + /* 68 + * The Kconfig DRM_KMS_HELPER selects FRAMEBUFFER_CONSOLE (if !EXPERT) 69 + * but the module doesn't depend on any fb console symbols. At least 70 + * attempt to load fbcon to avoid leaving the system without a usable 71 + * console. 72 + */ 73 + if (IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION) && 74 + IS_MODULE(CONFIG_FRAMEBUFFER_CONSOLE) && 75 + !IS_ENABLED(CONFIG_EXPERT)) 76 + request_module_nowait("fbcon"); 68 77 69 - /* Call init functions from specific kms helpers here */ 70 - ret = drm_fb_helper_modinit(); 71 - if (ret < 0) 72 - goto out; 73 - 74 - ret = drm_dp_aux_dev_init(); 75 - if (ret < 0) 76 - goto out; 77 - 78 - out: 79 - return ret; 78 + return drm_dp_aux_dev_init(); 80 79 } 81 80 82 81 static void __exit drm_kms_helper_exit(void)