diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 7b10a7b..b9132b5 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -53,21 +53,20 @@
 #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS	0x85
 #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF		0x86
 
-
 #define ACPI_VIDEO_HEAD_INVALID		(~0u - 1)
 #define ACPI_VIDEO_HEAD_END		(~0u)
 
-
 #define _COMPONENT		ACPI_VIDEO_COMPONENT
-ACPI_MODULE_NAME		("acpi_video")
+ACPI_MODULE_NAME("acpi_video")
 
-MODULE_AUTHOR("Bruno Ducrot");
+    MODULE_AUTHOR("Bruno Ducrot");
 MODULE_DESCRIPTION(ACPI_VIDEO_DRIVER_NAME);
 MODULE_LICENSE("GPL");
 
-static int acpi_video_bus_add (struct acpi_device *device);
-static int acpi_video_bus_remove (struct acpi_device *device, int type);
-static int acpi_video_bus_match (struct acpi_device *device, struct acpi_driver *driver);
+static int acpi_video_bus_add(struct acpi_device *device);
+static int acpi_video_bus_remove(struct acpi_device *device, int type);
+static int acpi_video_bus_match(struct acpi_device *device,
+				struct acpi_driver *driver);
 
 static struct acpi_driver acpi_video_bus = {
 	.name = ACPI_VIDEO_DRIVER_NAME,
@@ -76,187 +75,192 @@
 		.add = acpi_video_bus_add,
 		.remove = acpi_video_bus_remove,
 		.match = acpi_video_bus_match,
-	},
+		},
 };
 
 struct acpi_video_bus_flags {
-	u8	multihead:1;	/* can switch video heads */
-	u8	rom:1;		/* can retrieve a video rom */
-	u8	post:1;		/* can configure the head to */
-	u8	reserved:5;
+	u8 multihead:1;		/* can switch video heads */
+	u8 rom:1;		/* can retrieve a video rom */
+	u8 post:1;		/* can configure the head to */
+	u8 reserved:5;
 };
 
 struct acpi_video_bus_cap {
-	u8	_DOS:1; /*Enable/Disable output switching*/
-	u8	_DOD:1; /*Enumerate all devices attached to display adapter*/
-	u8	_ROM:1; /*Get ROM Data*/
-	u8	_GPD:1; /*Get POST Device*/
-	u8	_SPD:1; /*Set POST Device*/
-	u8	_VPO:1; /*Video POST Options*/
-	u8	reserved:2;
+	u8 _DOS:1;		/*Enable/Disable output switching */
+	u8 _DOD:1;		/*Enumerate all devices attached to display adapter */
+	u8 _ROM:1;		/*Get ROM Data */
+	u8 _GPD:1;		/*Get POST Device */
+	u8 _SPD:1;		/*Set POST Device */
+	u8 _VPO:1;		/*Video POST Options */
+	u8 reserved:2;
 };
 
-struct acpi_video_device_attrib{
-	u32	display_index:4; /* A zero-based instance of the Display*/
-	u32	display_port_attachment:4; /*This field differenates displays type*/
-	u32	display_type:4;	/*Describe the specific type in use*/
-	u32	vendor_specific:4; /*Chipset Vendor Specifi*/ 
-	u32	bios_can_detect:1; /*BIOS can detect the device*/
-	u32	depend_on_vga:1; /*Non-VGA output device whose power is related to 
-				   the VGA device.*/
-	u32	pipe_id:3; /*For VGA multiple-head devices.*/
-	u32	reserved:10; /*Must be 0*/
-	u32	device_id_scheme:1; /*Device ID Scheme*/
+struct acpi_video_device_attrib {
+	u32 display_index:4;	/* A zero-based instance of the Display */
+	u32 display_port_attachment:4;	/*This field differenates displays type */
+	u32 display_type:4;	/*Describe the specific type in use */
+	u32 vendor_specific:4;	/*Chipset Vendor Specifi */
+	u32 bios_can_detect:1;	/*BIOS can detect the device */
+	u32 depend_on_vga:1;	/*Non-VGA output device whose power is related to 
+				   the VGA device. */
+	u32 pipe_id:3;		/*For VGA multiple-head devices. */
+	u32 reserved:10;	/*Must be 0 */
+	u32 device_id_scheme:1;	/*Device ID Scheme */
 };
 
 struct acpi_video_enumerated_device {
 	union {
 		u32 int_val;
-		struct acpi_video_device_attrib	attrib;
+		struct acpi_video_device_attrib attrib;
 	} value;
 	struct acpi_video_device *bind_info;
 };
 
 struct acpi_video_bus {
-	acpi_handle	handle;
-	u8	dos_setting;
+	acpi_handle handle;
+	u8 dos_setting;
 	struct acpi_video_enumerated_device *attached_array;
-	u8			attached_count;
-	struct acpi_video_bus_cap	cap;
+	u8 attached_count;
+	struct acpi_video_bus_cap cap;
 	struct acpi_video_bus_flags flags;
-	struct semaphore	sem;
-	struct list_head	video_device_list;
-	struct proc_dir_entry 	*dir;
+	struct semaphore sem;
+	struct list_head video_device_list;
+	struct proc_dir_entry *dir;
 };
 
 struct acpi_video_device_flags {
-	u8	crt:1;
-	u8	lcd:1;
-	u8	tvout:1;
-	u8	bios:1;
-	u8	unknown:1;
-	u8	reserved:3;
+	u8 crt:1;
+	u8 lcd:1;
+	u8 tvout:1;
+	u8 bios:1;
+	u8 unknown:1;
+	u8 reserved:3;
 };
 
 struct acpi_video_device_cap {
-	u8	_ADR:1;	/*Return the unique ID */
-	u8	_BCL:1; /*Query list of brightness control levels supported*/
-	u8	_BCM:1; /*Set the brightness level*/
-	u8	_DDC:1; /*Return the EDID for this device*/
-	u8	_DCS:1; /*Return status of output device*/
-	u8	_DGS:1; /*Query graphics state*/
-	u8	_DSS:1; /*Device state set*/
-	u8	_reserved:1;
+	u8 _ADR:1;		/*Return the unique ID */
+	u8 _BCL:1;		/*Query list of brightness control levels supported */
+	u8 _BCM:1;		/*Set the brightness level */
+	u8 _DDC:1;		/*Return the EDID for this device */
+	u8 _DCS:1;		/*Return status of output device */
+	u8 _DGS:1;		/*Query graphics state */
+	u8 _DSS:1;		/*Device state set */
+	u8 _reserved:1;
 };
 
 struct acpi_video_device_brightness {
-	int	curr;
-	int	count;
-	int	*levels;
+	int curr;
+	int count;
+	int *levels;
 };
 
 struct acpi_video_device {
-	acpi_handle		handle;
-	unsigned long		device_id;
-	struct acpi_video_device_flags	flags;
-	struct acpi_video_device_cap	cap;
-	struct list_head	entry;
-	struct acpi_video_bus	*video;
-	struct acpi_device	*dev;
+	acpi_handle handle;
+	unsigned long device_id;
+	struct acpi_video_device_flags flags;
+	struct acpi_video_device_cap cap;
+	struct list_head entry;
+	struct acpi_video_bus *video;
+	struct acpi_device *dev;
 	struct acpi_video_device_brightness *brightness;
 };
 
-
 /* bus */
 static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file);
 static struct file_operations acpi_video_bus_info_fops = {
-	.open		= acpi_video_bus_info_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
+	.open = acpi_video_bus_info_open_fs,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
 };
 
 static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file);
 static struct file_operations acpi_video_bus_ROM_fops = {
-	.open		= acpi_video_bus_ROM_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
+	.open = acpi_video_bus_ROM_open_fs,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
 };
 
-static int acpi_video_bus_POST_info_open_fs(struct inode *inode, struct file *file);
+static int acpi_video_bus_POST_info_open_fs(struct inode *inode,
+					    struct file *file);
 static struct file_operations acpi_video_bus_POST_info_fops = {
-	.open		= acpi_video_bus_POST_info_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
+	.open = acpi_video_bus_POST_info_open_fs,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
 };
 
 static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file);
 static struct file_operations acpi_video_bus_POST_fops = {
-	.open		= acpi_video_bus_POST_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
+	.open = acpi_video_bus_POST_open_fs,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
 };
 
-
 static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file);
 static struct file_operations acpi_video_bus_DOS_fops = {
-	.open		= acpi_video_bus_DOS_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
+	.open = acpi_video_bus_DOS_open_fs,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
 };
 
 /* device */
-static int acpi_video_device_info_open_fs(struct inode *inode, struct file *file);
+static int acpi_video_device_info_open_fs(struct inode *inode,
+					  struct file *file);
 static struct file_operations acpi_video_device_info_fops = {
-	.open		= acpi_video_device_info_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
+	.open = acpi_video_device_info_open_fs,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
 };
 
-static int acpi_video_device_state_open_fs(struct inode *inode, struct file *file);
+static int acpi_video_device_state_open_fs(struct inode *inode,
+					   struct file *file);
 static struct file_operations acpi_video_device_state_fops = {
-	.open		= acpi_video_device_state_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
+	.open = acpi_video_device_state_open_fs,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
 };
 
-static int acpi_video_device_brightness_open_fs(struct inode *inode, struct file *file);
+static int acpi_video_device_brightness_open_fs(struct inode *inode,
+						struct file *file);
 static struct file_operations acpi_video_device_brightness_fops = {
-	.open		= acpi_video_device_brightness_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
+	.open = acpi_video_device_brightness_open_fs,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
 };
 
-static int acpi_video_device_EDID_open_fs(struct inode *inode, struct file *file);
+static int acpi_video_device_EDID_open_fs(struct inode *inode,
+					  struct file *file);
 static struct file_operations acpi_video_device_EDID_fops = {
-	.open		= acpi_video_device_EDID_open_fs,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
+	.open = acpi_video_device_EDID_open_fs,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
 };
 
-static char	device_decode[][30] = {
+static char device_decode[][30] = {
 	"motherboard VGA device",
 	"PCI VGA device",
 	"AGP VGA device",
 	"UNKNOWN",
 };
 
-static void acpi_video_device_notify ( acpi_handle handle, u32 event, void *data);
-static void acpi_video_device_rebind( struct acpi_video_bus *video);
-static void acpi_video_device_bind( struct acpi_video_bus *video, struct acpi_video_device *device);
+static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data);
+static void acpi_video_device_rebind(struct acpi_video_bus *video);
+static void acpi_video_device_bind(struct acpi_video_bus *video,
+				   struct acpi_video_device *device);
 static int acpi_video_device_enumerate(struct acpi_video_bus *video);
-static int acpi_video_switch_output( struct acpi_video_bus *video, int	event);
-static int acpi_video_get_next_level( struct acpi_video_device *device, u32 level_current,u32 event);
-static void acpi_video_switch_brightness ( struct acpi_video_device *device, int event);
-
+static int acpi_video_switch_output(struct acpi_video_bus *video, int event);
+static int acpi_video_get_next_level(struct acpi_video_device *device,
+				     u32 level_current, u32 event);
+static void acpi_video_switch_brightness(struct acpi_video_device *device,
+					 int event);
 
 /* --------------------------------------------------------------------------
                                Video Management
@@ -265,11 +269,9 @@
 /* device */
 
 static int
-acpi_video_device_query (
-	struct acpi_video_device	*device,
-	unsigned long			*state)
+acpi_video_device_query(struct acpi_video_device *device, unsigned long *state)
 {
-	int			status;
+	int status;
 	ACPI_FUNCTION_TRACE("acpi_video_device_query");
 	status = acpi_evaluate_integer(device->handle, "_DGS", NULL, state);
 
@@ -277,11 +279,10 @@
 }
 
 static int
-acpi_video_device_get_state (
-	struct acpi_video_device	*device,
-	unsigned long 		*state)
+acpi_video_device_get_state(struct acpi_video_device *device,
+			    unsigned long *state)
 {
-	int			status;
+	int status;
 
 	ACPI_FUNCTION_TRACE("acpi_video_device_get_state");
 
@@ -291,13 +292,11 @@
 }
 
 static int
-acpi_video_device_set_state (
-	struct acpi_video_device	*device,
-	int			state)
+acpi_video_device_set_state(struct acpi_video_device *device, int state)
 {
-	int			status;
-	union acpi_object	arg0 = {ACPI_TYPE_INTEGER};
-	struct acpi_object_list	args = {1, &arg0};
+	int status;
+	union acpi_object arg0 = { ACPI_TYPE_INTEGER };
+	struct acpi_object_list args = { 1, &arg0 };
 
 	ACPI_FUNCTION_TRACE("acpi_video_device_set_state");
 
@@ -308,14 +307,12 @@
 }
 
 static int
-acpi_video_device_lcd_query_levels (
-	struct acpi_video_device	*device,
-	union acpi_object		**levels)
+acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
+				   union acpi_object **levels)
 {
-	int			status;
-	struct acpi_buffer	buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-	union acpi_object	*obj;
-
+	int status;
+	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+	union acpi_object *obj;
 
 	ACPI_FUNCTION_TRACE("acpi_video_device_lcd_query_levels");
 
@@ -324,7 +321,7 @@
 	status = acpi_evaluate_object(device->handle, "_BCL", NULL, &buffer);
 	if (!ACPI_SUCCESS(status))
 		return_VALUE(status);
-	obj = (union acpi_object *) buffer.pointer;
+	obj = (union acpi_object *)buffer.pointer;
 	if (!obj && (obj->type != ACPI_TYPE_PACKAGE)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n"));
 		status = -EFAULT;
@@ -335,7 +332,7 @@
 
 	return_VALUE(0);
 
-err:
+      err:
 	if (buffer.pointer)
 		kfree(buffer.pointer);
 
@@ -343,13 +340,11 @@
 }
 
 static int
-acpi_video_device_lcd_set_level (
-	struct acpi_video_device	*device,
-	int				level)
+acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
 {
-	int			status;
-	union acpi_object	arg0 = {ACPI_TYPE_INTEGER};
-	struct acpi_object_list	args = {1, &arg0};
+	int status;
+	union acpi_object arg0 = { ACPI_TYPE_INTEGER };
+	struct acpi_object_list args = { 1, &arg0 };
 
 	ACPI_FUNCTION_TRACE("acpi_video_device_lcd_set_level");
 
@@ -361,11 +356,10 @@
 }
 
 static int
-acpi_video_device_lcd_get_level_current (
-	struct acpi_video_device	*device,
-	unsigned long 	*level)
+acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
+					unsigned long *level)
 {
-	int			status;
+	int status;
 	ACPI_FUNCTION_TRACE("acpi_video_device_lcd_get_level_current");
 
 	status = acpi_evaluate_integer(device->handle, "_BQC", NULL, level);
@@ -374,16 +368,14 @@
 }
 
 static int
-acpi_video_device_EDID (
-	struct acpi_video_device	*device,
-	union acpi_object		**edid,
-	ssize_t				length)
+acpi_video_device_EDID(struct acpi_video_device *device,
+		       union acpi_object **edid, ssize_t length)
 {
-	int			status;
-	struct acpi_buffer	buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-	union acpi_object	*obj;
-	union acpi_object	arg0 = {ACPI_TYPE_INTEGER};
-	struct acpi_object_list	args = {1, &arg0};
+	int status;
+	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+	union acpi_object *obj;
+	union acpi_object arg0 = { ACPI_TYPE_INTEGER };
+	struct acpi_object_list args = { 1, &arg0 };
 
 	ACPI_FUNCTION_TRACE("acpi_video_device_get_EDID");
 
@@ -402,7 +394,7 @@
 	if (ACPI_FAILURE(status))
 		return_VALUE(-ENODEV);
 
-	obj = (union acpi_object *) buffer.pointer;
+	obj = (union acpi_object *)buffer.pointer;
 
 	if (obj && obj->type == ACPI_TYPE_BUFFER)
 		*edid = obj;
@@ -415,18 +407,15 @@
 	return_VALUE(status);
 }
 
-
 /* bus */
 
 static int
-acpi_video_bus_set_POST (
-	struct acpi_video_bus	*video,
-	unsigned long		option)
+acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
 {
-	int			status;
-	unsigned long		tmp;
-	union acpi_object	arg0 = {ACPI_TYPE_INTEGER};
-	struct acpi_object_list	args = {1, &arg0};
+	int status;
+	unsigned long tmp;
+	union acpi_object arg0 = { ACPI_TYPE_INTEGER };
+	struct acpi_object_list args = { 1, &arg0 };
 
 	ACPI_FUNCTION_TRACE("acpi_video_bus_set_POST");
 
@@ -434,15 +423,13 @@
 
 	status = acpi_evaluate_integer(video->handle, "_SPD", &args, &tmp);
 	if (ACPI_SUCCESS(status))
-		status = tmp ? (-EINVAL):(AE_OK);
+		status = tmp ? (-EINVAL) : (AE_OK);
 
 	return_VALUE(status);
 }
 
 static int
