diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-08-10 12:52:34 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-08-12 04:41:18 -0400 |
commit | 44adece57e2604cec8527a499b48e4d584ab53b8 (patch) | |
tree | d8d9bb2e27c2a8b4da7575ed540b067ca014c62c | |
parent | e24165537312723e2900831dd6e7415b8d85278c (diff) |
drm/fb-helper: Add a dummy remove_conflicting_framebuffers
Lots of drivers don't properly compile without this when CONFIG_FB=n.
It's kinda a hack, but since CONFIG_FB doesn't stub any fucntions when
it's disabled I think it makes sense to add it to drm_fb_helper.h.
Long term we probably need to rethink all the logic to unload firmware
framebuffer drivers, at least if we want to be able to move away from
CONFIG_FB and fbcon.
v2: Unfortunately just stubbing out remove_conflicting_framebuffers in
drm_fb_helper.h upset gcc about static vs. non-static declarations, so
a new wrapper it needs to be. Means more churn :(
Cc: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Cc: Noralf Trønnes <noralf@tronnes.org>
Cc: tomi.valkeinen@ti.com
Cc: dh.herrmann@gmail.com
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1470847958-28465-2-git-send-email-daniel.vetter@ffwll.ch
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/bochs/bochs_drv.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/cirrus/cirrus_drv.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_drv.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_main.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drm.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_drv.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/sun4i/sun4i_drv.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/vc4/vc4_drv.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 3 | ||||
-rw-r--r-- | include/drm/drm_fb_helper.h | 14 |
12 files changed, 30 insertions, 11 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 9aa533cf4ad1..11263c5b9967 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | |||
@@ -341,7 +341,7 @@ static int amdgpu_kick_out_firmware_fb(struct pci_dev *pdev) | |||
341 | #ifdef CONFIG_X86 | 341 | #ifdef CONFIG_X86 |
342 | primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; | 342 | primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; |
343 | #endif | 343 | #endif |
344 | remove_conflicting_framebuffers(ap, "amdgpudrmfb", primary); | 344 | drm_fb_helper_remove_conflicting_framebuffers(ap, "amdgpudrmfb", primary); |
345 | kfree(ap); | 345 | kfree(ap); |
346 | 346 | ||
347 | return 0; | 347 | return 0; |
diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c index abace82de6ea..277654abe0f7 100644 --- a/drivers/gpu/drm/bochs/bochs_drv.c +++ b/drivers/gpu/drm/bochs/bochs_drv.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/mm.h> | 8 | #include <linux/mm.h> |
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
11 | #include <drm/drm_fb_helper.h> | ||
11 | 12 | ||
12 | #include "bochs.h" | 13 | #include "bochs.h" |
13 | 14 | ||
@@ -153,7 +154,7 @@ static int bochs_kick_out_firmware_fb(struct pci_dev *pdev) | |||
153 | 154 | ||
154 | ap->ranges[0].base = pci_resource_start(pdev, 0); | 155 | ap->ranges[0].base = pci_resource_start(pdev, 0); |
155 | ap->ranges[0].size = pci_resource_len(pdev, 0); | 156 | ap->ranges[0].size = pci_resource_len(pdev, 0); |
156 | remove_conflicting_framebuffers(ap, "bochsdrmfb", false); | 157 | drm_fb_helper_remove_conflicting_framebuffers(ap, "bochsdrmfb", false); |
157 | kfree(ap); | 158 | kfree(ap); |
158 | 159 | ||
159 | return 0; | 160 | return 0; |
diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c index b05f7eae32ce..6c76d125995b 100644 --- a/drivers/gpu/drm/cirrus/cirrus_drv.c +++ b/drivers/gpu/drm/cirrus/cirrus_drv.c | |||
@@ -57,7 +57,7 @@ static int cirrus_kick_out_firmware_fb(struct pci_dev *pdev) | |||
57 | #ifdef CONFIG_X86 | 57 | #ifdef CONFIG_X86 |
58 | primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; | 58 | primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; |
59 | #endif | 59 | #endif |
60 | remove_conflicting_framebuffers(ap, "cirrusdrmfb", primary); | 60 | drm_fb_helper_remove_conflicting_framebuffers(ap, "cirrusdrmfb", primary); |
61 | kfree(ap); | 61 | kfree(ap); |
62 | 62 | ||
63 | return 0; | 63 | return 0; |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 95ddd56b89f0..40cd16cf9772 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -706,7 +706,7 @@ static int i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv) | |||
706 | primary = | 706 | primary = |
707 | pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; | 707 | pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; |
708 | 708 | ||
709 | ret = remove_conflicting_framebuffers(ap, "inteldrmfb", primary); | 709 | ret = drm_fb_helper_remove_conflicting_framebuffers(ap, "inteldrmfb", primary); |
710 | 710 | ||
711 | kfree(ap); | 711 | kfree(ap); |
712 | 712 | ||
diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index 2b4b125eebc3..1443b3a34775 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c | |||
@@ -56,7 +56,7 @@ static void mgag200_kick_out_firmware_fb(struct pci_dev *pdev) | |||
56 | #ifdef CONFIG_X86 | 56 | #ifdef CONFIG_X86 |
57 | primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; | 57 | primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; |
58 | #endif | 58 | #endif |
59 | remove_conflicting_framebuffers(ap, "mgag200drmfb", primary); | 59 | drm_fb_helper_remove_conflicting_framebuffers(ap, "mgag200drmfb", primary); |
60 | kfree(ap); | 60 | kfree(ap); |
61 | } | 61 | } |
62 | 62 | ||
diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c index 13798b3e6beb..e79cbc25ae3c 100644 --- a/drivers/gpu/drm/mgag200/mgag200_main.c +++ b/drivers/gpu/drm/mgag200/mgag200_main.c | |||
@@ -135,7 +135,7 @@ static int mga_vram_init(struct mga_device *mdev) | |||
135 | aper->ranges[0].base = mdev->mc.vram_base; | 135 | aper->ranges[0].base = mdev->mc.vram_base; |
136 | aper->ranges[0].size = mdev->mc.vram_window; | 136 | aper->ranges[0].size = mdev->mc.vram_window; |
137 | 137 | ||
138 | remove_conflicting_framebuffers(aper, "mgafb", true); | 138 | drm_fb_helper_remove_conflicting_framebuffers(aper, "mgafb", true); |
139 | kfree(aper); | 139 | kfree(aper); |
140 | 140 | ||
141 | if (!devm_request_mem_region(mdev->dev->dev, mdev->mc.vram_base, mdev->mc.vram_window, | 141 | if (!devm_request_mem_region(mdev->dev->dev, mdev->mc.vram_base, mdev->mc.vram_window, |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 66c1280c0f1f..652ab111dd74 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -351,7 +351,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev, | |||
351 | boot = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; | 351 | boot = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; |
352 | #endif | 352 | #endif |
353 | if (nouveau_modeset != 2) | 353 | if (nouveau_modeset != 2) |
354 | remove_conflicting_framebuffers(aper, "nouveaufb", boot); | 354 | drm_fb_helper_remove_conflicting_framebuffers(aper, "nouveaufb", boot); |
355 | kfree(aper); | 355 | kfree(aper); |
356 | 356 | ||
357 | ret = nvkm_device_pci_new(pdev, nouveau_config, nouveau_debug, | 357 | ret = nvkm_device_pci_new(pdev, nouveau_config, nouveau_debug, |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index c01a7c6abb49..90f2ff217b31 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/pm_runtime.h> | 39 | #include <linux/pm_runtime.h> |
40 | #include <linux/vga_switcheroo.h> | 40 | #include <linux/vga_switcheroo.h> |
41 | #include <drm/drm_gem.h> | 41 | #include <drm/drm_gem.h> |
42 | #include <drm/drm_fb_helper.h> | ||
42 | 43 | ||
43 | #include "drm_crtc_helper.h" | 44 | #include "drm_crtc_helper.h" |
44 | #include "radeon_kfd.h" | 45 | #include "radeon_kfd.h" |
@@ -324,7 +325,7 @@ static int radeon_kick_out_firmware_fb(struct pci_dev *pdev) | |||
324 | #ifdef CONFIG_X86 | 325 | #ifdef CONFIG_X86 |
325 | primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; | 326 | primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; |
326 | #endif | 327 | #endif |
327 | remove_conflicting_framebuffers(ap, "radeondrmfb", primary); | 328 | drm_fb_helper_remove_conflicting_framebuffers(ap, "radeondrmfb", primary); |
328 | kfree(ap); | 329 | kfree(ap); |
329 | 330 | ||
330 | return 0; | 331 | return 0; |
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index 7092daaf6c43..8913c151b37f 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <drm/drm_crtc_helper.h> | 17 | #include <drm/drm_crtc_helper.h> |
18 | #include <drm/drm_fb_cma_helper.h> | 18 | #include <drm/drm_fb_cma_helper.h> |
19 | #include <drm/drm_gem_cma_helper.h> | 19 | #include <drm/drm_gem_cma_helper.h> |
20 | #include <drm/drm_fb_helper.h> | ||
20 | 21 | ||
21 | #include "sun4i_crtc.h" | 22 | #include "sun4i_crtc.h" |
22 | #include "sun4i_drv.h" | 23 | #include "sun4i_drv.h" |
@@ -109,7 +110,7 @@ static void sun4i_remove_framebuffers(void) | |||
109 | ap->ranges[0].base = 0; | 110 | ap->ranges[0].base = 0; |
110 | ap->ranges[0].size = ~0; | 111 | ap->ranges[0].size = ~0; |
111 | 112 | ||
112 | remove_conflicting_framebuffers(ap, "sun4i-drm-fb", false); | 113 | drm_fb_helper_remove_conflicting_framebuffers(ap, "sun4i-drm-fb", false); |
113 | kfree(ap); | 114 | kfree(ap); |
114 | } | 115 | } |
115 | 116 | ||
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 8b42d31a7f0e..deec53545bea 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/pm_runtime.h> | 17 | #include <linux/pm_runtime.h> |
18 | #include "drm_fb_cma_helper.h" | 18 | #include "drm_fb_cma_helper.h" |
19 | #include <drm/drm_fb_helper.h> | ||
19 | 20 | ||
20 | #include "uapi/drm/vc4_drm.h" | 21 | #include "uapi/drm/vc4_drm.h" |
21 | #include "vc4_drv.h" | 22 | #include "vc4_drv.h" |
@@ -214,7 +215,7 @@ static void vc4_kick_out_firmware_fb(void) | |||
214 | ap->ranges[0].base = 0; | 215 | ap->ranges[0].base = 0; |
215 | ap->ranges[0].size = ~0; | 216 | ap->ranges[0].size = ~0; |
216 | 217 | ||
217 | remove_conflicting_framebuffers(ap, "vc4drmfb", false); | 218 | drm_fb_helper_remove_conflicting_framebuffers(ap, "vc4drmfb", false); |
218 | kfree(ap); | 219 | kfree(ap); |
219 | } | 220 | } |
220 | 221 | ||
diff --git a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c index 7f0e93f87a55..a59d0e309bfc 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c +++ b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c | |||
@@ -24,6 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <drm/drm_fb_helper.h> | ||
27 | 28 | ||
28 | #include "virtgpu_drv.h" | 29 | #include "virtgpu_drv.h" |
29 | 30 | ||
@@ -42,7 +43,7 @@ static void virtio_pci_kick_out_firmware_fb(struct pci_dev *pci_dev) | |||
42 | primary = pci_dev->resource[PCI_ROM_RESOURCE].flags | 43 | primary = pci_dev->resource[PCI_ROM_RESOURCE].flags |
43 | & IORESOURCE_ROM_SHADOW; | 44 | & IORESOURCE_ROM_SHADOW; |
44 | 45 | ||
45 | remove_conflicting_framebuffers(ap, "virtiodrmfb", primary); | 46 | drm_fb_helper_remove_conflicting_framebuffers(ap, "virtiodrmfb", primary); |
46 | 47 | ||
47 | kfree(ap); | 48 | kfree(ap); |
48 | } | 49 | } |
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index db8d4780eaa2..130c324f1aee 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h | |||
@@ -32,6 +32,7 @@ | |||
32 | 32 | ||
33 | struct drm_fb_helper; | 33 | struct drm_fb_helper; |
34 | 34 | ||
35 | #include <drm/drm_crtc.h> | ||
35 | #include <linux/kgdb.h> | 36 | #include <linux/kgdb.h> |
36 | 37 | ||
37 | enum mode_set_atomic { | 38 | enum mode_set_atomic { |
@@ -282,6 +283,12 @@ drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn, | |||
282 | int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_connector *connector); | 283 | int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_connector *connector); |
283 | int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, | 284 | int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, |
284 | struct drm_connector *connector); | 285 | struct drm_connector *connector); |
286 | static inline int | ||
287 | drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a, | ||
288 | const char *name, bool primary) | ||
289 | { | ||
290 | return remove_conflicting_framebuffers(a, name, primary); | ||
291 | } | ||
285 | #else | 292 | #else |
286 | static inline int drm_fb_helper_modinit(void) | 293 | static inline int drm_fb_helper_modinit(void) |
287 | { | 294 | { |
@@ -475,5 +482,12 @@ drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, | |||
475 | { | 482 | { |
476 | return 0; | 483 | return 0; |
477 | } | 484 | } |
485 | |||
486 | static inline int | ||
487 | drm_fb_helper_remove_conflicting_framebuffers(struct apertures_struct *a, | ||
488 | const char *name, bool primary) | ||
489 | { | ||
490 | return 0; | ||
491 | } | ||
478 | #endif | 492 | #endif |
479 | #endif | 493 | #endif |