aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/video.c
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2013-08-03 16:12:50 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-08-03 16:12:50 -0400
commit915ea7e41439efa7793814cdf4338cb6b003538a (patch)
tree9b40f37ad6a423c280c17f6e5931e7357e6d6663 /drivers/acpi/video.c
parent21fcb34e28e99291e91d83422f2824f11b3c9ce9 (diff)
ACPI / video: trivial style cleanups
Fix several coding style defects in drivers/acpi/video.c: - Initialization of static variables. - Whitespace in expressions, variable definitions, function headers, etc. - Positioning of labels. - Braces around single statements. [rjw: Changelog] Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r--drivers/acpi/video.c80
1 files changed, 35 insertions, 45 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index f021bf4d9307..fff5bb3ffda8 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -88,7 +88,7 @@ module_param(allow_duplicates, bool, 0644);
88static bool use_bios_initial_backlight = 1; 88static bool use_bios_initial_backlight = 1;
89module_param(use_bios_initial_backlight, bool, 0644); 89module_param(use_bios_initial_backlight, bool, 0644);
90 90
91static int register_count = 0; 91static int register_count;
92static int acpi_video_bus_add(struct acpi_device *device); 92static int acpi_video_bus_add(struct acpi_device *device);
93static int acpi_video_bus_remove(struct acpi_device *device); 93static int acpi_video_bus_remove(struct acpi_device *device);
94static void acpi_video_bus_notify(struct acpi_device *device, u32 event); 94static void acpi_video_bus_notify(struct acpi_device *device, u32 event);
@@ -247,7 +247,7 @@ static int acpi_video_get_brightness(struct backlight_device *bd)
247 * The first two entries are special - see page 575 247 * The first two entries are special - see page 575
248 * of the ACPI spec 3.0 248 * of the ACPI spec 3.0
249 */ 249 */
250 return i-2; 250 return i - 2;
251 } 251 }
252 return 0; 252 return 0;
253} 253}
@@ -304,11 +304,11 @@ video_set_cur_state(struct thermal_cooling_device *cooling_dev, unsigned long st
304 struct acpi_video_device *video = acpi_driver_data(device); 304 struct acpi_video_device *video = acpi_driver_data(device);
305 int level; 305 int level;
306 306
307 if ( state >= video->brightness->count - 2) 307 if (state >= video->brightness->count - 2)
308 return -EINVAL; 308 return -EINVAL;
309 309
310 state = video->brightness->count - state; 310 state = video->brightness->count - state;
311 level = video->brightness->levels[state -1]; 311 level = video->brightness->levels[state - 1];
312 return acpi_video_device_lcd_set_level(video, level); 312 return acpi_video_device_lcd_set_level(video, level);
313} 313}
314 314
@@ -349,7 +349,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
349 349
350 return 0; 350 return 0;
351 351
352 err: 352err:
353 kfree(buffer.pointer); 353 kfree(buffer.pointer);
354 354
355 return status; 355 return status;
@@ -550,7 +550,7 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
550 if (device->brightness->levels[i] == *level) { 550 if (device->brightness->levels[i] == *level) {
551 device->brightness->curr = *level; 551 device->brightness->curr = *level;
552 return 0; 552 return 0;
553 } 553 }
554 /* 554 /*
555 * BQC returned an invalid level. 555 * BQC returned an invalid level.
556 * Stop using it. 556 * Stop using it.
@@ -892,16 +892,13 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
892{ 892{
893 acpi_handle h_dummy1; 893 acpi_handle h_dummy1;
894 894
895 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1))) { 895 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1)))
896 device->cap._ADR = 1; 896 device->cap._ADR = 1;
897 } 897 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCL", &h_dummy1)))
898 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCL", &h_dummy1))) {
899 device->cap._BCL = 1; 898 device->cap._BCL = 1;
900 } 899 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCM", &h_dummy1)))
901 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCM", &h_dummy1))) {
902 device->cap._BCM = 1; 900 device->cap._BCM = 1;
903 } 901 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BQC", &h_dummy1)))
904 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle,"_BQC",&h_dummy1)))
905 device->cap._BQC = 1; 902 device->cap._BQC = 1;
906 else if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCQ", 903 else if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCQ",
907 &h_dummy1))) { 904 &h_dummy1))) {
@@ -909,9 +906,8 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
909 device->cap._BCQ = 1; 906 device->cap._BCQ = 1;
910 } 907 }
911 908
912 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DDC", &h_dummy1))) { 909 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DDC", &h_dummy1)))
913 device->cap._DDC = 1; 910 device->cap._DDC = 1;
914 }
915 911
916 if (acpi_video_init_brightness(device)) 912 if (acpi_video_init_brightness(device))
917 return; 913 return;
@@ -922,7 +918,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
922 acpi_handle acpi_parent; 918 acpi_handle acpi_parent;
923 struct device *parent = NULL; 919 struct device *parent = NULL;
924 int result; 920 int result;
925 static int count = 0; 921 static int count;
926 char *name; 922 char *name;
927 923
928 name = kasprintf(GFP_KERNEL, "acpi_video%d", count); 924 name = kasprintf(GFP_KERNEL, "acpi_video%d", count);
@@ -1006,24 +1002,18 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
1006{ 1002{
1007 acpi_handle h_dummy1; 1003 acpi_handle h_dummy1;
1008 1004
1009 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1))) { 1005 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1)))
1010 video->cap._DOS = 1; 1006 video->cap._DOS = 1;
1011 } 1007 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOD", &h_dummy1)))
1012 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOD", &h_dummy1))) {
1013 video->cap._DOD = 1; 1008 video->cap._DOD = 1;
1014 } 1009 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_ROM", &h_dummy1)))
1015 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_ROM", &h_dummy1))) {
1016 video->cap._ROM = 1; 1010 video->cap._ROM = 1;
1017 } 1011 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_GPD", &h_dummy1)))
1018 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_GPD", &h_dummy1))) {
1019 video->cap._GPD = 1; 1012 video->cap._GPD = 1;
1020 } 1013 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_SPD", &h_dummy1)))
1021 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_SPD", &h_dummy1))) {
1022 video->cap._SPD = 1; 1014 video->cap._SPD = 1;
1023 } 1015 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_VPO", &h_dummy1)))
1024 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_VPO", &h_dummy1))) {
1025 video->cap._VPO = 1; 1016 video->cap._VPO = 1;
1026 }
1027} 1017}
1028 1018
1029/* 1019/*
@@ -1082,7 +1072,7 @@ static int acpi_video_bus_check(struct acpi_video_bus *video)
1082 */ 1072 */
1083 1073
1084/* device interface */ 1074/* device interface */
1085static struct acpi_video_device_attrib* 1075static struct acpi_video_device_attrib *
1086acpi_video_get_device_attr(struct acpi_video_bus *video, unsigned long device_id) 1076acpi_video_get_device_attr(struct acpi_video_bus *video, unsigned long device_id)
1087{ 1077{
1088 struct acpi_video_enumerated_device *ids; 1078 struct acpi_video_enumerated_device *ids;
@@ -1120,7 +1110,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
1120 unsigned long long device_id; 1110 unsigned long long device_id;
1121 int status, device_type; 1111 int status, device_type;
1122 struct acpi_video_device *data; 1112 struct acpi_video_device *data;
1123 struct acpi_video_device_attrib* attribute; 1113 struct acpi_video_device_attrib *attribute;
1124 1114
1125 status = 1115 status =
1126 acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id); 1116 acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
@@ -1142,7 +1132,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
1142 1132
1143 attribute = acpi_video_get_device_attr(video, device_id); 1133 attribute = acpi_video_get_device_attr(video, device_id);
1144 1134
1145 if((attribute != NULL) && attribute->device_id_scheme) { 1135 if (attribute && attribute->device_id_scheme) {
1146 switch (attribute->display_type) { 1136 switch (attribute->display_type) {
1147 case ACPI_VIDEO_DISPLAY_CRT: 1137 case ACPI_VIDEO_DISPLAY_CRT:
1148 data->flags.crt = 1; 1138 data->flags.crt = 1;
@@ -1160,24 +1150,24 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
1160 data->flags.unknown = 1; 1150 data->flags.unknown = 1;
1161 break; 1151 break;
1162 } 1152 }
1163 if(attribute->bios_can_detect) 1153 if (attribute->bios_can_detect)
1164 data->flags.bios = 1; 1154 data->flags.bios = 1;
1165 } else { 1155 } else {
1166 /* Check for legacy IDs */ 1156 /* Check for legacy IDs */
1167 device_type = acpi_video_get_device_type(video, device_id); 1157 device_type = acpi_video_get_device_type(video, device_id);
1168 /* Ignore bits 16 and 18-20 */ 1158 /* Ignore bits 16 and 18-20 */
1169 switch (device_type & 0xffe2ffff) { 1159 switch (device_type & 0xffe2ffff) {
1170 case ACPI_VIDEO_DISPLAY_LEGACY_MONITOR: 1160 case ACPI_VIDEO_DISPLAY_LEGACY_MONITOR:
1171 data->flags.crt = 1; 1161 data->flags.crt = 1;
1172 break; 1162 break;
1173 case ACPI_VIDEO_DISPLAY_LEGACY_PANEL: 1163 case ACPI_VIDEO_DISPLAY_LEGACY_PANEL:
1174 data->flags.lcd = 1; 1164 data->flags.lcd = 1;
1175 break; 1165 break;
1176 case ACPI_VIDEO_DISPLAY_LEGACY_TV: 1166 case ACPI_VIDEO_DISPLAY_LEGACY_TV:
1177 data->flags.tvout = 1; 1167 data->flags.tvout = 1;
1178 break; 1168 break;
1179 default: 1169 default:
1180 data->flags.unknown = 1; 1170 data->flags.unknown = 1;
1181 } 1171 }
1182 } 1172 }
1183 1173
@@ -1318,7 +1308,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
1318 video->attached_array = active_list; 1308 video->attached_array = active_list;
1319 video->attached_count = count; 1309 video->attached_count = count;
1320 1310
1321 out: 1311out:
1322 kfree(buffer.pointer); 1312 kfree(buffer.pointer);
1323 return status; 1313 return status;
1324} 1314}
@@ -1773,7 +1763,7 @@ static int acpi_video_bus_add(struct acpi_device *device)
1773 if (!strcmp(device->pnp.bus_id, "VID")) { 1763 if (!strcmp(device->pnp.bus_id, "VID")) {
1774 if (instance) 1764 if (instance)
1775 device->pnp.bus_id[3] = '0' + instance; 1765 device->pnp.bus_id[3] = '0' + instance;
1776 instance ++; 1766 instance++;
1777 } 1767 }
1778 /* a hack to fix the duplicate name "VGA" problem on Pa 3553 */ 1768 /* a hack to fix the duplicate name "VGA" problem on Pa 3553 */
1779 if (!strcmp(device->pnp.bus_id, "VGA")) { 1769 if (!strcmp(device->pnp.bus_id, "VGA")) {