misc: pm8058-pwm: add pr_fmt to simplify debug messages
Adding pr_fmt with __func__ to simplify the debug messages which
need to print out __func__.
Signed-off-by: Willie Ruan <wruan@codeaurora.org>
diff --git a/drivers/misc/pmic8058-pwm.c b/drivers/misc/pmic8058-pwm.c
index 2c04bdc..1a7507e 100644
--- a/drivers/misc/pmic8058-pwm.c
+++ b/drivers/misc/pmic8058-pwm.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -15,6 +15,8 @@
*
*/
+#define pr_fmt(fmt) "%s: " fmt, __func__
+
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/err.h>
@@ -241,8 +243,7 @@
rc = pm8058_write(chip->pm_chip, SSBI_REG_ADDR_LPG_BANK_EN, ®, 1);
if (rc) {
- pr_err("%s: pm8058_write(): rc=%d (Enable LPG Bank)\n",
- __func__, rc);
+ pr_err("pm8058_write(): rc=%d (Enable LPG Bank)\n", rc);
goto bail_out;
}
chip->bank_mask = reg;
@@ -260,8 +261,7 @@
rc = pm8058_write(pwm->chip->pm_chip, SSBI_REG_ADDR_LPG_BANK_SEL,
®, 1);
if (rc)
- pr_err("%s: pm8058_write(): rc=%d (Select PWM Bank)\n",
- __func__, rc);
+ pr_err("pm8058_write(): rc=%d (Select PWM Bank)\n", rc);
return rc;
}
@@ -284,8 +284,7 @@
rc = pm8058_write(pwm->chip->pm_chip, SSBI_REG_ADDR_LPG_CTL(0),
®, 1);
if (rc)
- pr_err("%s: pm8058_write(): rc=%d (Enable PWM Ctl 0)\n",
- __func__, rc);
+ pr_err("pm8058_write(): rc=%d (Enable PWM Ctl 0)\n", rc);
else
pwm->pwm_ctl[0] = reg;
return rc;
@@ -360,8 +359,8 @@
pwm_conf->pre_div = best_div;
pwm_conf->pre_div_exp = best_m;
- pr_debug("%s: period=%u: n=%d, m=%d, clk[%d]=%s, div[%d]=%d\n",
- __func__, (unsigned)period_us, n, best_m,
+ pr_debug("period=%u: n=%d, m=%d, clk[%d]=%s, div[%d]=%d\n",
+ (unsigned)period_us, n, best_m,
best_clk, clks[best_clk], best_div, pre_div[best_div]);
}
@@ -463,8 +462,7 @@
SSBI_REG_ADDR_LPG_CTL(i),
&pwm->pwm_ctl[i], 1);
if (rc) {
- pr_err("%s: pm8058_write(): rc=%d (PWM Ctl[%d])\n",
- __func__, rc, i);
+ pr_err("pm8058_write(): rc=%d (PWM Ctl[%d])\n", rc, i);
break;
}
}
@@ -577,8 +575,8 @@
pwm_conf.bypass_lut = 1;
- pr_debug("%s: duty/period=%u/%u usec: pwm_value=%d (of %d)\n",
- __func__, (unsigned)duty_us, (unsigned)period_us,
+ pr_debug("duty/period=%u/%u usec: pwm_value=%d (of %d)\n",
+ (unsigned)duty_us, (unsigned)period_us,
pwm_conf.pwm_value, 1 << pwm_conf.pwm_size);
rc = pm8058_pwm_configure(pwm, &pwm_conf);
@@ -702,7 +700,7 @@
cfg1 = (pwm_value >> 1) & 0x80;
cfg1 |= start_idx + i;
- pr_debug("%s: %d: pwm=%d\n", __func__, i, pwm_value);
+ pr_debug("%d: pwm=%d\n", i, pwm_value);
pm8058_write(pwm->chip->pm_chip,
SSBI_REG_ADDR_LPG_LUT_CFG0,
@@ -847,8 +845,7 @@
rc = pm8058_write(pwm->chip->pm_chip, SSBI_REG_ADDR_LPG_TEST,
®, 1);
if (rc)
- pr_err("%s: pm8058_write(DTEST=0x%x): rc=%d\n",
- __func__, reg, rc);
+ pr_err("pm8058_write(DTEST=0x%x): rc=%d\n", reg, rc);
}
return rc;
@@ -863,13 +860,13 @@
pm_chip = dev_get_drvdata(pdev->dev.parent);
if (pm_chip == NULL) {
- pr_err("%s: no parent data passed in.\n", __func__);
+ pr_err("no parent data passed in.\n");
return -EFAULT;
}
chip = kzalloc(sizeof *chip, GFP_KERNEL);
if (chip == NULL) {
- pr_err("%s: kzalloc() failed.\n", __func__);
+ pr_err("kzalloc() failed.\n");
return -ENOMEM;
}
@@ -885,7 +882,7 @@
pwm_chip = chip;
platform_set_drvdata(pdev, chip);
- pr_notice("%s: OK\n", __func__);
+ pr_notice("OK\n");
return 0;
}