-acpi_video_bus_get_POST (
-	struct acpi_video_bus	*video,
-	unsigned long		*id)
+acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id)
 {
 	int status;
 
@@ -454,11 +441,10 @@
 }
 
 static int
-acpi_video_bus_POST_options (
-	struct acpi_video_bus	*video,
-	unsigned long		*options)
+acpi_video_bus_POST_options(struct acpi_video_bus *video,
+			    unsigned long *options)
 {
-	int			status;
+	int status;
 	ACPI_FUNCTION_TRACE("acpi_video_bus_POST_options");
 
 	status = acpi_evaluate_integer(video->handle, "_VPO", NULL, options);
@@ -489,18 +475,15 @@
  */
 
 static int
-acpi_video_bus_DOS(
-	struct acpi_video_bus	*video,
-	int			bios_flag,
-	int			lcd_flag)
+acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
 {
-	acpi_integer		status = 0;
-	union acpi_object	arg0 = {ACPI_TYPE_INTEGER};
-	struct acpi_object_list	args = {1, &arg0};
+	acpi_integer status = 0;
+	union acpi_object arg0 = { ACPI_TYPE_INTEGER };
+	struct acpi_object_list args = { 1, &arg0 };
 
 	ACPI_FUNCTION_TRACE("acpi_video_bus_DOS");
 
-	if (bios_flag < 0 || bios_flag >3 || lcd_flag < 0 || lcd_flag > 1){
+	if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) {
 		status = -1;
 		goto Failed;
 	}
@@ -508,7 +491,7 @@
 	video->dos_setting = arg0.integer.value;
 	acpi_evaluate_object(video->handle, "_DOS", &args, NULL);
 
-Failed:
+      Failed:
 	return_VALUE(status);
 }
 
@@ -523,10 +506,9 @@
  *  device.
  */
 
-static void
-acpi_video_device_find_cap (struct acpi_video_device *device)
+static void acpi_video_device_find_cap(struct acpi_video_device *device)
 {
-	acpi_integer		status;
+	acpi_integer status;
 	acpi_handle h_dummy1;
 	int i;
 	union acpi_object *obj = NULL;
@@ -534,27 +516,27 @@
 
 	ACPI_FUNCTION_TRACE("acpi_video_device_find_cap");
 
-	memset( &device->cap, 0, 4);
+	memset(&device->cap, 0, 4);
 
-    	if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_ADR", &h_dummy1))) {
+	if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ADR", &h_dummy1))) {
 		device->cap._ADR = 1;
 	}
-    	if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCL", &h_dummy1))) {
-		device->cap._BCL= 1;
+	if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCL", &h_dummy1))) {
+		device->cap._BCL = 1;
 	}
-    	if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCM", &h_dummy1))) {
-		device->cap._BCM= 1;
+	if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCM", &h_dummy1))) {
+		device->cap._BCM = 1;
 	}
-    	if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_DDC", &h_dummy1))) {
-		device->cap._DDC= 1;
+	if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DDC", &h_dummy1))) {
+		device->cap._DDC = 1;
 	}
-    	if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_DCS", &h_dummy1))) {
+	if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DCS", &h_dummy1))) {
 		device->cap._DCS = 1;
 	}
-    	if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_DGS", &h_dummy1))) {
+	if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DGS", &h_dummy1))) {
 		device->cap._DGS = 1;
 	}
-    	if( ACPI_SUCCESS(acpi_get_handle(device->handle, "_DSS", &h_dummy1))) {
+	if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DSS", &h_dummy1))) {
 		device->cap._DSS = 1;
 	}
 
@@ -563,34 +545,38 @@
 	if (obj && obj->type == ACPI_TYPE_PACKAGE && obj->package.count >= 2) {
 		int count = 0;
 		union acpi_object *o;
-		
+
 		br = kmalloc(sizeof(*br), GFP_KERNEL);
 		if (!br) {
 			printk(KERN_ERR "can't allocate memory\n");
 		} else {
 			memset(br, 0, sizeof(*br));
 			br->levels = kmalloc(obj->package.count *
-					sizeof *(br->levels), GFP_KERNEL);
+					     sizeof *(br->levels), GFP_KERNEL);
 			if (!br->levels)
 				goto out;
 
 			for (i = 0; i < obj->package.count; i++) {
-				o = (union acpi_object *) &obj->package.elements[i];
+				o = (union acpi_object *)&obj->package.
+				    elements[i];
 				if (o->type != ACPI_TYPE_INTEGER) {
-					ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data\n"));
+					ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+							  "Invalid data\n"));
 					continue;
 				}
 				br->levels[count] = (u32) o->integer.value;
 				count++;
 			}
-out:
+		      out:
 			if (count < 2) {
 				kfree(br->levels);
 				kfree(br);
 			} else {
 				br->count = count;
 				device->brightness = br;
-				ACPI_DEBUG_PRINT((ACPI_DB_INFO, "found %d brightness levels\n", count));
+				ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+						  "found %d brightness levels\n",
+						  count));
 			}
 		}
 	}
@@ -610,28 +596,27 @@
  *  Find out all required AML method defined under the video bus device.
  */
 
-static void 
-acpi_video_bus_find_cap (struct acpi_video_bus *video)
+static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
 {
-	acpi_handle	h_dummy1;
+	acpi_handle h_dummy1;
 
-	memset(&video->cap ,0, 4);
-    	if( ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOS", &h_dummy1))) {
+	memset(&video->cap, 0, 4);
+	if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOS", &h_dummy1))) {
 		video->cap._DOS = 1;
 	}
-    	if( ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOD", &h_dummy1))) {
+	if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOD", &h_dummy1))) {
 		video->cap._DOD = 1;
 	}
-    	if( ACPI_SUCCESS(acpi_get_handle(video->handle, "_ROM", &h_dummy1))) {
+	if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_ROM", &h_dummy1))) {
 		video->cap._ROM = 1;
 	}
-    	if( ACPI_SUCCESS(acpi_get_handle(video->handle, "_GPD", &h_dummy1))) {
+	if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_GPD", &h_dummy1))) {
 		video->cap._GPD = 1;
 	}
-    	if( ACPI_SUCCESS(acpi_get_handle(video->handle, "_SPD", &h_dummy1))) {
+	if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_SPD", &h_dummy1))) {
 		video->cap._SPD = 1;
 	}
-    	if( ACPI_SUCCESS(acpi_get_handle(video->handle, "_VPO", &h_dummy1))) {
+	if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_VPO", &h_dummy1))) {
 		video->cap._VPO = 1;
 	}
 }
@@ -641,12 +626,9 @@
  * support the desired features
  */
 
