Skip to content

Commit

Permalink
rtc: use more standard kernel logging styles
Browse files Browse the repository at this point in the history
Neaten the logging a bit by adding #define pr_fmt

Miscellanea:

o Remove __FILE__/__func__ uses
o Coalesce formats adding missing spaces
o Align arguments
o (rtc-cmos) Integrated 2 consecutive messages

Signed-off-by: Joe Perches <[email protected]>
Acked-by: Alexandre Belloni <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Joshua Kinard <[email protected]>
Cc: Chanwoo Choi <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Tested-by: Krzysztof Kozlowski <[email protected]>
Cc: Aaro Koskinen <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
JoePerches authored and torvalds committed Apr 17, 2015
1 parent f539a8a commit a737e83
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 24 deletions.
6 changes: 4 additions & 2 deletions drivers/rtc/hctosys.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* published by the Free Software Foundation.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/rtc.h>

/* IMPORTANT: the RTC only stores whole seconds. It is arbitrary
Expand All @@ -32,8 +34,8 @@ static int __init rtc_hctosys(void)
struct rtc_device *rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);

if (rtc == NULL) {
pr_info("%s: unable to open rtc device (%s)\n",
__func__, CONFIG_RTC_HCTOSYS_DEVICE);
pr_info("unable to open rtc device (%s)\n",
CONFIG_RTC_HCTOSYS_DEVICE);
goto err_open;
}

Expand Down
6 changes: 4 additions & 2 deletions drivers/rtc/rtc-cmos.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
* interrupts disabled, holding the global rtc_lock, to exclude those
* other drivers and utilities on correctly configured systems.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
Expand Down Expand Up @@ -385,8 +388,7 @@ static bool alarm_disable_quirk;
static int __init set_alarm_disable_quirk(const struct dmi_system_id *id)
{
alarm_disable_quirk = true;
pr_info("rtc-cmos: BIOS has alarm-disable quirk. ");
pr_info("RTC alarms disabled\n");
pr_info("BIOS has alarm-disable quirk - RTC alarms disabled\n");
return 0;
}

Expand Down
8 changes: 5 additions & 3 deletions drivers/rtc/rtc-ds1374.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* "Sending and receiving", using SMBus level communication is preferred.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>
Expand Down Expand Up @@ -406,7 +408,7 @@ static int ds1374_wdt_settimeout(unsigned int timeout)
/* Set new watchdog time */
ret = ds1374_write_rtc(save_client, timeout, DS1374_REG_WDALM0, 3);
if (ret) {
pr_info("rtc-ds1374 - couldn't set new watchdog time\n");
pr_info("couldn't set new watchdog time\n");
goto out;
}

