Skip to content

Commit 70412cf

Browse files
Rafael Antognollidanvet
authored andcommitted
drm/kms_helper: Add a common place to call init and exit functions.
The module_init and module_exit functions will start here, and call the subsequent init's and exit's. v10: - Keep __init on drm_fb_helper init function. - Move MODULE_* macros to the common file. Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1453417821-2811-2-git-send-email-rafael.antognolli@intel.com
1 parent 382ab95 commit 70412cf

File tree

5 files changed

+60
-9
lines changed

5 files changed

+60
-9
lines changed

drivers/gpu/drm/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ drm-$(CONFIG_OF) += drm_of.o
2222
drm-$(CONFIG_AGP) += drm_agpsupport.o
2323

2424
drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \
25-
drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o
25+
drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o \
26+
drm_kms_helper_common.o
27+
2628
drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
2729
drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o
2830
drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o

drivers/gpu/drm/drm_crtc_helper.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@
7373
* &drm_crtc_helper_funcs, struct &drm_encoder_helper_funcs and struct
7474
* &drm_connector_helper_funcs.
7575
*/
76-
MODULE_AUTHOR("David Airlie, Jesse Barnes");
77-
MODULE_DESCRIPTION("DRM KMS helper");
78-
MODULE_LICENSE("GPL and additional rights");
7976

8077
/**
8178
* drm_helper_move_panel_connectors_to_head() - move panels to the front in the

drivers/gpu/drm/drm_fb_helper.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2196,9 +2196,9 @@ EXPORT_SYMBOL(drm_fb_helper_hotplug_event);
21962196
* but the module doesn't depend on any fb console symbols. At least
21972197
* attempt to load fbcon to avoid leaving the system without a usable console.
21982198
*/
2199-
#if defined(CONFIG_FRAMEBUFFER_CONSOLE_MODULE) && !defined(CONFIG_EXPERT)
2200-
static int __init drm_fb_helper_modinit(void)
2199+
int __init drm_fb_helper_modinit(void)
22012200
{
2201+
#if defined(CONFIG_FRAMEBUFFER_CONSOLE_MODULE) && !defined(CONFIG_EXPERT)
22022202
const char *name = "fbcon";
22032203
struct module *fbcon;
22042204

@@ -2208,8 +2208,7 @@ static int __init drm_fb_helper_modinit(void)
22082208

22092209
if (!fbcon)
22102210
request_module_nowait(name);
2211+
#endif
22112212
return 0;
22122213
}
2213-
2214-
module_init(drm_fb_helper_modinit);
2215-
#endif
2214+
EXPORT_SYMBOL(drm_fb_helper_modinit);
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright © 2015 Intel Corporation
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a
5+
* copy of this software and associated documentation files (the "Software"),
6+
* to deal in the Software without restriction, including without limitation
7+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
* and/or sell copies of the Software, and to permit persons to whom the
9+
* Software is furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice (including the next
12+
* paragraph) shall be included in all copies or substantial portions of the
13+
* Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21+
* IN THE SOFTWARE.
22+
*
23+
* Authors:
24+
* Rafael Antognolli <rafael.antognolli@intel.com>
25+
*
26+
*/
27+
28+
#include <drm/drmP.h>
29+
#include <drm/drm_fb_helper.h>
30+
31+
MODULE_AUTHOR("David Airlie, Jesse Barnes");
32+
MODULE_DESCRIPTION("DRM KMS helper");
33+
MODULE_LICENSE("GPL and additional rights");
34+
35+
static int __init drm_kms_helper_init(void)
36+
{
37+
/* Call init functions from specific kms helpers here */
38+
return drm_fb_helper_modinit();
39+
}
40+
41+
static void __exit drm_kms_helper_exit(void)
42+
{
43+
/* Call exit functions from specific kms helpers here */
44+
}
45+
46+
module_init(drm_kms_helper_init);
47+
module_exit(drm_kms_helper_exit);

include/drm/drm_fb_helper.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ struct drm_fb_helper {
219219
};
220220

221221
#ifdef CONFIG_DRM_FBDEV_EMULATION
222+
int drm_fb_helper_modinit(void);
222223
void drm_fb_helper_prepare(struct drm_device *dev, struct drm_fb_helper *helper,
223224
const struct drm_fb_helper_funcs *funcs);
224225
int drm_fb_helper_init(struct drm_device *dev,
@@ -283,6 +284,11 @@ int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_
283284
int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper,
284285
struct drm_connector *connector);
285286
#else
287+
static inline int drm_fb_helper_modinit(void)
288+
{
289+
return 0;
290+
}
291+
286292
static inline void drm_fb_helper_prepare(struct drm_device *dev,
287293
struct drm_fb_helper *helper,
288294
const struct drm_fb_helper_funcs *funcs)

0 commit comments

Comments
 (0)