All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] viafb: make module parameters visible in sysfs
@ 2009-09-07  2:24 Florian Tobias Schandinat
  2009-09-07  2:24 ` [PATCH 2/3] viafb: remove unused structure member Florian Tobias Schandinat
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Tobias Schandinat @ 2009-09-07  2:24 UTC (permalink / raw)
  To: linux-fbdev
  Cc: linux-kernel, akpm, JosephChan, ScottFang, Harald Welte,
	Harald Welte, Florian Tobias Schandinat

From: Harald Welte <laforge@gnumonks.org>

viafb: make module parameters visible in sysfs

Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
---
 drivers/video/via/viafbdev.c |   43 +++++++++++++++++++++--------------------
 1 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 34e49b8..a5bbcab 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -20,6 +20,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/stat.h>
 #define _MASTER_FILE
 
 #include "global.h"
@@ -2150,79 +2151,79 @@ module_init(viafb_init);
 module_exit(viafb_exit);
 
 #ifdef MODULE
-module_param(viafb_memsize, int, 0);
+module_param(viafb_memsize, int, S_IRUSR);
 
-module_param(viafb_mode, charp, 0);
+module_param(viafb_mode, charp, S_IRUSR);
 MODULE_PARM_DESC(viafb_mode, "Set resolution (default=640x480)");
 
-module_param(viafb_mode1, charp, 0);
+module_param(viafb_mode1, charp, S_IRUSR);
 MODULE_PARM_DESC(viafb_mode1, "Set resolution (default=640x480)");
 
-module_param(viafb_bpp, int, 0);
+module_param(viafb_bpp, int, S_IRUSR);
 MODULE_PARM_DESC(viafb_bpp, "Set color depth (default=32bpp)");
 
-module_param(viafb_bpp1, int, 0);
+module_param(viafb_bpp1, int, S_IRUSR);
 MODULE_PARM_DESC(viafb_bpp1, "Set color depth (default=32bpp)");
 
-module_param(viafb_refresh, int, 0);
+module_param(viafb_refresh, int, S_IRUSR);
 MODULE_PARM_DESC(viafb_refresh,
 	"Set CRT viafb_refresh rate (default = 60)");
 
-module_param(viafb_refresh1, int, 0);
+module_param(viafb_refresh1, int, S_IRUSR);
 MODULE_PARM_DESC(viafb_refresh1,
 	"Set CRT refresh rate (default = 60)");
 
-module_param(viafb_lcd_panel_id, int, 0);
+module_param(viafb_lcd_panel_id, int, S_IRUSR);
 MODULE_PARM_DESC(viafb_lcd_panel_id,
 	"Set Flat Panel type(Default=1024x768)");
 
-module_param(viafb_lcd_dsp_method, int, 0);
+module_param(viafb_lcd_dsp_method, int, S_IRUSR);
 MODULE_PARM_DESC(viafb_lcd_dsp_method,
 	"Set Flat Panel display scaling method.(Default=Expandsion)");
 
-module_param(viafb_SAMM_ON, int, 0);
+module_param(viafb_SAMM_ON, int, S_IRUSR);
 MODULE_PARM_DESC(viafb_SAMM_ON,
 	"Turn on/off flag of SAMM(Default=OFF)");
 
-module_param(viafb_accel, int, 0);
+module_param(viafb_accel, int, S_IRUSR);
 MODULE_PARM_DESC(viafb_accel,
 	"Set 2D Hardware Acceleration: 0 = OFF, 1 = ON (default)");
 
-module_param(viafb_active_dev, charp, 0);
+module_param(viafb_active_dev, charp, S_IRUSR);
 MODULE_PARM_DESC(viafb_active_dev, "Specify active devices.");
 
-module_param(viafb_display_hardware_layout, int, 0);
+module_param(viafb_display_hardware_layout, int, S_IRUSR);
 MODULE_PARM_DESC(viafb_display_hardware_layout,
 	"Display Hardware Layout (LCD Only, DVI Only...,etc)");
 
-module_param(viafb_second_size, int, 0);
+module_param(viafb_second_size, int, S_IRUSR);
 MODULE_PARM_DESC(viafb_second_size,
 	"Set secondary device memory size");
 
-module_param(viafb_dual_fb, int, 0);
+module_param(viafb_dual_fb, int, S_IRUSR);
 MODULE_PARM_DESC(viafb_dual_fb,
 	"Turn on/off flag of dual framebuffer devices.(Default = OFF)");
 
-module_param(viafb_platform_epia_dvi, int, 0);
+module_param(viafb_platform_epia_dvi, int, S_IRUSR);
 MODULE_PARM_DESC(viafb_platform_epia_dvi,
 	"Turn on/off flag of DVI devices on EPIA board.(Default = OFF)");
 
-module_param(viafb_device_lcd_dualedge, int, 0);
+module_param(viafb_device_lcd_dualedge, int, S_IRUSR);
 MODULE_PARM_DESC(viafb_device_lcd_dualedge,
 	"Turn on/off flag of dual edge panel.(Default = OFF)");
 
-module_param(viafb_bus_width, int, 0);
+module_param(viafb_bus_width, int, S_IRUSR);
 MODULE_PARM_DESC(viafb_bus_width,
 	"Set bus width of panel.(Default = 12)");
 
-module_param(viafb_lcd_mode, int, 0);
+module_param(viafb_lcd_mode, int, S_IRUSR);
 MODULE_PARM_DESC(viafb_lcd_mode,
 	"Set Flat Panel mode(Default=OPENLDI)");
 
-module_param(viafb_lcd_port, charp, 0);
+module_param(viafb_lcd_port, charp, S_IRUSR);
 MODULE_PARM_DESC(viafb_lcd_port, "Specify LCD output port.");
 
-module_param(viafb_dvi_port, charp, 0);
+module_param(viafb_dvi_port, charp, S_IRUSR);
 MODULE_PARM_DESC(viafb_dvi_port, "Specify DVI output port.");
 
 MODULE_LICENSE("GPL");
-- 
1.6.3.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] viafb: remove unused structure member
  2009-09-07  2:24 [PATCH 1/3] viafb: make module parameters visible in sysfs Florian Tobias Schandinat
@ 2009-09-07  2:24 ` Florian Tobias Schandinat
  2009-09-07  2:24   ` [PATCH 3/3] viafb: use read-only mode parsing Florian Tobias Schandinat
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Tobias Schandinat @ 2009-09-07  2:24 UTC (permalink / raw)
  To: linux-fbdev
  Cc: linux-kernel, akpm, JosephChan, ScottFang, Harald Welte,
	Harald Welte, Florian Tobias Schandinat

From: Harald Welte <laforge@gnumonks.org>

viafb: remove unused structure member

This patch removes a structure member 'on_slot' in the chip_info structure
which is completely unused.

Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
---
 drivers/video/via/chip.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/video/via/chip.h b/drivers/video/via/chip.h
index dde95ed..7f95967 100644
--- a/drivers/video/via/chip.h
+++ b/drivers/video/via/chip.h
@@ -122,7 +122,6 @@ struct lvds_chip_information {
 struct chip_information {
 	int gfx_chip_name;
 	int gfx_chip_revision;
-	int chip_on_slot;
 	struct tmds_chip_information tmds_chip_info;
 	struct lvds_chip_information lvds_chip_info;
 	struct lvds_chip_information lvds_chip_info2;
-- 
1.6.3.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] viafb: use read-only mode parsing
  2009-09-07  2:24 ` [PATCH 2/3] viafb: remove unused structure member Florian Tobias Schandinat