Expand Down Expand Up @@ -539,12 +541,12 @@ static long ds1374_wdt_ioctl(struct file *file, unsigned int cmd,
return -EFAULT;

if (options & WDIOS_DISABLECARD) {
pr_info("rtc-ds1374: disable watchdog\n");
pr_info("disable watchdog\n");
ds1374_wdt_disable();
}

if (options & WDIOS_ENABLECARD) {
pr_info("rtc-ds1374: enable watchdog\n");
pr_info("enable watchdog\n");
ds1374_wdt_settimeout(wdt_margin);
ds1374_wdt_ping();
}
Expand Down
4 changes: 3 additions & 1 deletion drivers/rtc/rtc-ds1685.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* published by the Free Software Foundation.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/bcd.h>
#include <linux/delay.h>
#include <linux/io.h>
Expand Down Expand Up @@ -2182,7 +2184,7 @@ ds1685_rtc_poweroff(struct platform_device *pdev)

/* Check for valid RTC data, else, spin forever. */
if (unlikely(!pdev)) {
pr_emerg("rtc-ds1685: platform device data not available, spinning forever ...\n");
pr_emerg("platform device data not available, spinning forever ...\n");
unreachable();
} else {
/* Get the rtc data. */
Expand Down
6 changes: 4 additions & 2 deletions drivers/rtc/rtc-ds3232.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* "Sending and receiving", using SMBus level communication is preferred.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>
Expand Down Expand Up @@ -373,8 +375,8 @@ static void ds3232_work(struct work_struct *work)
if (stat & DS3232_REG_SR_A1F) {
control = i2c_smbus_read_byte_data(client, DS3232_REG_CR);
if (control < 0) {
pr_warn("Read DS3232 Control Register error."
"Disable IRQ%d.\n", client->irq);
pr_warn("Read Control Register error - Disable IRQ%d\n",
client->irq);
} else {
/* disable alarm1 interrupt */
control &= ~(DS3232_REG_CR_A1IE);
Expand Down
3 changes: 3 additions & 0 deletions drivers/rtc/rtc-efi-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
* Copyright (C) 1999-2000 VA Linux Systems
* Copyright (C) 1999-2000 Walt Drummond <[email protected]>
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
Expand Down
6 changes: 4 additions & 2 deletions drivers/rtc/rtc-m41t80.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
*
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/bcd.h>
#include <linux/i2c.h>
#include <linux/init.h>
Expand Down Expand Up @@ -513,12 +515,12 @@ static int wdt_ioctl(struct file *file, unsigned int cmd,
return -EFAULT;

if (rv & WDIOS_DISABLECARD) {
pr_info("rtc-m41t80: disable watchdog\n");
pr_info("disable watchdog\n");
wdt_disable();
}

if (rv & WDIOS_ENABLECARD) {
pr_info("rtc-m41t80: enable watchdog\n");
pr_info("enable watchdog\n");
wdt_ping();
}

Expand Down
6 changes: 4 additions & 2 deletions drivers/rtc/rtc-max77686.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
*
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/slab.h>
#include <linux/rtc.h>
#include <linux/delay.h>
Expand Down Expand Up @@ -103,8 +105,8 @@ static int max77686_rtc_tm_to_data(struct rtc_time *tm, u8 *data)
data[RTC_YEAR] = tm->tm_year > 100 ? (tm->tm_year - 100) : 0;

if (tm->tm_year < 100) {
pr_warn("%s: MAX77686 RTC cannot handle the year %d."
"Assume it's 2000.\n", __func__, 1900 + tm->tm_year);
pr_warn("RTC cannot handle the year %d. Assume it's 2000.\n",
1900 + tm->tm_year);
return -EINVAL;
}
return 0;
Expand Down
8 changes: 5 additions & 3 deletions drivers/rtc/rtc-max8997.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
*
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/slab.h>
#include <linux/rtc.h>
#include <linux/delay.h>
Expand Down Expand Up @@ -107,8 +109,8 @@ static int max8997_rtc_tm_to_data(struct rtc_time *tm, u8 *data)
data[RTC_YEAR] = tm->tm_year > 100 ? (tm->tm_year - 100) : 0;

if (tm->tm_year < 100) {
pr_warn("%s: MAX8997 RTC cannot handle the year %d."
"Assume it's 2000.\n", __func__, 1900 + tm->tm_year);
pr_warn("RTC cannot handle the year %d. Assume it's 2000.\n",
1900 + tm->tm_year);
return -EINVAL;
}
return 0;
Expand Down Expand Up @@ -424,7 +426,7 @@ static void max8997_rtc_enable_smpl(struct max8997_rtc_info *info, bool enable)

val = 0;
max8997_read_reg(info->rtc, MAX8997_RTC_WTSR_SMPL, &val);
pr_info("%s: WTSR_SMPL(0x%02x)\n", __func__, val);
pr_info("WTSR_SMPL(0x%02x)\n", val);
}

static int max8997_rtc_init_reg(struct max8997_rtc_info *info)
Expand Down
4 changes: 3 additions & 1 deletion drivers/rtc/rtc-msm6242.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* Copyright (C) 1993 Hamish Macdonald
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/delay.h>
#include <linux/io.h>
#include <linux/kernel.h>
Expand Down Expand Up @@ -111,7 +113,7 @@ static void msm6242_lock(struct msm6242_priv *priv)
}

if (!cnt)
pr_warn("msm6242: timed out waiting for RTC (0x%x)\n",
pr_warn("timed out waiting for RTC (0x%x)\n",
msm6242_read(priv, MSM6242_CD));
}

Expand Down
3 changes: 2 additions & 1 deletion drivers/rtc/rtc-opal.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
* along with this program.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#define DRVNAME "rtc-opal"
#define pr_fmt(fmt) DRVNAME ": " fmt

#include <linux/module.h>
#include <linux/err.h>
Expand Down
4 changes: 3 additions & 1 deletion drivers/rtc/rtc-s5m.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* GNU General Public License for more details.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/bcd.h>
Expand Down Expand Up @@ -146,7 +148,7 @@ static int s5m8767_tm_to_data(struct rtc_time *tm, u8 *data)
data[RTC_YEAR1] = tm->tm_year > 100 ? (tm->tm_year - 100) : 0;

if (tm->tm_year < 100) {
pr_err("s5m8767 RTC cannot handle the year %d.\n",
pr_err("RTC cannot handle the year %d\n",
1900 + tm->tm_year);
return -EINVAL;
} else {
Expand Down
9 changes: 5 additions & 4 deletions drivers/rtc/rtc-twl.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* 2 of the License, or (at your option) any later version.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/init.h>
Expand Down Expand Up @@ -145,8 +147,7 @@ static int twl_rtc_read_u8(u8 *data, u8 reg)

ret = twl_i2c_read_u8(TWL_MODULE_RTC, data, (rtc_reg_map[reg]));
if (ret < 0)
pr_err("twl_rtc: Could not read TWL"
"register %X - error %d\n", reg, ret);
pr_err("Could not read TWL register %X - error %d\n", reg, ret);
return ret;
}

Expand All @@ -159,8 +160,8 @@ static int twl_rtc_write_u8(u8 data, u8 reg)

ret = twl_i2c_write_u8(TWL_MODULE_RTC, data, (rtc_reg_map[reg]));
if (ret < 0)
pr_err("twl_rtc: Could not write TWL"
"register %X - error %d\n", reg, ret);
pr_err("Could not write TWL register %X - error %d\n",
reg, ret);
return ret;
}

Expand Down

0 comments on commit a737e83

Please sign in to comment.