aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/applesmc.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-11-09 10:15:03 -0500
committerGuenter Roeck <guenter.roeck@ericsson.com>2011-01-08 13:55:37 -0500
commit1ee7c71bd1aa9758f14e1be92310215a5bd0abe7 (patch)
treefc4ba90788906b6a932f163ba89e5db810738775 /drivers/hwmon/applesmc.c
parent2344cd0c2e9ea8f3037be11fb997ddbeda0237ca (diff)
hwmon: (applesmc) Use pr_fmt and pr_<level>
Added #define pr_fmt KBUILD_MODNAME ": " fmt Converted printks to pr_<level> Coalesced any long formats Removed prefixes from formats Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon/applesmc.c')
-rw-r--r--drivers/hwmon/applesmc.c58
1 files changed, 26 insertions, 32 deletions
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 87a5fd51dd5e..5f67e390e45c 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -26,6 +26,8 @@
26 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 26 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
27 */ 27 */
28 28
29#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
30
29#include <linux/delay.h> 31#include <linux/delay.h>
30#include <linux/platform_device.h> 32#include <linux/platform_device.h>
31#include <linux/input-polldev.h> 33#include <linux/input-polldev.h>
@@ -251,8 +253,7 @@ static int __wait_status(u8 val)
251 } 253 }
252 } 254 }
253 255
254 printk(KERN_WARNING "applesmc: wait status failed: %x != %x\n", 256 pr_warn("wait status failed: %x != %x\n", val, inb(APPLESMC_CMD_PORT));
255 val, inb(APPLESMC_CMD_PORT));
256 257
257 return -EIO; 258 return -EIO;
258} 259}
@@ -271,8 +272,7 @@ static int send_command(u8 cmd)
271 if ((inb(APPLESMC_CMD_PORT) & APPLESMC_STATUS_MASK) == 0x0c) 272 if ((inb(APPLESMC_CMD_PORT) & APPLESMC_STATUS_MASK) == 0x0c)
272 return 0; 273 return 0;
273 } 274 }
274 printk(KERN_WARNING "applesmc: command failed: %x -> %x\n", 275 pr_warn("command failed: %x -> %x\n", cmd, inb(APPLESMC_CMD_PORT));
275 cmd, inb(APPLESMC_CMD_PORT));
276 return -EIO; 276 return -EIO;
277} 277}
278 278
@@ -286,8 +286,8 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
286 int i; 286 int i;
287 287
288 if (len > APPLESMC_MAX_DATA_LENGTH) { 288 if (len > APPLESMC_MAX_DATA_LENGTH) {
289 printk(KERN_ERR "applesmc_read_key: cannot read more than " 289 pr_err("%s(): cannot read more than %d bytes\n",
290 "%d bytes\n", APPLESMC_MAX_DATA_LENGTH); 290 __func__, APPLESMC_MAX_DATA_LENGTH);
291 return -EINVAL; 291 return -EINVAL;
292 } 292 }
293 293
@@ -329,8 +329,8 @@ static int applesmc_write_key(const char* key, u8* buffer, u8 len)
329 int i; 329 int i;
330 330
331 if (len > APPLESMC_MAX_DATA_LENGTH) { 331 if (len > APPLESMC_MAX_DATA_LENGTH) {
332 printk(KERN_ERR "applesmc_write_key: cannot write more than " 332 pr_err("%s(): cannot write more than %d bytes\n",
333 "%d bytes\n", APPLESMC_MAX_DATA_LENGTH); 333 __func__, APPLESMC_MAX_DATA_LENGTH);
334 return -EINVAL; 334 return -EINVAL;
335 } 335 }
336 336
@@ -470,7 +470,7 @@ static void applesmc_device_init(void)
470 msleep(INIT_WAIT_MSECS); 470 msleep(INIT_WAIT_MSECS);
471 } 471 }
472 472
473 printk(KERN_WARNING "applesmc: failed to init the device\n"); 473 pr_warn("failed to init the device\n");
474 474
475out: 475out:
476 mutex_unlock(&applesmc_lock); 476 mutex_unlock(&applesmc_lock);
@@ -616,8 +616,7 @@ static ssize_t applesmc_light_show(struct device *dev,
616 if (ret) 616 if (ret)
617 goto out; 617 goto out;
618 data_length = clamp_val(query[0], 0, 10); 618 data_length = clamp_val(query[0], 0, 10);
619 printk(KERN_INFO "applesmc: light sensor data length set to " 619 pr_info("light sensor data length set to %d\n", data_length);
620 "%d\n", data_length);
621 } 620 }
622 621
623 ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length); 622 ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length);
@@ -1383,18 +1382,18 @@ static int applesmc_dmi_match(const struct dmi_system_id *id)
1383{ 1382{
1384 int i = 0; 1383 int i = 0;
1385 struct dmi_match_data* dmi_data = id->driver_data; 1384 struct dmi_match_data* dmi_data = id->driver_data;
1386 printk(KERN_INFO "applesmc: %s detected:\n", id->ident); 1385 pr_info("%s detected:\n", id->ident);
1387 applesmc_accelerometer = dmi_data->accelerometer; 1386 applesmc_accelerometer = dmi_data->accelerometer;
1388 printk(KERN_INFO "applesmc: - Model %s accelerometer\n", 1387 pr_info(" - Model %s accelerometer\n",
1389 applesmc_accelerometer ? "with" : "without"); 1388 applesmc_accelerometer ? "with" : "without");
1390 applesmc_light = dmi_data->light; 1389 applesmc_light = dmi_data->light;
1391 printk(KERN_INFO "applesmc: - Model %s light sensors and backlight\n", 1390 pr_info(" - Model %s light sensors and backlight\n",
1392 applesmc_light ? "with" : "without"); 1391 applesmc_light ? "with" : "without");
1393 1392
1394 applesmc_temperature_set = dmi_data->temperature_set; 1393 applesmc_temperature_set = dmi_data->temperature_set;
1395 while (temperature_sensors_sets[applesmc_temperature_set][i] != NULL) 1394 while (temperature_sensors_sets[applesmc_temperature_set][i] != NULL)
1396 i++; 1395 i++;
1397 printk(KERN_INFO "applesmc: - Model with %d temperature sensors\n", i); 1396 pr_info(" - Model with %d temperature sensors\n", i);
1398 return 1; 1397 return 1;
1399} 1398}
1400 1399
@@ -1445,7 +1444,7 @@ out_sysfs:
1445 sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group); 1444 sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
1446 1445
1447out: 1446out:
1448 printk(KERN_WARNING "applesmc: driver init failed (ret=%d)!\n", ret); 1447 pr_warn("driver init failed (ret=%d)!\n", ret);
1449 return ret; 1448 return ret;
1450} 1449}
1451 1450
@@ -1625,7 +1624,7 @@ static int __init applesmc_init(void)
1625 int i; 1624 int i;
1626 1625
1627 if (!dmi_check_system(applesmc_whitelist)) { 1626 if (!dmi_check_system(applesmc_whitelist)) {
1628 printk(KERN_WARNING "applesmc: supported laptop not found!\n"); 1627 pr_warn("supported laptop not found!\n");
1629 ret = -ENODEV; 1628 ret = -ENODEV;
1630 goto out; 1629 goto out;
1631 } 1630 }
@@ -1659,15 +1658,13 @@ static int __init applesmc_init(void)
1659 /* create fan files */ 1658 /* create fan files */
1660 count = applesmc_get_fan_count(); 1659 count = applesmc_get_fan_count();
1661 if (count < 0) 1660 if (count < 0)
1662 printk(KERN_ERR "applesmc: Cannot get the number of fans.\n"); 1661 pr_err("Cannot get the number of fans\n");
1663 else 1662 else
1664 printk(KERN_INFO "applesmc: %d fans found.\n", count); 1663 pr_info("%d fans found\n", count);
1665 1664
1666 if (count > 4) { 1665 if (count > 4) {
1667 count = 4; 1666 count = 4;
1668 printk(KERN_WARNING "applesmc: More than 4 fans found," 1667 pr_warn("A maximum of 4 fans are supported by this driver\n");
1669 " but at most 4 fans are supported"
1670 " by the driver.\n");
1671 } 1668 }
1672 1669
1673 while (fans_handled < count) { 1670 while (fans_handled < count) {
@@ -1683,11 +1680,8 @@ static int __init applesmc_init(void)
1683 i++) { 1680 i++) {
1684 if (temperature_attributes[i] == NULL || 1681 if (temperature_attributes[i] == NULL ||
1685 label_attributes[i] == NULL) { 1682 label_attributes[i] == NULL) {
1686 printk(KERN_ERR "applesmc: More temperature sensors " 1683 pr_err("More temperature sensors in temperature_sensors_sets (at least %i) than available sysfs files in temperature_attributes (%i), please report this bug\n",
1687 "in temperature_sensors_sets (at least %i)" 1684 i, i-1);
1688 "than available sysfs files in "
1689 "temperature_attributes (%i), please report "
1690 "this bug.\n", i, i-1);
1691 goto out_temperature; 1685 goto out_temperature;
1692 } 1686 }
1693 ret = sysfs_create_file(&pdev->dev.kobj, 1687 ret = sysfs_create_file(&pdev->dev.kobj,
@@ -1731,7 +1725,7 @@ static int __init applesmc_init(void)
1731 goto out_light_ledclass; 1725 goto out_light_ledclass;
1732 } 1726 }
1733 1727
1734 printk(KERN_INFO "applesmc: driver successfully loaded.\n"); 1728 pr_info("driver successfully loaded\n");
1735 1729
1736 return 0; 1730 return 0;
1737 1731
@@ -1764,7 +1758,7 @@ out_driver:
1764out_region: 1758out_region:
1765 release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS); 1759 release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS);
1766out: 1760out:
1767 printk(KERN_WARNING "applesmc: driver init failed (ret=%d)!\n", ret); 1761 pr_warn("driver init failed (ret=%d)!\n", ret);
1768 return ret; 1762 return ret;
1769} 1763}
1770 1764
@@ -1789,7 +1783,7 @@ static void __exit applesmc_exit(void)
1789 platform_driver_unregister(&applesmc_driver); 1783 platform_driver_unregister(&applesmc_driver);
1790 release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS); 1784 release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS);
1791 1785
1792 printk(KERN_INFO "applesmc: driver unloaded.\n"); 1786 pr_info("driver unloaded\n");
1793} 1787}
1794 1788
1795module_init(applesmc_init); 1789module_init(applesmc_init);