Skip to contentSkip to conversation

uvesafb: improve parameter handling.

PATCH In review Rusty Russell 2 participants 2 messages Mar 28, 2009 – Mar 30, 2009 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 5/5 uvesafb: improve parameter handling.

1) Now module_param(..., invbool, ...) requires a bool, and similarly module_param(..., bool, ...) allows it, change pmi_setpal to a bool.
2) #define param_get_scroll to NULL, since it can never be called (perm argument to module_param_named is 0).
3) Return -EINVAL from param_set_scroll if the value is bad, so it's reported.

Note that I don't think the old fb_get_options() is required for new
drivers: the parameters automatically work as uvesafb.XXX=... anyway.

Cc Michal Januszewski <[email protected]>
---
 drivers/video/uvesafb.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/video/uvesafb.c +4 -6
@@ -45,7 +45,7 @@ static int mtrr		__devinitdata = 3; /* e
 static int mtrr		__devinitdata = 3; /* enable mtrr by default */
 static int blank	= 1;		   /* enable blanking by default */
 static int ypan		= 1; 		 /* 0: scroll, 1: ypan, 2: ywrap */
-static int pmi_setpal	__devinitdata = 1; /* use PMI for palette changes */
+static bool pmi_setpal	__devinitdata = true; /* use PMI for palette changes */
 static int nocrtc	__devinitdata; /* ignore CRTC settings */
 static int noedid	__devinitdata; /* don't try DDC transfers */
 static int vram_remap	__devinitdata; /* set amt. of memory to be used */
@@ -2009,11 +2009,7 @@ static void __devexit uvesafb_exit(void)
 
 module_exit(uvesafb_exit);
 
-static int param_get_scroll(char *buffer, struct kernel_param *kp)
-{
-	return 0;
-}
-
+#define param_get_scroll NULL
 static int param_set_scroll(const char *val, struct kernel_param *kp)
 {
 	ypan = 0;
@@ -2024,6 +2020,8 @@ static int param_set_scroll(const char *
 		ypan = 1;
 	else if (!strcmp(val, "ywrap"))
 		ypan = 2;
+	else
+		return -EINVAL;
 
 	return 0;
 }
Acked-by on v1 5/5
#1 lore raw
Quoted 8 lines · Rusty Russell

1) Now module_param(..., invbool, ...) requires a bool, and similarly module_param(..., bool, ...) allows it, change pmi_setpal to a bool.
2) #define param_get_scroll to NULL, since it can never be called (perm argument to module_param_named is 0).
3) Return -EINVAL from param_set_scroll if the value is bad, so it's reported.

Quoted 5 lines

Note that I don't think the old fb_get_options() is required for new
drivers: the parameters automatically work as uvesafb.XXX=... anyway.

Cc Michal Januszewski <[email protected]>
Quoted 40 lines

---
 drivers/video/uvesafb.c |   10 ++++------

 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/video/uvesafb.c +0 -0
@@ -45,7 +45,7 @@ static int mtrr               __devinitdata = 3; /* e

 static int mtrr                __devinitdata = 3; /* enable mtrr by default */ static int blank       = 1;               /* enable blanking by default */ static int ypan                = 1;             /* 0: scroll, 1: ypan, 2: ywrap */

drivers/video/uvesafb.c +1 -1
-static int pmi_setpal  __devinitdata = 1; /* use PMI for palette changes */
+static bool pmi_setpal __devinitdata = true; /* use PMI for palette changes */

 static int nocrtc      __devinitdata; /* ignore CRTC settings */ static int noedid      __devinitdata; /* don't try DDC transfers */ static int vram_remap  __devinitdata; /* set amt. of memory to be used */

drivers/video/uvesafb.c +3 -5
@@ -2009,11 +2009,7 @@ static void __devexit uvesafb_exit(void)
 
  module_exit(uvesafb_exit);
 
-static int param_get_scroll(char *buffer, struct kernel_param *kp)
-{
-       return 0;
-}
-
+#define param_get_scroll NULL
  static int param_set_scroll(const char *val, struct kernel_param *kp)
  {
        ypan = 0;
@@ -2024,6 +2020,8 @@ static int param_set_scroll(const char *
                ypan = 1;
        else if (!strcmp(val, "ywrap"))
                ypan = 2;
+       else
+               return -EINVAL;
 
        return 0;
  }