@ 2009-09-07  2:24   ` Florian Tobias Schandinat
  2009-09-09 20:39     ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Tobias Schandinat @ 2009-09-07  2:24 UTC (permalink / raw)
  To: linux-fbdev
  Cc: linux-kernel, akpm, JosephChan, ScottFang,
	Florian Tobias Schandinat

viafb: use read-only mode parsing

The previous method of mode parsing wrote to the strings resulting in
truncated mode strings in the sysfs.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
---
 drivers/video/via/viafbdev.c |   44 +++++++++++++++++++++++------------------
 1 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index a5bbcab..4f7cf69 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -1780,11 +1780,29 @@ static void viafb_remove_proc(struct proc_dir_entry *viafb_entry)
 	remove_proc_entry("viafb", NULL);
 }
 
+static void parse_mode(const char *str, u32 *xres, u32 *yres)
+{
+	char *ptr;
+
+	*xres = simple_strtoul(str, &ptr, 10);
+	if (ptr[0] != 'x')
+		goto out_default;
+
+	*yres = simple_strtoul(&ptr[1], &ptr, 10);
+	if (ptr[0])
+		goto out_default;
+
+	return;
+
+out_default:
+	printk(KERN_WARNING "viafb received invalid mode string: %s\n", str);
+	*xres = 640;
+	*yres = 480;
+}
+
 static int __devinit via_pci_probe(void)
 {
-	unsigned long default_xres, default_yres;
-	char *tmpc, *tmpm;
-	char *tmpc_sec, *tmpm_sec;
+	u32 default_xres, default_yres;
 	int vmode_index;
 	u32 viafb_par_length;
 
@@ -1861,26 +1879,14 @@ static int __devinit via_pci_probe(void)
 			viafb_second_size * 1024 * 1024;
 	}
 
-	tmpm = viafb_mode;
-	tmpc = strsep(&tmpm, "x");
-	strict_strtoul(tmpc, 0, &default_xres);
-	strict_strtoul(tmpm, 0, &default_yres);
-
+	parse_mode(viafb_mode, &default_xres, &default_yres);
 	vmode_index = viafb_get_mode_index(default_xres, default_yres);
 	DEBUG_MSG(KERN_INFO "0->index=%d\n", vmode_index);
 
 	if (viafb_SAMM_ON == 1) {
-		if (strcmp(viafb_mode, viafb_mode1)) {
-			tmpm_sec = viafb_mode1;
-			tmpc_sec = strsep(&tmpm_sec, "x");
-			strict_strtoul(tmpc_sec, 0,
-				(unsigned long *)&viafb_second_xres);
-			strict_strtoul(tmpm_sec, 0,
-				(unsigned long *)&viafb_second_yres);
-		} else {
-			viafb_second_xres = default_xres;
-			viafb_second_yres = default_yres;
-		}
+		parse_mode(viafb_mode1, &viafb_second_xres,
+			&viafb_second_yres);
+
 		if (0 == viafb_second_virtual_xres) {
 			switch (viafb_second_xres) {
 			case 1400:
-- 
1.6.3.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/3] viafb: use read-only mode parsing
  2009-09-07  2:24   ` [PATCH 3/3] viafb: use read-only mode parsing Florian Tobias Schandinat
