Skip to content

Commit

Permalink
arch/sparc: Implement fb_is_primary_device() in source file
Browse files Browse the repository at this point in the history
Other architectures implment fb_is_primary_device() in a source
file. Do the same on sparc. No functional changes, but allows to
remove several include statement from <asm/fb.h>.

v2:
	* don't include <asm/prom.h> in header file

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "David S. Miller" <davem@davemloft.net>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Helge Deller <deller@gmx.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230417125651.25126-18-tzimmermann@suse.de
  • Loading branch information
Thomas Zimmermann committed Apr 20, 2023
1 parent b6cf296 commit 4eec0b3
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 18 deletions.
1 change: 1 addition & 0 deletions arch/sparc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ libs-y += arch/sparc/prom/
libs-y += arch/sparc/lib/

drivers-$(CONFIG_PM) += arch/sparc/power/
drivers-$(CONFIG_FB) += arch/sparc/video/

boot := arch/sparc/boot

Expand Down
23 changes: 5 additions & 18 deletions arch/sparc/include/asm/fb.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _SPARC_FB_H_
#define _SPARC_FB_H_
#include <linux/console.h>
#include <linux/fb.h>

#include <linux/fs.h>

#include <asm/page.h>
#include <asm/prom.h>

struct fb_info;

static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
unsigned long off)
Expand All @@ -15,20 +16,6 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
#endif
}

static inline int fb_is_primary_device(struct fb_info *info)
{
struct device *dev = info->device;
struct device_node *node;

if (console_set_on_cmdline)
return 0;

node = dev->of_node;
if (node &&
node == of_console_device)
return 1;

return 0;
}
int fb_is_primary_device(struct fb_info *info);

#endif /* _SPARC_FB_H_ */
3 changes: 3 additions & 0 deletions arch/sparc/video/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: GPL-2.0-only

obj-$(CONFIG_FB) += fbdev.o
24 changes: 24 additions & 0 deletions arch/sparc/video/fbdev.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: GPL-2.0

#include <linux/console.h>
#include <linux/fb.h>
#include <linux/module.h>

#include <asm/fb.h>
#include <asm/prom.h>

int fb_is_primary_device(struct fb_info *info)
{
struct device *dev = info->device;
struct device_node *node;

if (console_set_on_cmdline)
return 0;

node = dev->of_node;
if (node && node == of_console_device)
return 1;

return 0;
}
EXPORT_SYMBOL(fb_is_primary_device);

0 comments on commit 4eec0b3

Please sign in to comment.