-static int
-acpi_video_bus_check (
-	struct acpi_video_bus	*video)
+static int acpi_video_bus_check(struct acpi_video_bus *video)
 {
-	acpi_status		status = -ENOENT;
-
+	acpi_status status = -ENOENT;
 
 	ACPI_FUNCTION_TRACE("acpi_video_bus_check");
 
@@ -658,19 +640,19 @@
 	 */
 
 	/* Does this device able to support video switching ? */
-	if(video->cap._DOS){
+	if (video->cap._DOS) {
 		video->flags.multihead = 1;
 		status = 0;
 	}
 
 	/* Does this device able to retrieve a retrieve a video ROM ? */
-	if(video->cap._ROM){
+	if (video->cap._ROM) {
 		video->flags.rom = 1;
 		status = 0;
 	}
 
 	/* Does this device able to configure which video device to POST ? */
-	if(video->cap._GPD && video->cap._SPD && video->cap._VPO){
+	if (video->cap._GPD && video->cap._SPD && video->cap._VPO) {
 		video->flags.post = 1;
 		status = 0;
 	}
@@ -682,16 +664,14 @@
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-static struct proc_dir_entry	*acpi_video_dir;
+static struct proc_dir_entry *acpi_video_dir;
 
 /* video devices */
 
-static int
-acpi_video_device_info_seq_show (
-	struct seq_file		*seq,
-	void			*offset)
+static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset)
 {
-	struct acpi_video_device	*dev = (struct acpi_video_device *) seq->private;
+	struct acpi_video_device *dev =
+	    (struct acpi_video_device *)seq->private;
 
 	ACPI_FUNCTION_TRACE("acpi_video_device_info_seq_show");
 
@@ -709,30 +689,25 @@
 	else
 		seq_printf(seq, "UNKNOWN\n");
 
-	seq_printf(seq,"known by bios: %s\n",
-		   dev->flags.bios ? "yes":"no");
+	seq_printf(seq, "known by bios: %s\n", dev->flags.bios ? "yes" : "no");
 
-end:
+      end:
 	return_VALUE(0);
 }
 
 static int
-acpi_video_device_info_open_fs (
-	struct inode		*inode,
-	struct file		*file)
+acpi_video_device_info_open_fs(struct inode *inode, struct file *file)
 {
 	return single_open(file, acpi_video_device_info_seq_show,
 			   PDE(inode)->data);
 }
 
-static int  
-acpi_video_device_state_seq_show (
-	struct seq_file		*seq,
-	void			*offset)
+static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset)
 {
-	int			status;
-	struct acpi_video_device	*dev = (struct acpi_video_device *) seq->private;
-	unsigned long	state;
+	int status;
+	struct acpi_video_device *dev =
+	    (struct acpi_video_device *)seq->private;
+	unsigned long state;
 
 	ACPI_FUNCTION_TRACE("acpi_video_device_state_seq_show");
 
@@ -753,31 +728,27 @@
 	else
 		seq_printf(seq, "<not supported>\n");
 
-end:
+      end:
 	return_VALUE(0);
 }
 
 static int
-acpi_video_device_state_open_fs (
-	struct inode		*inode,
-	struct file		*file)
+acpi_video_device_state_open_fs(struct inode *inode, struct file *file)
 {
 	return single_open(file, acpi_video_device_state_seq_show,
 			   PDE(inode)->data);
 }
 
 static ssize_t
-acpi_video_device_write_state (
-	struct file		*file,
-	const char		__user *buffer,
-	size_t			count,
-	loff_t			*data)
+acpi_video_device_write_state(struct file *file,
+			      const char __user * buffer,
+			      size_t count, loff_t * data)
 {
-	int			status;
-	struct seq_file		*m = (struct seq_file *) file->private_data;
-	struct acpi_video_device	*dev = (struct acpi_video_device *) m->private;
-	char			str[12] = {0};
-	u32			state = 0;
+	int status;
+	struct seq_file *m = (struct seq_file *)file->private_data;
+	struct acpi_video_device *dev = (struct acpi_video_device *)m->private;
+	char str[12] = { 0 };
+	u32 state = 0;
 
 	ACPI_FUNCTION_TRACE("acpi_video_device_write_state");
 
@@ -789,7 +760,7 @@
 
 	str[count] = 0;
 	state = simple_strtoul(str, NULL, 0);
-	state &= ((1ul<<31) | (1ul<<30) | (1ul<<0));
+	state &= ((1ul << 31) | (1ul << 30) | (1ul << 0));
 
 	status = acpi_video_device_set_state(dev, state);
 
@@ -800,12 +771,11 @@
 }
 
 static int
-acpi_video_device_brightness_seq_show (
-	struct seq_file		*seq,
-	void			*offset)
+acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset)
 {
-	struct acpi_video_device	*dev = (struct acpi_video_device *) seq->private;
-	int			i;
+	struct acpi_video_device *dev =
+	    (struct acpi_video_device *)seq->private;
+	int i;
 
 	ACPI_FUNCTION_TRACE("acpi_video_device_brightness_seq_show");
 
@@ -823,26 +793,22 @@
 }
 
 static int
-acpi_video_device_brightness_open_fs (
-	struct inode		*inode,
-	struct file		*file)
+acpi_video_device_brightness_open_fs(struct inode *inode, struct file *file)
 {
 	return single_open(file, acpi_video_device_brightness_seq_show,
 			   PDE(inode)->data);
 }
 
 static ssize_t
-acpi_video_device_write_brightness (
-	struct file		*file,
-	const char		__user *buffer,
-	size_t			count,
-	loff_t			*data)
+acpi_video_device_write_brightness(struct file *file,
+				   const char __user * buffer,
+				   size_t count, loff_t * data)
 {
-	struct seq_file		*m = (struct seq_file *) file->private_data;
-	struct acpi_video_device	*dev = (struct acpi_video_device *) m->private;
-	char			str[4] = {0};
-	unsigned int		level = 0;
-	int			i;
+	struct seq_file *m = (struct seq_file *)file->private_data;
+	struct acpi_video_device *dev = (struct acpi_video_device *)m->private;
+	char str[4] = { 0 };
+	unsigned int level = 0;
+	int i;
 
 	ACPI_FUNCTION_TRACE("acpi_video_device_write_brightness");
 
@@ -854,14 +820,15 @@
 
 	str[count] = 0;
 	level = simple_strtoul(str, NULL, 0);
-	
+
 	if (level > 100)
 		return_VALUE(-EFAULT);
 
 	/* validate though the list of available levels */
 	for (i = 0; i < dev->brightness->count; i++)
 		if (level == dev->brightness->levels[i]) {
-			if (ACPI_SUCCESS(acpi_video_device_lcd_set_level(dev, level)))
+			if (ACPI_SUCCESS
+			    (acpi_video_device_lcd_set_level(dev, level)))
 				dev->brightness->curr = level;
 			break;
 		}
@@ -869,24 +836,22 @@
 	return_VALUE(count);
 }
 
-static int
-acpi_video_device_EDID_seq_show (
-	struct seq_file		*seq,
-	void			*offset)
+static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset)
 {
-	struct acpi_video_device	*dev = (struct acpi_video_device *) seq->private;
-	int			status;
-	int			i;
-	union acpi_object	*edid = NULL;
+	struct acpi_video_device *dev =
+	    (struct acpi_video_device *)seq->private;
+	int status;
+	int i;
+	union acpi_object *edid = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_video_device_EDID_seq_show");
 
 	if (!dev)
 		goto out;
 
-	status = acpi_video_device_EDID (dev, &edid, 128);
+	status = acpi_video_device_EDID(dev, &edid, 128);
 	if (ACPI_FAILURE(status)) {
-		status = acpi_video_device_EDID (dev, &edid, 256);
+		status = acpi_video_device_EDID(dev, &edid, 256);
 	}
 
 	if (ACPI_FAILURE(status)) {
@@ -898,7 +863,7 @@
 			seq_putc(seq, edid->buffer.pointer[i]);
 	}
 
-out:
+      out:
 	if (!edid)
 		seq_printf(seq, "<not supported>\n");
 	else
@@ -908,20 +873,15 @@
 }
 
 static int
-acpi_video_device_EDID_open_fs (
-	struct inode		*inode,
-	struct file		*file)
+acpi_video_device_EDID_open_fs(struct inode *inode, struct file *file)
 {
 	return single_open(file, acpi_video_device_EDID_seq_show,
 			   PDE(inode)->data);
 }
 
-
-static int
-acpi_video_device_add_fs (
-	struct acpi_device	*device)
+static int acpi_video_device_add_fs(struct acpi_device *device)
 {
-	struct proc_dir_entry	*entry = NULL;
+	struct proc_dir_entry *entry = NULL;
 	struct acpi_video_device *vid_dev;
 
 	ACPI_FUNCTION_TRACE("acpi_video_device_add_fs");
@@ -929,13 +889,13 @@
 	if (!device)
 		return_VALUE(-ENODEV);
 
-	vid_dev = (struct acpi_video_device *) acpi_driver_data(device);
+	vid_dev = (struct acpi_video_device *)acpi_driver_data(device);
 	if (!vid_dev)
 		return_VALUE(-ENODEV);
 
 	if (!acpi_device_dir(device)) {
 		acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
-				vid_dev->video->dir);
+						     vid_dev->video->dir);
 		if (!acpi_device_dir(device))
 			return_VALUE(-ENODEV);
 		acpi_device_dir(device)->owner = THIS_MODULE;
@@ -945,7 +905,7 @@
 	entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device));
 	if (!entry)
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Unable to create 'info' fs entry\n"));
+				  "Unable to create 'info' fs entry\n"));
 	else {
 		entry->proc_fops = &acpi_video_device_info_fops;
 		entry->data = acpi_driver_data(device);
@@ -953,10 +913,12 @@
 	}
 
 	/* 'state' [R/W] */
-	entry = create_proc_entry("state", S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
+	entry =
+	    create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR,
+			      acpi_device_dir(device));
 	if (!entry)
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Unable to create 'state' fs entry\n"));
+				  "Unable to create 'state' fs entry\n"));
 	else {
 		entry->proc_fops = &acpi_video_device_state_fops;
 		entry->proc_fops->write = acpi_video_device_write_state;
@@ -965,10 +927,12 @@
 	}
 
 	/* 'brightness' [R/W] */