@ 2009-09-09 20:39     ` Andrew Morton
  2009-09-13 19:04       ` Florian Tobias Schandinat
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2009-09-09 20:39 UTC (permalink / raw)
  To: Florian Tobias Schandinat
  Cc: linux-fbdev, linux-kernel, JosephChan, ScottFang,
	FlorianSchandinat

On Mon,  7 Sep 2009 02:24:44 +0000
Florian Tobias Schandinat <FlorianSchandinat@gmx.de> wrote:

> +static void parse_mode(const char *str, u32 *xres, u32 *yres)
> +{
> +	char *ptr;
> +
> +	*xres = simple_strtoul(str, &ptr, 10);
> +	if (ptr[0] != 'x')
> +		goto out_default;
> +
> +	*yres = simple_strtoul(&ptr[1], &ptr, 10);
> +	if (ptr[0])
> +		goto out_default;
> +
> +	return;
> +
> +out_default:
> +	printk(KERN_WARNING "viafb received invalid mode string: %s\n", str);
> +	*xres = 640;
> +	*yres = 480;
> +}

One wonders if we could use sscanf here?

The second simple_strtoul() could use strict_strtoul(), but that's not
obviously superior IMO.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/3] viafb: use read-only mode parsing
  2009-09-09 20:39     ` Andrew Morton
@ 2009-09-13 19:04       ` Florian Tobias Schandinat
  0 siblings, 0 replies; 5+ messages in thread
From: Florian Tobias Schandinat @ 2009-09-13 19:04 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-fbdev, linux-kernel, JosephChan, ScottFang

Andrew Morton schrieb:
> On Mon,  7 Sep 2009 02:24:44 +0000
> Florian Tobias Schandinat <FlorianSchandinat@gmx.de> wrote:
> 
>> +static void parse_mode(const char *str, u32 *xres, u32 *yres)
>> +{
>> +	char *ptr;
>> +
>> +	*xres = simple_strtoul(str, &ptr, 10);
>> +	if (ptr[0] != 'x')
>> +		goto out_default;
>> +
>> +	*yres = simple_strtoul(&ptr[1], &ptr, 10);
>> +	if (ptr[0])
>> +		goto out_default;
>> +
>> +	return;
>> +
>> +out_default:
>> +	printk(KERN_WARNING "viafb received invalid mode string: %s\n", str);
>> +	*xres = 640;
>> +	*yres = 480;
>> +}
> 
> One wonders if we could use sscanf here?

You're right.
But I am planning to add the optional arguments -<bpp> and @<refresh> to 
make it easier to select a mode and slowly move towards generic modedb 
format. I think that can be done easier with pointer handling than 
sscanf usage but I don't have a strong opinion about it so feel free to 
request me to change it.

Example: (new format)
viafb_mode=800x480-16@60
instead (old format)
viafb_mode=800x480 viafb_bpp=16 viafb_refresh=60

> The second simple_strtoul() could use strict_strtoul(), but that's not
> obviously superior IMO.

True.


Thanks,

Florian Tobias Schandinat

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-09-13 19:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-07  2:24 [PATCH 1/3] viafb: make module parameters visible in sysfs Florian Tobias Schandinat
2009-09-07  2:24 ` [PATCH 2/3] viafb: remove unused structure member Florian Tobias Schandinat
2009-09-07  2:24   ` [PATCH 3/3] viafb: use read-only mode parsing Florian Tobias Schandinat
2009-09-09 20:39     ` Andrew Morton
2009-09-13 19:04       ` Florian Tobias Schandinat

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.