Skip to content

Commit f178e96

Browse files
Thomas Zimmermannarndb
authored andcommitted
arch: Remove struct fb_info from video helpers
The per-architecture video helpers do not depend on struct fb_info or anything else from fbdev. Remove it from the interface and replace fb_is_primary_device() with video_is_primary_device(). The new helper is similar in functionality, but can operate on non-fbdev devices. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com> Cc: Helge Deller <deller@gmx.de> Cc: "David S. Miller" <davem@davemloft.net> Cc: Andreas Larsson <andreas@gaisler.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: x86@kernel.org Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent f25eae2 commit f178e96

File tree

8 files changed

+41
-39
lines changed

8 files changed

+41
-39
lines changed

arch/parisc/include/asm/fb.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
#ifndef _ASM_FB_H_
33
#define _ASM_FB_H_
44

5-
struct fb_info;
5+
#include <linux/types.h>
6+
7+
struct device;
68

79
#if defined(CONFIG_STI_CORE)
8-
int fb_is_primary_device(struct fb_info *info);
9-
#define fb_is_primary_device fb_is_primary_device
10+
bool video_is_primary_device(struct device *dev);
11+
#define video_is_primary_device video_is_primary_device
1012
#endif
1113

1214
#include <asm-generic/fb.h>

arch/parisc/video/fbdev.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
* Copyright (C) 2001-2002 Thomas Bogendoerfer <tsbogend@alpha.franken.de>
66
*/
77

8-
#include <linux/fb.h>
98
#include <linux/module.h>
109

1110
#include <video/sticore.h>
1211

13-
int fb_is_primary_device(struct fb_info *info)
12+
#include <asm/fb.h>
13+
14+
bool video_is_primary_device(struct device *dev)
1415
{
1516
struct sti_struct *sti;
1617

@@ -21,6 +22,6 @@ int fb_is_primary_device(struct fb_info *info)
2122
return true;
2223

2324
/* return true if it's the default built-in framebuffer driver */
24-
return (sti->dev == info->device);
25+
return (sti->dev == dev);
2526
}
26-
EXPORT_SYMBOL(fb_is_primary_device);
27+
EXPORT_SYMBOL(video_is_primary_device);

arch/sparc/include/asm/fb.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
#define _SPARC_FB_H_
44

55
#include <linux/io.h>
6+
#include <linux/types.h>
67

78
#include <asm/page.h>
89

9-
struct fb_info;
10+
struct device;
1011

1112
#ifdef CONFIG_SPARC32
1213
static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
@@ -18,8 +19,8 @@ static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
1819
#define pgprot_framebuffer pgprot_framebuffer
1920
#endif
2021

21-
int fb_is_primary_device(struct fb_info *info);
22-
#define fb_is_primary_device fb_is_primary_device
22+
bool video_is_primary_device(struct device *dev);
23+
#define video_is_primary_device video_is_primary_device
2324

2425
static inline void fb_memcpy_fromio(void *to, const volatile void __iomem *from, size_t n)
2526
{

arch/sparc/video/fbdev.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
// SPDX-License-Identifier: GPL-2.0
22

33
#include <linux/console.h>
4-
#include <linux/fb.h>
4+
#include <linux/device.h>
55
#include <linux/module.h>
66

7+
#include <asm/fb.h>
78
#include <asm/prom.h>
89

9-
int fb_is_primary_device(struct fb_info *info)
10+
bool video_is_primary_device(struct device *dev)
1011
{
11-
struct device *dev = info->device;
12-
struct device_node *node;
12+
struct device_node *node = dev->of_node;
1313

1414
if (console_set_on_cmdline)
15-
return 0;
15+
return false;
1616

17-
node = dev->of_node;
1817
if (node && node == of_console_device)
19-
return 1;
18+
return true;
2019

21-
return 0;
20+
return false;
2221
}
23-
EXPORT_SYMBOL(fb_is_primary_device);
22+
EXPORT_SYMBOL(video_is_primary_device);
2423

2524
MODULE_DESCRIPTION("Sparc fbdev helpers");
2625
MODULE_LICENSE("GPL");

arch/x86/include/asm/fb.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22
#ifndef _ASM_X86_FB_H
33
#define _ASM_X86_FB_H
44

5+
#include <linux/types.h>
6+
57
#include <asm/page.h>
68

7-
struct fb_info;
9+
struct device;
810

911
pgprot_t pgprot_framebuffer(pgprot_t prot,
1012
unsigned long vm_start, unsigned long vm_end,
1113
unsigned long offset);
1214
#define pgprot_framebuffer pgprot_framebuffer
1315

14-
int fb_is_primary_device(struct fb_info *info);
15-
#define fb_is_primary_device fb_is_primary_device
16+
bool video_is_primary_device(struct device *dev);
17+
#define video_is_primary_device video_is_primary_device
1618

1719
#include <asm-generic/fb.h>
1820

arch/x86/video/fbdev.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*
88
*/
99

10-
#include <linux/fb.h>
1110
#include <linux/module.h>
1211
#include <linux/pci.h>
1312
#include <linux/vgaarb.h>
@@ -25,20 +24,17 @@ pgprot_t pgprot_framebuffer(pgprot_t prot,
2524
}
2625
EXPORT_SYMBOL(pgprot_framebuffer);
2726

28-
int fb_is_primary_device(struct fb_info *info)
27+
bool video_is_primary_device(struct device *dev)
2928
{
30-
struct device *device = info->device;
31-
struct pci_dev *pci_dev;
29+
struct pci_dev *pdev;
3230

33-
if (!device || !dev_is_pci(device))
34-
return 0;
31+
if (!dev_is_pci(dev))
32+
return false;
3533

36-
pci_dev = to_pci_dev(device);
34+
pdev = to_pci_dev(dev);
3735

38-
if (pci_dev == vga_default_device())
39-
return 1;
40-
return 0;
36+
return (pdev == vga_default_device());
4137
}
42-
EXPORT_SYMBOL(fb_is_primary_device);
38+
EXPORT_SYMBOL(video_is_primary_device);
4339

4440
MODULE_LICENSE("GPL");

drivers/video/fbdev/core/fbcon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2907,7 +2907,7 @@ void fbcon_remap_all(struct fb_info *info)
29072907
static void fbcon_select_primary(struct fb_info *info)
29082908
{
29092909
if (!map_override && primary_device == -1 &&
2910-
fb_is_primary_device(info)) {
2910+
video_is_primary_device(info->device)) {
29112911
int i;
29122912

29132913
printk(KERN_INFO "fbcon: %s (fb%i) is primary device\n",

include/asm-generic/fb.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
#include <linux/io.h>
1111
#include <linux/mm_types.h>
1212
#include <linux/pgtable.h>
13+
#include <linux/types.h>
1314

14-
struct fb_info;
15+
struct device;
1516

1617
#ifndef pgprot_framebuffer
1718
#define pgprot_framebuffer pgprot_framebuffer
@@ -23,11 +24,11 @@ static inline pgprot_t pgprot_framebuffer(pgprot_t prot,
2324
}
2425
#endif
2526

26-
#ifndef fb_is_primary_device
27-
#define fb_is_primary_device fb_is_primary_device
28-
static inline int fb_is_primary_device(struct fb_info *info)
27+
#ifndef video_is_primary_device
28+
#define video_is_primary_device video_is_primary_device
29+
static inline bool video_is_primary_device(struct device *dev)
2930
{
30-
return 0;
31+
return false;
3132
}
3233
#endif
3334

0 commit comments

Comments
 (0)