-	entry = create_proc_entry("brightness", S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
+	entry =
+	    create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR,
+			      acpi_device_dir(device));
 	if (!entry)
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Unable to create 'brightness' fs entry\n"));
+				  "Unable to create 'brightness' fs entry\n"));
 	else {
 		entry->proc_fops = &acpi_video_device_brightness_fops;
 		entry->proc_fops->write = acpi_video_device_write_brightness;
@@ -980,7 +944,7 @@
 	entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device));
 	if (!entry)
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Unable to create 'brightness' fs entry\n"));
+				  "Unable to create 'brightness' fs entry\n"));
 	else {
 		entry->proc_fops = &acpi_video_device_EDID_fops;
 		entry->data = acpi_driver_data(device);
@@ -990,14 +954,12 @@
 	return_VALUE(0);
 }
 
-static int
-acpi_video_device_remove_fs (
-	struct acpi_device	*device)
+static int acpi_video_device_remove_fs(struct acpi_device *device)
 {
 	struct acpi_video_device *vid_dev;
 	ACPI_FUNCTION_TRACE("acpi_video_device_remove_fs");
 
-	vid_dev = (struct acpi_video_device *) acpi_driver_data(device);
+	vid_dev = (struct acpi_video_device *)acpi_driver_data(device);
 	if (!vid_dev || !vid_dev->video || !vid_dev->video->dir)
 		return_VALUE(-ENODEV);
 
@@ -1006,22 +968,17 @@
 		remove_proc_entry("state", acpi_device_dir(device));
 		remove_proc_entry("brightness", acpi_device_dir(device));
 		remove_proc_entry("EDID", acpi_device_dir(device));
-		remove_proc_entry(acpi_device_bid(device),
-				 vid_dev->video->dir);
+		remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir);
 		acpi_device_dir(device) = NULL;
 	}
 
 	return_VALUE(0);
 }
 
-
 /* video bus */
-static int
-acpi_video_bus_info_seq_show (
-	struct seq_file		*seq,
-	void			*offset)
+static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset)
 {
-	struct acpi_video_bus	*video = (struct acpi_video_bus *) seq->private;
+	struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
 
 	ACPI_FUNCTION_TRACE("acpi_video_bus_info_seq_show");
 
@@ -1029,30 +986,25 @@
 		goto end;
 
 	seq_printf(seq, "Switching heads:              %s\n",
-			video->flags.multihead ? "yes":"no");
+		   video->flags.multihead ? "yes" : "no");
 	seq_printf(seq, "Video ROM:                    %s\n",
-			video->flags.rom ? "yes":"no");
+		   video->flags.rom ? "yes" : "no");
 	seq_printf(seq, "Device to be POSTed on boot:  %s\n",
-			video->flags.post ? "yes":"no");
+		   video->flags.post ? "yes" : "no");
 
-end:
+      end:
 	return_VALUE(0);
 }
 
-static int
-acpi_video_bus_info_open_fs (
-	struct inode		*inode,
-	struct file		*file)
+static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file)
 {
-	return single_open(file, acpi_video_bus_info_seq_show, PDE(inode)->data);
+	return single_open(file, acpi_video_bus_info_seq_show,
+			   PDE(inode)->data);
 }
 
-static int
-acpi_video_bus_ROM_seq_show (
-	struct seq_file		*seq,
-	void			*offset)
+static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset)
 {
-	struct acpi_video_bus	*video = (struct acpi_video_bus *) seq->private;
+	struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
 
 	ACPI_FUNCTION_TRACE("acpi_video_bus_ROM_seq_show");
 
@@ -1062,26 +1014,20 @@
 	printk(KERN_INFO PREFIX "Please implement %s\n", __FUNCTION__);
 	seq_printf(seq, "<TODO>\n");
 
-end:
+      end:
 	return_VALUE(0);
 }
 
-static int
-acpi_video_bus_ROM_open_fs (
-	struct inode		*inode,
-	struct file		*file)
+static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file)
 {
 	return single_open(file, acpi_video_bus_ROM_seq_show, PDE(inode)->data);
 }
 
-static int
-acpi_video_bus_POST_info_seq_show (
-	struct seq_file		*seq,
-	void			*offset)
+static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset)
 {
-	struct acpi_video_bus	*video = (struct acpi_video_bus *) seq->private;
-	unsigned long		options;
-	int			status;
+	struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
+	unsigned long options;
+	int status;
 
 	ACPI_FUNCTION_TRACE("acpi_video_bus_POST_info_seq_show");
 
@@ -1091,8 +1037,10 @@
 	status = acpi_video_bus_POST_options(video, &options);
 	if (ACPI_SUCCESS(status)) {
 		if (!(options & 1)) {
-			printk(KERN_WARNING PREFIX "The motherboard VGA device is not listed as a possible POST device.\n");
-			printk(KERN_WARNING PREFIX "This indicate a BIOS bug.  Please contact the manufacturer.\n");
+			printk(KERN_WARNING PREFIX
+			       "The motherboard VGA device is not listed as a possible POST device.\n");
+			printk(KERN_WARNING PREFIX
+			       "This indicate a BIOS bug.  Please contact the manufacturer.\n");
 		}
 		printk("%lx\n", options);
 		seq_printf(seq, "can POST: <intgrated video>");
@@ -1103,89 +1051,74 @@
 		seq_putc(seq, '\n');
 	} else
 		seq_printf(seq, "<not supported>\n");
-end:
+      end:
 	return_VALUE(0);
 }
 
 static int
-acpi_video_bus_POST_info_open_fs (
-	struct inode		*inode,
-	struct file		*file)
+acpi_video_bus_POST_info_open_fs(struct inode *inode, struct file *file)
 {
-	return single_open(file, acpi_video_bus_POST_info_seq_show, PDE(inode)->data);
+	return single_open(file, acpi_video_bus_POST_info_seq_show,
+			   PDE(inode)->data);
 }
 
-static int
-acpi_video_bus_POST_seq_show (
-	struct seq_file		*seq,
-	void			*offset)
+static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset)
 {
-	struct acpi_video_bus	*video = (struct acpi_video_bus *) seq->private;
-	int			status;
-	unsigned long		id;
+	struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
+	int status;
+	unsigned long id;
 
 	ACPI_FUNCTION_TRACE("acpi_video_bus_POST_seq_show");
 
 	if (!video)
 		goto end;
 
-	status = acpi_video_bus_get_POST (video, &id);
+	status = acpi_video_bus_get_POST(video, &id);
 	if (!ACPI_SUCCESS(status)) {
 		seq_printf(seq, "<not supported>\n");
 		goto end;
 	}
-	seq_printf(seq, "device posted is <%s>\n",  device_decode[id & 3]);
+	seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]);
 
-end:
+      end:
 	return_VALUE(0);
 }
 
-static int
-acpi_video_bus_DOS_seq_show (
-	struct seq_file		*seq,
-	void			*offset)
+static int acpi_video_bus_DOS_seq_show(struct seq_file *seq, void *offset)
 {
-	struct acpi_video_bus	*video = (struct acpi_video_bus *) seq->private;
+	struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
 
 	ACPI_FUNCTION_TRACE("acpi_video_bus_DOS_seq_show");
 
-	seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting );
+	seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting);
 
 	return_VALUE(0);
 }
 
-static int
-acpi_video_bus_POST_open_fs (
-	struct inode		*inode,
-	struct file		*file)
+static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file)
 {
-	return single_open(file, acpi_video_bus_POST_seq_show, PDE(inode)->data);
+	return single_open(file, acpi_video_bus_POST_seq_show,
+			   PDE(inode)->data);
 }
 
-static int
-acpi_video_bus_DOS_open_fs (
-	struct inode		*inode,
-	struct file		*file)
+static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file)
 {
 	return single_open(file, acpi_video_bus_DOS_seq_show, PDE(inode)->data);
 }
 
 static ssize_t
-acpi_video_bus_write_POST (
-	struct file		*file,
-	const char		__user *buffer,
-	size_t			count,
-	loff_t			*data)
+acpi_video_bus_write_POST(struct file *file,
+			  const char __user * buffer,
+			  size_t count, loff_t * data)
 {
-	int			status;
-	struct seq_file		*m = (struct seq_file *) file->private_data;
-	struct acpi_video_bus	*video = (struct acpi_video_bus *) m->private;
-	char			str[12] = {0};
-	unsigned long		opt, options;
+	int status;
+	struct seq_file *m = (struct seq_file *)file->private_data;
+	struct acpi_video_bus *video = (struct acpi_video_bus *)m->private;
+	char str[12] = { 0 };
+	unsigned long opt, options;
 
 	ACPI_FUNCTION_TRACE("acpi_video_bus_write_POST");
 
-
 	if (!video || count + 1 > sizeof str)
 		return_VALUE(-EINVAL);
 
@@ -1205,32 +1138,28 @@
 	options |= 1;
 
 	if (options & (1ul << opt)) {
-		status = acpi_video_bus_set_POST (video, opt);
+		status = acpi_video_bus_set_POST(video, opt);
 		if (!ACPI_SUCCESS(status))
 			return_VALUE(-EFAULT);
 
 	}
 
-
 	return_VALUE(count);
 }
 
 static ssize_t
