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>
This commit is contained in:
Родитель
2344cd0c2e
Коммит
1ee7c71bd1
|
@ -26,6 +26,8 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||||
|
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/input-polldev.h>
|
#include <linux/input-polldev.h>
|
||||||
|
@ -251,8 +253,7 @@ static int __wait_status(u8 val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_WARNING "applesmc: wait status failed: %x != %x\n",
|
pr_warn("wait status failed: %x != %x\n", val, inb(APPLESMC_CMD_PORT));
|
||||||
val, inb(APPLESMC_CMD_PORT));
|
|
||||||
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
@ -271,8 +272,7 @@ static int send_command(u8 cmd)
|
||||||
if ((inb(APPLESMC_CMD_PORT) & APPLESMC_STATUS_MASK) == 0x0c)
|
if ((inb(APPLESMC_CMD_PORT) & APPLESMC_STATUS_MASK) == 0x0c)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
printk(KERN_WARNING "applesmc: command failed: %x -> %x\n",
|
pr_warn("command failed: %x -> %x\n", cmd, inb(APPLESMC_CMD_PORT));
|
||||||
cmd, inb(APPLESMC_CMD_PORT));
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,8 +286,8 @@ static int applesmc_read_key(const char* key, u8* buffer, u8 len)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (len > APPLESMC_MAX_DATA_LENGTH) {
|
if (len > APPLESMC_MAX_DATA_LENGTH) {
|
||||||
printk(KERN_ERR "applesmc_read_key: cannot read more than "
|
pr_err("%s(): cannot read more than %d bytes\n",
|
||||||
"%d bytes\n", APPLESMC_MAX_DATA_LENGTH);
|
__func__, APPLESMC_MAX_DATA_LENGTH);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,8 +329,8 @@ static int applesmc_write_key(const char* key, u8* buffer, u8 len)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (len > APPLESMC_MAX_DATA_LENGTH) {
|
if (len > APPLESMC_MAX_DATA_LENGTH) {
|
||||||
printk(KERN_ERR "applesmc_write_key: cannot write more than "
|
pr_err("%s(): cannot write more than %d bytes\n",
|
||||||
"%d bytes\n", APPLESMC_MAX_DATA_LENGTH);
|
__func__, APPLESMC_MAX_DATA_LENGTH);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,7 +470,7 @@ static void applesmc_device_init(void)
|
||||||
msleep(INIT_WAIT_MSECS);
|
msleep(INIT_WAIT_MSECS);
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_WARNING "applesmc: failed to init the device\n");
|
pr_warn("failed to init the device\n");
|
||||||
|
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&applesmc_lock);
|
mutex_unlock(&applesmc_lock);
|
||||||
|
@ -616,8 +616,7 @@ static ssize_t applesmc_light_show(struct device *dev,
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
data_length = clamp_val(query[0], 0, 10);
|
data_length = clamp_val(query[0], 0, 10);
|
||||||
printk(KERN_INFO "applesmc: light sensor data length set to "
|
pr_info("light sensor data length set to %d\n", data_length);
|
||||||
"%d\n", data_length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length);
|
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)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
struct dmi_match_data* dmi_data = id->driver_data;
|
struct dmi_match_data* dmi_data = id->driver_data;
|
||||||
printk(KERN_INFO "applesmc: %s detected:\n", id->ident);
|
pr_info("%s detected:\n", id->ident);
|
||||||
applesmc_accelerometer = dmi_data->accelerometer;
|
applesmc_accelerometer = dmi_data->accelerometer;
|
||||||
printk(KERN_INFO "applesmc: - Model %s accelerometer\n",
|
pr_info(" - Model %s accelerometer\n",
|
||||||
applesmc_accelerometer ? "with" : "without");
|
applesmc_accelerometer ? "with" : "without");
|
||||||
applesmc_light = dmi_data->light;
|
applesmc_light = dmi_data->light;
|
||||||
printk(KERN_INFO "applesmc: - Model %s light sensors and backlight\n",
|
pr_info(" - Model %s light sensors and backlight\n",
|
||||||
applesmc_light ? "with" : "without");
|
applesmc_light ? "with" : "without");
|
||||||
|
|
||||||
applesmc_temperature_set = dmi_data->temperature_set;
|
applesmc_temperature_set = dmi_data->temperature_set;
|
||||||
while (temperature_sensors_sets[applesmc_temperature_set][i] != NULL)
|
while (temperature_sensors_sets[applesmc_temperature_set][i] != NULL)
|
||||||
i++;
|
i++;
|
||||||
printk(KERN_INFO "applesmc: - Model with %d temperature sensors\n", i);
|
pr_info(" - Model with %d temperature sensors\n", i);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1445,7 +1444,7 @@ out_sysfs:
|
||||||
sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
|
sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
printk(KERN_WARNING "applesmc: driver init failed (ret=%d)!\n", ret);
|
pr_warn("driver init failed (ret=%d)!\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1625,7 +1624,7 @@ static int __init applesmc_init(void)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!dmi_check_system(applesmc_whitelist)) {
|
if (!dmi_check_system(applesmc_whitelist)) {
|
||||||
printk(KERN_WARNING "applesmc: supported laptop not found!\n");
|
pr_warn("supported laptop not found!\n");
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1659,15 +1658,13 @@ static int __init applesmc_init(void)
|
||||||
/* create fan files */
|
/* create fan files */
|
||||||
count = applesmc_get_fan_count();
|
count = applesmc_get_fan_count();
|
||||||
if (count < 0)
|
if (count < 0)
|
||||||
printk(KERN_ERR "applesmc: Cannot get the number of fans.\n");
|
pr_err("Cannot get the number of fans\n");
|
||||||
else
|
else
|
||||||
printk(KERN_INFO "applesmc: %d fans found.\n", count);
|
pr_info("%d fans found\n", count);
|
||||||
|
|
||||||
if (count > 4) {
|
if (count > 4) {
|
||||||
count = 4;
|
count = 4;
|
||||||
printk(KERN_WARNING "applesmc: More than 4 fans found,"
|
pr_warn("A maximum of 4 fans are supported by this driver\n");
|
||||||
" but at most 4 fans are supported"
|
|
||||||
" by the driver.\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fans_handled < count) {
|
while (fans_handled < count) {
|
||||||
|
@ -1683,11 +1680,8 @@ static int __init applesmc_init(void)
|
||||||
i++) {
|
i++) {
|
||||||
if (temperature_attributes[i] == NULL ||
|
if (temperature_attributes[i] == NULL ||
|
||||||
label_attributes[i] == NULL) {
|
label_attributes[i] == NULL) {
|
||||||
printk(KERN_ERR "applesmc: More temperature sensors "
|
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",
|
||||||
"in temperature_sensors_sets (at least %i)"
|
i, i-1);
|
||||||
"than available sysfs files in "
|
|
||||||
"temperature_attributes (%i), please report "
|
|
||||||
"this bug.\n", i, i-1);
|
|
||||||
goto out_temperature;
|
goto out_temperature;
|
||||||
}
|
}
|
||||||
ret = sysfs_create_file(&pdev->dev.kobj,
|
ret = sysfs_create_file(&pdev->dev.kobj,
|
||||||
|
@ -1731,7 +1725,7 @@ static int __init applesmc_init(void)
|
||||||
goto out_light_ledclass;
|
goto out_light_ledclass;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_INFO "applesmc: driver successfully loaded.\n");
|
pr_info("driver successfully loaded\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -1764,7 +1758,7 @@ out_driver:
|
||||||
out_region:
|
out_region:
|
||||||
release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS);
|
release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS);
|
||||||
out:
|
out:
|
||||||
printk(KERN_WARNING "applesmc: driver init failed (ret=%d)!\n", ret);
|
pr_warn("driver init failed (ret=%d)!\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1789,7 +1783,7 @@ static void __exit applesmc_exit(void)
|
||||||
platform_driver_unregister(&applesmc_driver);
|
platform_driver_unregister(&applesmc_driver);
|
||||||
release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS);
|
release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS);
|
||||||
|
|
||||||
printk(KERN_INFO "applesmc: driver unloaded.\n");
|
pr_info("driver unloaded\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(applesmc_init);
|
module_init(applesmc_init);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче