aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/asus_acpi.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-03-29 18:21:35 -0400
committerMatthew Garrett <mjg@redhat.com>2011-05-27 12:35:46 -0400
commit5ad77dcfb49a85715bcb9174a133cba140eda1bc (patch)
treee32c0ce7a6fa42d35268a93a291a39faa5165a07 /drivers/platform/x86/asus_acpi.c
parent249c720d88fa325522cb763dda09f8c9e8e964cb (diff)
asus: Add pr_fmt and convert printks to pr_<level>
Add pr_fmt, prefixes each log message. Convert printks to pr_<level>. Convert pr_warning to pr_warn. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform/x86/asus_acpi.c')
-rw-r--r--drivers/platform/x86/asus_acpi.c77
1 files changed, 32 insertions, 45 deletions
diff --git a/drivers/platform/x86/asus_acpi.c b/drivers/platform/x86/asus_acpi.c
index f503607c064..d9312b3073e 100644
--- a/drivers/platform/x86/asus_acpi.c
+++ b/drivers/platform/x86/asus_acpi.c
@@ -30,6 +30,8 @@
30 * 30 *
31 */ 31 */
32 32
33#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
34
33#include <linux/kernel.h> 35#include <linux/kernel.h>
34#include <linux/module.h> 36#include <linux/module.h>
35#include <linux/slab.h> 37#include <linux/slab.h>
@@ -581,8 +583,7 @@ static int read_led(const char *ledname, int ledmask)
581 if (read_acpi_int(NULL, ledname, &led_status)) 583 if (read_acpi_int(NULL, ledname, &led_status))
582 return led_status; 584 return led_status;
583 else 585 else
584 printk(KERN_WARNING "Asus ACPI: Error reading LED " 586 pr_warn("Error reading LED status\n");
585 "status\n");
586 } 587 }
587 return (hotk->status & ledmask) ? 1 : 0; 588 return (hotk->status & ledmask) ? 1 : 0;
588} 589}
@@ -621,8 +622,7 @@ write_led(const char __user *buffer, unsigned long count,
621 led_out = !led_out; 622 led_out = !led_out;
622 623
623 if (!write_acpi_int(hotk->handle, ledname, led_out, NULL)) 624 if (!write_acpi_int(hotk->handle, ledname, led_out, NULL))
624 printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n", 625 pr_warn("LED (%s) write failed\n", ledname);
625 ledname);
626 626
627 return rv; 627 return rv;
628} 628}
@@ -679,8 +679,7 @@ static ssize_t ledd_proc_write(struct file *file, const char __user *buffer,
679 if (rv > 0) { 679 if (rv > 0) {
680 if (!write_acpi_int 680 if (!write_acpi_int
681 (hotk->handle, hotk->methods->mt_ledd, value, NULL)) 681 (hotk->handle, hotk->methods->mt_ledd, value, NULL))
682 printk(KERN_WARNING 682 pr_warn("LED display write failed\n");
683 "Asus ACPI: LED display write failed\n");
684 else 683 else
685 hotk->ledd_status = (u32) value; 684 hotk->ledd_status = (u32) value;
686 } 685 }
@@ -838,8 +837,7 @@ static int get_lcd_state(void)
838 } else { 837 } else {
839 /* We don't have to check anything if we are here */ 838 /* We don't have to check anything if we are here */
840 if (!read_acpi_int(NULL, hotk->methods->lcd_status, &lcd)) 839 if (!read_acpi_int(NULL, hotk->methods->lcd_status, &lcd))
841 printk(KERN_WARNING 840 pr_warn("Error reading LCD status\n");
842 "Asus ACPI: Error reading LCD status\n");
843 841
844 if (hotk->model == L2D) 842 if (hotk->model == L2D)
845 lcd = ~lcd; 843 lcd = ~lcd;
@@ -871,7 +869,7 @@ static int set_lcd_state(int value)
871 the exact behaviour is simulated here */ 869 the exact behaviour is simulated here */
872 } 870 }
873 if (ACPI_FAILURE(status)) 871 if (ACPI_FAILURE(status))
874 printk(KERN_WARNING "Asus ACPI: Error switching LCD\n"); 872 pr_warn("Error switching LCD\n");
875 } 873 }
876 return 0; 874 return 0;
877 875
@@ -915,13 +913,11 @@ static int read_brightness(struct backlight_device *bd)
915 if (hotk->methods->brightness_get) { /* SPLV/GPLV laptop */ 913 if (hotk->methods->brightness_get) { /* SPLV/GPLV laptop */
916 if (!read_acpi_int(hotk->handle, hotk->methods->brightness_get, 914 if (!read_acpi_int(hotk->handle, hotk->methods->brightness_get,
917 &value)) 915 &value))
918 printk(KERN_WARNING 916 pr_warn("Error reading brightness\n");
919 "Asus ACPI: Error reading brightness\n");
920 } else if (hotk->methods->brightness_status) { /* For D1 for example */ 917 } else if (hotk->methods->brightness_status) { /* For D1 for example */
921 if (!read_acpi_int(NULL, hotk->methods->brightness_status, 918 if (!read_acpi_int(NULL, hotk->methods->brightness_status,
922 &value)) 919 &value))
923 printk(KERN_WARNING 920 pr_warn("Error reading brightness\n");
924 "Asus ACPI: Error reading brightness\n");
925 } else /* No GPLV method */ 921 } else /* No GPLV method */
926 value = hotk->brightness; 922 value = hotk->brightness;
927 return value; 923 return value;
@@ -939,8 +935,7 @@ static int set_brightness(int value)
939 if (hotk->methods->brightness_set) { 935 if (hotk->methods->brightness_set) {
940 if (!write_acpi_int(hotk->handle, hotk->methods->brightness_set, 936 if (!write_acpi_int(hotk->handle, hotk->methods->brightness_set,
941 value, NULL)) { 937 value, NULL)) {
942 printk(KERN_WARNING 938 pr_warn("Error changing brightness\n");
943 "Asus ACPI: Error changing brightness\n");
944 ret = -EIO; 939 ret = -EIO;
945 } 940 }
946 goto out; 941 goto out;
@@ -955,8 +950,7 @@ static int set_brightness(int value)
955 NULL, NULL); 950 NULL, NULL);
956 (value > 0) ? value-- : value++; 951 (value > 0) ? value-- : value++;
957 if (ACPI_FAILURE(status)) { 952 if (ACPI_FAILURE(status)) {
958 printk(KERN_WARNING 953 pr_warn("Error changing brightness\n");
959 "Asus ACPI: Error changing brightness\n");
960 ret = -EIO; 954 ret = -EIO;
961 } 955 }
962 } 956 }
@@ -1008,7 +1002,7 @@ static void set_display(int value)
1008 /* no sanity check needed for now */ 1002 /* no sanity check needed for now */
1009 if (!write_acpi_int(hotk->handle, hotk->methods->display_set, 1003 if (!write_acpi_int(hotk->handle, hotk->methods->display_set,
1010 value, NULL)) 1004 value, NULL))
1011 printk(KERN_WARNING "Asus ACPI: Error setting display\n"); 1005 pr_warn("Error setting display\n");
1012 return; 1006 return;
1013} 1007}
1014 1008
@@ -1021,8 +1015,7 @@ static int disp_proc_show(struct seq_file *m, void *v)
1021 int value = 0; 1015 int value = 0;
1022 1016
1023 if (!read_acpi_int(hotk->handle, hotk->methods->display_get, &value)) 1017 if (!read_acpi_int(hotk->handle, hotk->methods->display_get, &value))
1024 printk(KERN_WARNING 1018 pr_warn("Error reading display status\n");
1025 "Asus ACPI: Error reading display status\n");
1026 value &= 0x07; /* needed for some models, shouldn't hurt others */ 1019 value &= 0x07; /* needed for some models, shouldn't hurt others */
1027 seq_printf(m, "%d\n", value); 1020 seq_printf(m, "%d\n", value);
1028 return 0; 1021 return 0;
@@ -1068,7 +1061,7 @@ asus_proc_add(char *name, const struct file_operations *proc_fops, mode_t mode,
1068 proc = proc_create_data(name, mode, acpi_device_dir(device), 1061 proc = proc_create_data(name, mode, acpi_device_dir(device),
1069 proc_fops, acpi_driver_data(device)); 1062 proc_fops, acpi_driver_data(device));
1070 if (!proc) { 1063 if (!proc) {
1071 printk(KERN_WARNING " Unable to create %s fs entry\n", name); 1064 pr_warn(" Unable to create %s fs entry\n", name);
1072 return -1; 1065 return -1;
1073 } 1066 }
1074 proc->uid = asus_uid; 1067 proc->uid = asus_uid;
@@ -1085,8 +1078,8 @@ static int asus_hotk_add_fs(struct acpi_device *device)
1085 mode = S_IFREG | S_IRUGO | S_IWUSR | S_IWGRP; 1078 mode = S_IFREG | S_IRUGO | S_IWUSR | S_IWGRP;
1086 } else { 1079 } else {
1087 mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP; 1080 mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP;
1088 printk(KERN_WARNING " asus_uid and asus_gid parameters are " 1081 pr_warn(" asus_uid and asus_gid parameters are "
1089 "deprecated, use chown and chmod instead!\n"); 1082 "deprecated, use chown and chmod instead!\n");
1090 } 1083 }
1091 1084
1092 acpi_device_dir(device) = asus_proc_dir; 1085 acpi_device_dir(device) = asus_proc_dir;
@@ -1099,8 +1092,7 @@ static int asus_hotk_add_fs(struct acpi_device *device)
1099 proc->uid = asus_uid; 1092 proc->uid = asus_uid;
1100 proc->gid = asus_gid; 1093 proc->gid = asus_gid;
1101 } else { 1094 } else {
1102 printk(KERN_WARNING " Unable to create " PROC_INFO 1095 pr_warn(" Unable to create " PROC_INFO " fs entry\n");
1103 " fs entry\n");
1104 } 1096 }
1105 1097
1106 if (hotk->methods->mt_wled) { 1098 if (hotk->methods->mt_wled) {
@@ -1283,20 +1275,19 @@ static int asus_hotk_get_info(void)
1283 */ 1275 */
1284 status = acpi_get_table(ACPI_SIG_DSDT, 1, &asus_info); 1276 status = acpi_get_table(ACPI_SIG_DSDT, 1, &asus_info);
1285 if (ACPI_FAILURE(status)) 1277 if (ACPI_FAILURE(status))
1286 printk(KERN_WARNING " Couldn't get the DSDT table header\n"); 1278 pr_warn(" Couldn't get the DSDT table header\n");
1287 1279
1288 /* We have to write 0 on init this far for all ASUS models */ 1280 /* We have to write 0 on init this far for all ASUS models */
1289 if (!write_acpi_int(hotk->handle, "INIT", 0, &buffer)) { 1281 if (!write_acpi_int(hotk->handle, "INIT", 0, &buffer)) {
1290 printk(KERN_ERR " Hotkey initialization failed\n"); 1282 pr_err(" Hotkey initialization failed\n");
1291 return -ENODEV; 1283 return -ENODEV;
1292 } 1284 }
1293 1285
1294 /* This needs to be called for some laptops to init properly */ 1286 /* This needs to be called for some laptops to init properly */
1295 if (!read_acpi_int(hotk->handle, "BSTS", &bsts_result)) 1287 if (!read_acpi_int(hotk->handle, "BSTS", &bsts_result))
1296 printk(KERN_WARNING " Error calling BSTS\n"); 1288 pr_warn(" Error calling BSTS\n");
1297 else if (bsts_result) 1289 else if (bsts_result)
1298 printk(KERN_NOTICE " BSTS called, 0x%02x returned\n", 1290 pr_notice(" BSTS called, 0x%02x returned\n", bsts_result);
1299 bsts_result);
1300 1291
1301 /* 1292 /*
1302 * Try to match the object returned by INIT to the specific model. 1293 * Try to match the object returned by INIT to the specific model.
@@ -1324,23 +1315,21 @@ static int asus_hotk_get_info(void)
1324 if (asus_info && 1315 if (asus_info &&
1325 strncmp(asus_info->oem_table_id, "ODEM", 4) == 0) { 1316 strncmp(asus_info->oem_table_id, "ODEM", 4) == 0) {
1326 hotk->model = P30; 1317 hotk->model = P30;
1327 printk(KERN_NOTICE 1318 pr_notice(" Samsung P30 detected, supported\n");
1328 " Samsung P30 detected, supported\n");
1329 hotk->methods = &model_conf[hotk->model]; 1319 hotk->methods = &model_conf[hotk->model];
1330 kfree(model); 1320 kfree(model);
1331 return 0; 1321 return 0;
1332 } else { 1322 } else {
1333 hotk->model = M2E; 1323 hotk->model = M2E;
1334 printk(KERN_NOTICE " unsupported model %s, trying " 1324 pr_notice(" unsupported model %s, trying default values\n",
1335 "default values\n", string); 1325 string);
1336 printk(KERN_NOTICE 1326 pr_notice(" send /proc/acpi/dsdt to the developers\n");
1337 " send /proc/acpi/dsdt to the developers\n");
1338 kfree(model); 1327 kfree(model);
1339 return -ENODEV; 1328 return -ENODEV;
1340 } 1329 }
1341 } 1330 }
1342 hotk->methods = &model_conf[hotk->model]; 1331 hotk->methods = &model_conf[hotk->model];
1343 printk(KERN_NOTICE " %s model detected, supported\n", string); 1332 pr_notice(" %s model detected, supported\n", string);
1344 1333
1345 /* Sort of per-model blacklist */ 1334 /* Sort of per-model blacklist */
1346 if (strncmp(string, "L2B", 3) == 0) 1335 if (strncmp(string, "L2B", 3) == 0)
@@ -1385,7 +1374,7 @@ static int asus_hotk_check(void)
1385 if (hotk->device->status.present) { 1374 if (hotk->device->status.present) {
1386 result = asus_hotk_get_info(); 1375 result = asus_hotk_get_info();
1387 } else { 1376 } else {
1388 printk(KERN_ERR " Hotkey device not present, aborting\n"); 1377 pr_err(" Hotkey device not present, aborting\n");
1389 return -EINVAL; 1378 return -EINVAL;
1390 } 1379 }
1391 1380
@@ -1399,8 +1388,7 @@ static int asus_hotk_add(struct acpi_device *device)
1399 acpi_status status = AE_OK; 1388 acpi_status status = AE_OK;
1400 int result; 1389 int result;
1401 1390
1402 printk(KERN_NOTICE "Asus Laptop ACPI Extras version %s\n", 1391 pr_notice("Asus Laptop ACPI Extras version %s\n", ASUS_ACPI_VERSION);
1403 ASUS_ACPI_VERSION);
1404 1392
1405 hotk = kzalloc(sizeof(struct asus_hotk), GFP_KERNEL); 1393 hotk = kzalloc(sizeof(struct asus_hotk), GFP_KERNEL);
1406 if (!hotk) 1394 if (!hotk)
@@ -1428,15 +1416,14 @@ static int asus_hotk_add(struct acpi_device *device)
1428 acpi_evaluate_object(NULL, hotk->methods->brightness_down, 1416 acpi_evaluate_object(NULL, hotk->methods->brightness_down,
1429 NULL, NULL); 1417 NULL, NULL);
1430 if (ACPI_FAILURE(status)) 1418 if (ACPI_FAILURE(status))
1431 printk(KERN_WARNING " Error changing brightness\n"); 1419 pr_warn(" Error changing brightness\n");
1432 else { 1420 else {
1433 status = 1421 status =
1434 acpi_evaluate_object(NULL, 1422 acpi_evaluate_object(NULL,
1435 hotk->methods->brightness_up, 1423 hotk->methods->brightness_up,
1436 NULL, NULL); 1424 NULL, NULL);
1437 if (ACPI_FAILURE(status)) 1425 if (ACPI_FAILURE(status))
1438 printk(KERN_WARNING " Strange, error changing" 1426 pr_warn(" Strange, error changing brightness\n");
1439 " brightness\n");
1440 } 1427 }
1441 } 1428 }
1442 1429
@@ -1488,7 +1475,7 @@ static int __init asus_acpi_init(void)
1488 1475
1489 asus_proc_dir = proc_mkdir(PROC_ASUS, acpi_root_dir); 1476 asus_proc_dir = proc_mkdir(PROC_ASUS, acpi_root_dir);
1490 if (!asus_proc_dir) { 1477 if (!asus_proc_dir) {
1491 printk(KERN_ERR "Asus ACPI: Unable to create /proc entry\n"); 1478 pr_err("Unable to create /proc entry\n");
1492 acpi_bus_unregister_driver(&asus_hotk_driver); 1479 acpi_bus_unregister_driver(&asus_hotk_driver);
1493 return -ENODEV; 1480 return -ENODEV;
1494 } 1481 }
@@ -1513,7 +1500,7 @@ static int __init asus_acpi_init(void)
1513 &asus_backlight_data, 1500 &asus_backlight_data,
1514 &props); 1501 &props);
1515 if (IS_ERR(asus_backlight_device)) { 1502 if (IS_ERR(asus_backlight_device)) {
1516 printk(KERN_ERR "Could not register asus backlight device\n"); 1503 pr_err("Could not register asus backlight device\n");
1517 asus_backlight_device = NULL; 1504 asus_backlight_device = NULL;
1518 asus_acpi_exit(); 1505 asus_acpi_exit();
1519 return -ENODEV; 1506 return -ENODEV;