-acpi_video_bus_write_DOS (
-	struct file		*file,
-	const char		__user *buffer,
-	size_t			count,
-	loff_t			*data)
+acpi_video_bus_write_DOS(struct file *file,
+			 const char __user * buffer,
+			 size_t count, loff_t * data)
 {
-	int			status;
-	struct seq_file		*m = (struct seq_file *) file->private_data;
-	struct acpi_video_bus	*video = (struct acpi_video_bus *) m->private;
-	char			str[12] = {0};
-	unsigned long		opt;
+	int status;
+	struct seq_file *m = (struct seq_file *)file->private_data;
+	struct acpi_video_bus *video = (struct acpi_video_bus *)m->private;
+	char str[12] = { 0 };
+	unsigned long opt;
 
 	ACPI_FUNCTION_TRACE("acpi_video_bus_write_DOS");
 
-
 	if (!video || count + 1 > sizeof str)
 		return_VALUE(-EINVAL);
 
@@ -1242,7 +1171,7 @@
 	if (opt > 7)
 		return_VALUE(-EFAULT);
 
-	status = acpi_video_bus_DOS (video, opt & 0x3, (opt & 0x4)>>2);
+	status = acpi_video_bus_DOS(video, opt & 0x3, (opt & 0x4) >> 2);
 
 	if (!ACPI_SUCCESS(status))
 		return_VALUE(-EFAULT);
@@ -1250,20 +1179,18 @@
 	return_VALUE(count);
 }
 
-static int
-acpi_video_bus_add_fs (
-	struct acpi_device	*device)
+static int acpi_video_bus_add_fs(struct acpi_device *device)
 {
-	struct proc_dir_entry	*entry = NULL;
-	struct acpi_video_bus	*video;
+	struct proc_dir_entry *entry = NULL;
+	struct acpi_video_bus *video;
 
 	ACPI_FUNCTION_TRACE("acpi_video_bus_add_fs");
 
-	video = (struct acpi_video_bus *) acpi_driver_data(device);
+	video = (struct acpi_video_bus *)acpi_driver_data(device);
 
 	if (!acpi_device_dir(device)) {
 		acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
-				acpi_video_dir);
+						     acpi_video_dir);
 		if (!acpi_device_dir(device))
 			return_VALUE(-ENODEV);
 		video->dir = acpi_device_dir(device);
@@ -1273,7 +1200,8 @@
 	/* 'info' [R] */
 	entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device));
 	if (!entry)
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'info' fs entry\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Unable to create 'info' fs entry\n"));
 	else {
 		entry->proc_fops = &acpi_video_bus_info_fops;
 		entry->data = acpi_driver_data(device);
@@ -1283,7 +1211,8 @@
 	/* 'ROM' [R] */
 	entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device));
 	if (!entry)
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'ROM' fs entry\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Unable to create 'ROM' fs entry\n"));
 	else {
 		entry->proc_fops = &acpi_video_bus_ROM_fops;
 		entry->data = acpi_driver_data(device);
@@ -1291,9 +1220,11 @@
 	}
 
 	/* 'POST_info' [R] */
-	entry = create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device));
+	entry =
+	    create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device));
 	if (!entry)
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'POST_info' fs entry\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Unable to create 'POST_info' fs entry\n"));
 	else {
 		entry->proc_fops = &acpi_video_bus_POST_info_fops;
 		entry->data = acpi_driver_data(device);
@@ -1301,9 +1232,12 @@
 	}
 
 	/* 'POST' [R/W] */
-	entry = create_proc_entry("POST", S_IFREG|S_IRUGO|S_IRUSR, acpi_device_dir(device));
+	entry =
+	    create_proc_entry("POST", S_IFREG | S_IRUGO | S_IRUSR,
+			      acpi_device_dir(device));
 	if (!entry)
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'POST' fs entry\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Unable to create 'POST' fs entry\n"));
 	else {
 		entry->proc_fops = &acpi_video_bus_POST_fops;
 		entry->proc_fops->write = acpi_video_bus_write_POST;
@@ -1312,9 +1246,12 @@
 	}
 
 	/* 'DOS' [R/W] */
-	entry = create_proc_entry("DOS", S_IFREG|S_IRUGO|S_IRUSR, acpi_device_dir(device));
+	entry =
+	    create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IRUSR,
+			      acpi_device_dir(device));
 	if (!entry)
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'DOS' fs entry\n"));
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+				  "Unable to create 'DOS' fs entry\n"));
 	else {
 		entry->proc_fops = &acpi_video_bus_DOS_fops;
 		entry->proc_fops->write = acpi_video_bus_write_DOS;
@@ -1325,15 +1262,13 @@
 	return_VALUE(0);
 }
 
-static int
-acpi_video_bus_remove_fs (
-	struct acpi_device	*device)
+static int acpi_video_bus_remove_fs(struct acpi_device *device)
 {
-	struct acpi_video_bus	*video;
+	struct acpi_video_bus *video;
 
 	ACPI_FUNCTION_TRACE("acpi_video_bus_remove_fs");
 
-	video = (struct acpi_video_bus *) acpi_driver_data(device);
+	video = (struct acpi_video_bus *)acpi_driver_data(device);
 
 	if (acpi_device_dir(device)) {
 		remove_proc_entry("info", acpi_device_dir(device));
@@ -1341,8 +1276,7 @@
 		remove_proc_entry("POST_info", acpi_device_dir(device));
 		remove_proc_entry("POST", acpi_device_dir(device));
 		remove_proc_entry("DOS", acpi_device_dir(device));
-		remove_proc_entry(acpi_device_bid(device),
-				acpi_video_dir); 
+		remove_proc_entry(acpi_device_bid(device), acpi_video_dir);
 		acpi_device_dir(device) = NULL;
 	}
 
@@ -1356,20 +1290,20 @@
 /* device interface */
 
 static int
-acpi_video_bus_get_one_device (
-	struct acpi_device	*device,
-	struct acpi_video_bus	*video)
+acpi_video_bus_get_one_device(struct acpi_device *device,
+			      struct acpi_video_bus *video)
 {
-	unsigned long		device_id;
-	int			status, result;
-	struct acpi_video_device	*data;
+	unsigned long device_id;
+	int status, result;
+	struct acpi_video_device *data;
 
 	ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device");
 
 	if (!device || !video)
 		return_VALUE(-EINVAL);
 
-	status = acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
+	status =
+	    acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
 	if (ACPI_SUCCESS(status)) {
 
 		data = kmalloc(sizeof(struct acpi_video_device), GFP_KERNEL);
@@ -1401,15 +1335,17 @@
 			data->flags.unknown = 1;
 			break;
 		}
-		
+
 		acpi_video_device_bind(video, data);
 		acpi_video_device_find_cap(data);
 
 		status = acpi_install_notify_handler(data->handle,
-			ACPI_DEVICE_NOTIFY, acpi_video_device_notify, data);
+						     ACPI_DEVICE_NOTIFY,
+						     acpi_video_device_notify,
+						     data);
 		if (ACPI_FAILURE(status)) {
 			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-				"Error installing notify handler\n"));
+					  "Error installing notify handler\n"));
 			result = -ENODEV;
 			goto end;
 		}
@@ -1423,7 +1359,7 @@
 		return_VALUE(0);
 	}
 
-end:
+      end:
 	return_VALUE(-ENOENT);
 }
 
@@ -1437,15 +1373,15 @@
  *  Enumerate the video device list of the video bus, 
  *  bind the ids with the corresponding video devices
  *  under the video bus.
- */  
+ */
 
-static void
-acpi_video_device_rebind( struct acpi_video_bus *video)
+static void acpi_video_device_rebind(struct acpi_video_bus *video)
 {
-	struct list_head * node, * next;
+	struct list_head *node, *next;
 	list_for_each_safe(node, next, &video->video_device_list) {
-		struct acpi_video_device * dev = container_of(node, struct acpi_video_device, entry);
-		acpi_video_device_bind( video, dev);
+		struct acpi_video_device *dev =
+		    container_of(node, struct acpi_video_device, entry);
+		acpi_video_device_bind(video, dev);
 	}
 }
 
