Skip to contentSkip to conversation

uvesafb: Fix warnings about unused variables on non-x86

PATCH In review Frank Lichtenheld 2 participants 2 messages Nov 9, 2007 – Nov 10, 2007 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uvesafb: Fix warnings about unused variables on non-x86

Variables that are only used in #ifdef CONFIG_X86 should also only be declared there.

---
 drivers/video/uvesafb.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/video/uvesafb.c +4 -2
index b983d26..d1d6c0f 100644
@@ -926,8 +926,10 @@ static int uvesafb_setpalette(struct uvesafb_pal_entry *entries, int count,
 		int start, struct fb_info *info)
 {
 	struct uvesafb_ktask *task;
+#ifdef CONFIG_X86
 	struct uvesafb_par *par = info->par;
 	int i = par->mode_idx;
+#endif
 	int err = 0;
 
 	/*
@@ -1103,11 +1105,11 @@ static int uvesafb_pan_display(struct fb_var_screeninfo *var,
 
 static int uvesafb_blank(int blank, struct fb_info *info)
 {
-	struct uvesafb_par *par = info->par;
 	struct uvesafb_ktask *task;
 	int err = 1;
-
 #ifdef CONFIG_X86
+	struct uvesafb_par *par = info->par;
+
 	if (par->vbe_ib.capabilities & VBE_CAP_VGACOMPAT) {
 		int loop = 10000;
 		u8 seq = 0, crtc17 = 0;
Signature · 1 line
1.5.3.4
#1 lore raw
Quoted 27 lines · On Fri, 9 Nov 2007 00:08:19 +0100 Frank Lichtenheld <[email protected]>…

Variables that are only used in #ifdef CONFIG_X86 should also only be declared there.

---
 drivers/video/uvesafb.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/video/uvesafb.c +2 -0
index b983d26..d1d6c0f 100644
@@ -926,8 +926,10 @@ static int uvesafb_setpalette(struct uvesafb_pal_entry *entries, int count,
 		int start, struct fb_info *info)
 {
 	struct uvesafb_ktask *task;
+#ifdef CONFIG_X86
 	struct uvesafb_par *par = info->par;
 	int i = par->mode_idx;
+#endif
 	int err = 0;
 
 	/*
@@ -1103,11 +1105,11 @@ static int uvesafb_pan_display(struct fb_var_screeninfo *var,
 
 static int uvesafb_blank(int blank, struct fb_info *info)
 {

drivers/video/uvesafb.c static int uvesafb_pan_display(struct fb_var_screeninfo *var, · line 1115

Quoted 10 lines
drivers/video/uvesafb.c +2 -2
-	struct uvesafb_par *par = info->par;
 	struct uvesafb_ktask *task;
 	int err = 1;
-
 #ifdef CONFIG_X86
+	struct uvesafb_par *par = info->par;
+
 	if (par->vbe_ib.capabilities & VBE_CAP_VGACOMPAT) {
 		int loop = 10000;
 		u8 seq = 0, crtc17 = 0;

OK, but ug. That's some quite nasty code you've found there.

it would come out better if that x86-specific code was pulled out into separate functions like

#ifdef CONFIG_X86
static int do_x86_stuff(...)

{
	...
	return 1;
}
#else
static int do_x86_stuff(...)
{
	return 0;
}

#endif

static int uvesafb_setpalette(...)

{
	if (do_x86_stuff(...) == 0) {
		<do non-x86-specific-stuff>
	}
}

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/