@@ -1460,21 +1396,21 @@
  *  
  *  Bind the ids with the corresponding video devices
  *  under the video bus.
- */  
+ */
 
 static void
-acpi_video_device_bind( struct acpi_video_bus *video,
-			struct acpi_video_device *device)
+acpi_video_device_bind(struct acpi_video_bus *video,
+		       struct acpi_video_device *device)
 {
-	int	i;
+	int i;
 	ACPI_FUNCTION_TRACE("acpi_video_device_bind");
 
 #define IDS_VAL(i) video->attached_array[i].value.int_val
 #define IDS_BIND(i) video->attached_array[i].bind_info
-	
-	for (i = 0; IDS_VAL(i) != ACPI_VIDEO_HEAD_INVALID && 
-		i < video->attached_count; i++) {
-		if (device->device_id == (IDS_VAL(i)& 0xffff)) {
+
+	for (i = 0; IDS_VAL(i) != ACPI_VIDEO_HEAD_INVALID &&
+	     i < video->attached_count; i++) {
+		if (device->device_id == (IDS_VAL(i) & 0xffff)) {
 			IDS_BIND(i) = device;
 			ACPI_DEBUG_PRINT((ACPI_DB_INFO, "device_bind %d\n", i));
 		}
@@ -1492,17 +1428,17 @@
  *  
  *  Call _DOD to enumerate all devices attached to display adapter
  *
- */  
+ */
 
 static int acpi_video_device_enumerate(struct acpi_video_bus *video)
 {
-	int			status;
-	int			count;
-	int			i;
+	int status;
+	int count;
+	int i;
 	struct acpi_video_enumerated_device *active_device_list;
-	struct acpi_buffer	buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-	union acpi_object	*dod = NULL;
-	union acpi_object	*obj;
+	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+	union acpi_object *dod = NULL;
+	union acpi_object *obj;
 
 	ACPI_FUNCTION_TRACE("acpi_video_device_enumerate");
 
@@ -1512,7 +1448,7 @@
 		return_VALUE(status);
 	}
 
-	dod = (union acpi_object *) buffer.pointer;
+	dod = (union acpi_object *)buffer.pointer;
 	if (!dod || (dod->type != ACPI_TYPE_PACKAGE)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _DOD data\n"));
 		status = -EFAULT;
@@ -1520,11 +1456,13 @@
 	}
 
 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d video heads in _DOD\n",
-		dod->package.count));
+			  dod->package.count));
 
-	active_device_list= kmalloc(
- 		(1+dod->package.count)*sizeof(struct acpi_video_enumerated_device),
-	       	GFP_KERNEL);
+	active_device_list = kmalloc((1 +
+				      dod->package.count) *
+				     sizeof(struct
+					    acpi_video_enumerated_device),
+				     GFP_KERNEL);
 
 	if (!active_device_list) {
 		status = -ENOMEM;
@@ -1533,25 +1471,28 @@
 
 	count = 0;
 	for (i = 0; i < dod->package.count; i++) {
-		obj = (union acpi_object *) &dod->package.elements[i];
+		obj = (union acpi_object *)&dod->package.elements[i];
 
 		if (obj->type != ACPI_TYPE_INTEGER) {
-			ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _DOD data\n"));
-			active_device_list[i].value.int_val = ACPI_VIDEO_HEAD_INVALID;
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Invalid _DOD data\n"));
+			active_device_list[i].value.int_val =
+			    ACPI_VIDEO_HEAD_INVALID;
 		}
 		active_device_list[i].value.int_val = obj->integer.value;
 		active_device_list[i].bind_info = NULL;
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "dod element[%d] = %d\n", i, (int) obj->integer.value));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "dod element[%d] = %d\n", i,
+				  (int)obj->integer.value));
 		count++;
 	}
 	active_device_list[count].value.int_val = ACPI_VIDEO_HEAD_END;
 
-	if(video->attached_array)
+	if (video->attached_array)
 		kfree(video->attached_array);
-	
+
 	video->attached_array = active_device_list;
 	video->attached_count = count;
-out:
+      out:
 	acpi_os_free(buffer.pointer);
 	return_VALUE(status);
 }
@@ -1567,17 +1508,14 @@
  *	1. Find out the current active output device.
  *	2. Identify the next output device to switch
  *	3. call _DSS to do actual switch.
- */  
+ */
 
-static int 
-acpi_video_switch_output(
-	struct acpi_video_bus *video, 
-	int	event)
+static int acpi_video_switch_output(struct acpi_video_bus *video, int event)
 {
-	struct list_head * node, * next;
-	struct acpi_video_device *dev=NULL;
-       	struct acpi_video_device *dev_next=NULL;
-	struct acpi_video_device *dev_prev=NULL;
+	struct list_head *node, *next;
+	struct acpi_video_device *dev = NULL;
+	struct acpi_video_device *dev_next = NULL;
+	struct acpi_video_device *dev_prev = NULL;
 	unsigned long state;
 	int status = 0;
 
@@ -1586,15 +1524,19 @@
 	list_for_each_safe(node, next, &video->video_device_list) {
 		dev = container_of(node, struct acpi_video_device, entry);
 		status = acpi_video_device_get_state(dev, &state);
-		if (state & 0x2){
-			dev_next = container_of(node->next, struct acpi_video_device, entry);
-			dev_prev = container_of(node->prev, struct acpi_video_device, entry);
+		if (state & 0x2) {
+			dev_next =
+			    container_of(node->next, struct acpi_video_device,
+					 entry);
+			dev_prev =
+			    container_of(node->prev, struct acpi_video_device,
+					 entry);
 			goto out;
 		}
 	}
 	dev_next = container_of(node->next, struct acpi_video_device, entry);
 	dev_prev = container_of(node->prev, struct acpi_video_device, entry);
-out:	
+      out:
 	switch (event) {
 	case ACPI_VIDEO_NOTIFY_CYCLE:
 	case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT:
@@ -1611,21 +1553,16 @@
 	return_VALUE(status);
 }
 
-static int 
-acpi_video_get_next_level(
-	struct acpi_video_device *device,
-	u32	level_current,
-	u32	event)
+static int
+acpi_video_get_next_level(struct acpi_video_device *device,
+			  u32 level_current, u32 event)
 {
-	/*Fix me*/
+	/*Fix me */
 	return level_current;
 }
 
-
 static void
-acpi_video_switch_brightness (
-	struct acpi_video_device *device, 
-	int	event)
+acpi_video_switch_brightness(struct acpi_video_device *device, int event)
 {
 	unsigned long level_current, level_next;
 	acpi_video_device_lcd_get_level_current(device, &level_current);
@@ -1634,26 +1571,27 @@
 }
 
 static int
-acpi_video_bus_get_devices (
-	struct acpi_video_bus	*video,
-	struct acpi_device	*device)
+acpi_video_bus_get_devices(struct acpi_video_bus *video,
+			   struct acpi_device *device)
 {
-	int			status = 0;
-	struct list_head	*node, *next;
+	int status = 0;
+	struct list_head *node, *next;
 
 	ACPI_FUNCTION_TRACE("acpi_video_get_devices");
 
 	acpi_video_device_enumerate(video);
 
 	list_for_each_safe(node, next, &device->children) {
-		struct acpi_device *dev = list_entry(node, struct acpi_device, node);
+		struct acpi_device *dev =
+		    list_entry(node, struct acpi_device, node);
 
 		if (!dev)
 			continue;
 
 		status = acpi_video_bus_get_one_device(dev, video);
 		if (ACPI_FAILURE(status)) {
-			ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Cant attach device\n"));
+			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+					  "Cant attach device\n"));
 			continue;
 		}
 
@@ -1661,9 +1599,7 @@
 	return_VALUE(status);
 }
 
-static int
-acpi_video_bus_put_one_device(
-	struct acpi_video_device	*device)
+static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
 {
 	acpi_status status;
 	struct acpi_video_bus *video;
@@ -1681,31 +1617,32 @@
 	acpi_video_device_remove_fs(device->dev);
 
 	status = acpi_remove_notify_handler(device->handle,
-		ACPI_DEVICE_NOTIFY, acpi_video_device_notify);
+					    ACPI_DEVICE_NOTIFY,
+					    acpi_video_device_notify);
 	if (ACPI_FAILURE(status))
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Error removing notify handler\n"));
+				  "Error removing notify handler\n"));
 
 	return_VALUE(0);
 }
 
-static int
-acpi_video_bus_put_devices (
-	struct acpi_video_bus	*video)
+static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
 {
-	int			status;
-	struct list_head	*node, *next;
+	int status;
+	struct list_head *node, *next;
 
 	ACPI_FUNCTION_TRACE("acpi_video_bus_put_devices");
 
 	list_for_each_safe(node, next, &video->video_device_list) {
-		struct acpi_video_device *data = list_entry(node, struct acpi_video_device, entry);
+		struct acpi_video_device *data =
+		    list_entry(node, struct acpi_video_device, entry);
 		if (!data)
 			continue;
 
 		status = acpi_video_bus_put_one_device(data);
-		if(ACPI_FAILURE(status))
-			printk(KERN_WARNING PREFIX "hhuuhhuu bug in acpi video driver.\n");
+		if (ACPI_FAILURE(status))
+			printk(KERN_WARNING PREFIX
+			       "hhuuhhuu bug in acpi video driver.\n");
 
 		if (data->brightness)
 			kfree(data->brightness);
@@ -1718,28 +1655,20 @@
 
 /* acpi_video interface */
 
-static int
-acpi_video_bus_start_devices(
-	struct acpi_video_bus	*video)
+static int acpi_video_bus_start_devices(struct acpi_video_bus *video)
 {
 	return acpi_video_bus_DOS(video, 1, 0);
 }
 
-static int
-acpi_video_bus_stop_devices(
-	struct acpi_video_bus	*video)
+static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)
 {
 	return acpi_video_bus_DOS(video, 0, 1);
 }
 
-static void
-acpi_video_bus_notify (
-	acpi_handle		handle,
-	u32			event,
-	void			*data)
+static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
 {
-	struct acpi_video_bus	*video = (struct acpi_video_bus *) data;
-	struct acpi_device	*device = NULL;
+	struct acpi_video_bus *video = (struct acpi_video_bus *)data;
+	struct acpi_device *device = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_video_bus_notify");
 	printk("video bus notify\n");
@@ -1764,30 +1693,27 @@
 		acpi_bus_generate_event(device, event, 0);
 		break;
 
-	case ACPI_VIDEO_NOTIFY_CYCLE: /* Cycle Display output hotkey pressed.*/
-	case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: /* Next Display output hotkey pressed. */
-	case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: /* previous Display output hotkey pressed. */
+	case ACPI_VIDEO_NOTIFY_CYCLE:	/* Cycle Display output hotkey pressed. */
+	case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT:	/* Next Display output hotkey pressed. */
+	case ACPI_VIDEO_NOTIFY_PREV_OUTPUT:	/* previous Display output hotkey pressed. */
 		acpi_video_switch_output(video, event);
 		acpi_bus_generate_event(device, event, 0);
 		break;
 
 	default:
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-			"Unsupported event [0x%x]\n", event));
+				  "Unsupported event [0x%x]\n", event));
 		break;
 	}
 
 	return_VOID;
 }
 
-static void
-acpi_video_device_notify (
-	acpi_handle		handle,
-	u32			event,
-	void			*data)
+static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
 {
-	struct acpi_video_device	*video_device = (struct acpi_video_device *) data;
-	struct acpi_device	*device = NULL;
+	struct acpi_video_device *video_device =
+	    (struct acpi_video_device *)data;
+	struct acpi_device *device = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_video_device_notify");
 
@@ -1799,36 +1725,34 @@
 		return_VOID;
 
 	switch (event) {
-	case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */
-	case ACPI_VIDEO_NOTIFY_PROBE: /* change in status (output device status) */
+	case ACPI_VIDEO_NOTIFY_SWITCH:	/* change in status (cycle output device) */
+	case ACPI_VIDEO_NOTIFY_PROBE:	/* change in status (output device status) */
 		acpi_bus_generate_event(device, event, 0);
 		break;
-	case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */
-	case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: /* Increase brightness */
-	case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: /* Decrease brightness */
-	case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightnesss */
-	case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */
-		acpi_video_switch_brightness (video_device, event);
+	case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS:	/* Cycle brightness */
+	case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS:	/* Increase brightness */
+	case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS:	/* Decrease brightness */
+	case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS:	/* zero brightnesss */
+	case ACPI_VIDEO_NOTIFY_DISPLAY_OFF:	/* display device off */
+		acpi_video_switch_brightness(video_device, event);
 		acpi_bus_generate_event(device, event, 0);
 		break;
 	default:
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-			"Unsupported event [0x%x]\n", event));
+				  "Unsupported event [0x%x]\n", event));
 		break;
 	}
 	return_VOID;
 }
 
-static int
-acpi_video_bus_add (
-	struct acpi_device	*device)
+static int acpi_video_bus_add(struct acpi_device *device)
 {
-	int			result = 0;
-	acpi_status		status = 0;
-	struct acpi_video_bus	*video = NULL;
+	int result = 0;
+	acpi_status status = 0;
+	struct acpi_video_bus *video = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_video_bus_add");
-	
+
 	if (!device)
 		return_VALUE(-EINVAL);
 
@@ -1858,21 +1782,22 @@
 	acpi_video_bus_start_devices(video);
 
 	status = acpi_install_notify_handler(video->handle,
-		ACPI_DEVICE_NOTIFY, acpi_video_bus_notify, video);
+					     ACPI_DEVICE_NOTIFY,
+					     acpi_video_bus_notify, video);
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Error installing notify handler\n"));
+				  "Error installing notify handler\n"));
 		result = -ENODEV;
 		goto end;
 	}
 
 	printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s  rom: %s  post: %s)\n",
-		ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device),
-		video->flags.multihead ? "yes":"no",
-		video->flags.rom ? "yes":"no",
-		video->flags.post ? "yes":"no");
+	       ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device),
+	       video->flags.multihead ? "yes" : "no",
+	       video->flags.rom ? "yes" : "no",
+	       video->flags.post ? "yes" : "no");
 
-end:
+      end:
 	if (result) {
 		acpi_video_bus_remove_fs(device);
 		kfree(video);
@@ -1881,28 +1806,26 @@
 	return_VALUE(result);
 }
 
-static int
-acpi_video_bus_remove (
-	struct acpi_device	*device,
-	int			type)
+static int acpi_video_bus_remove(struct acpi_device *device, int type)
 {
-	acpi_status		status = 0;
-	struct acpi_video_bus	*video = NULL;
+	acpi_status status = 0;
+	struct acpi_video_bus *video = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_video_bus_remove");
 
 	if (!device || !acpi_driver_data(device))
 		return_VALUE(-EINVAL);
 
-	video = (struct acpi_video_bus *) acpi_driver_data(device);
+	video = (struct acpi_video_bus *)acpi_driver_data(device);
 
 	acpi_video_bus_stop_devices(video);
 
 	status = acpi_remove_notify_handler(video->handle,
-		ACPI_DEVICE_NOTIFY, acpi_video_bus_notify);
+					    ACPI_DEVICE_NOTIFY,
+					    acpi_video_bus_notify);
 	if (ACPI_FAILURE(status))
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-			"Error removing notify handler\n"));
+				  "Error removing notify handler\n"));
 
 	acpi_video_bus_put_devices(video);
 	acpi_video_bus_remove_fs(device);
@@ -1914,15 +1837,12 @@
 	return_VALUE(0);
 }
 
-
 static int
-acpi_video_bus_match (
-	struct acpi_device	*device,
-	struct acpi_driver	*driver)
+acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver)
 {
-	acpi_handle		h_dummy1;
-	acpi_handle		h_dummy2;
-	acpi_handle		h_dummy3;
+	acpi_handle h_dummy1;
+	acpi_handle h_dummy2;
+	acpi_handle h_dummy3;
 
 	ACPI_FUNCTION_TRACE("acpi_video_bus_match");
 
@@ -1948,22 +1868,19 @@
 	    ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3)))
 		return_VALUE(0);
 
-
 	return_VALUE(-ENODEV);
 }
 
-
-static int __init
-acpi_video_init (void)
+static int __init acpi_video_init(void)
 {
-	int			result = 0;
+	int result = 0;
 
 	ACPI_FUNCTION_TRACE("acpi_video_init");
 
 	/*
-	acpi_dbg_level = 0xFFFFFFFF;
-	acpi_dbg_layer = 0x08000000;
-	*/
+	   acpi_dbg_level = 0xFFFFFFFF;
+	   acpi_dbg_layer = 0x08000000;
+	 */
 
 	acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir);
 	if (!acpi_video_dir)
@@ -1979,8 +1896,7 @@
 	return_VALUE(0);
 }
 
-static void __exit
-acpi_video_exit (void)
+static void __exit acpi_video_exit(void)
 {
 	ACPI_FUNCTION_TRACE("acpi_video_exit");
 
