Skip to content

Commit 8003a55

Browse files
Wolfram Sangalexandrebelloni
authored andcommitted
rtc: sh: minor fixes to adhere to coding style
Use the BIT macro, use curly braces for else-blocks, don't split strings over multiple lines, annotate the lock, update copyright. Signed-off-by: Wolfram Sang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent ea59ad0 commit 8003a55

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

drivers/rtc/rtc-sh.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Copyright (C) 2006 - 2009 Paul Mundt
66
* Copyright (C) 2006 Jamie Lenehan
77
* Copyright (C) 2008 Angelo Castello
8+
* Copyright (C) 2025 Wolfram Sang, Renesas Electronics Corporation
89
*
910
* Based on the old arch/sh/kernel/cpu/rtc.c by:
1011
*
@@ -31,7 +32,7 @@
3132
/* Default values for RZ/A RTC */
3233
#define rtc_reg_size sizeof(u16)
3334
#define RTC_BIT_INVERTED 0 /* no chip bugs */
34-
#define RTC_CAP_4_DIGIT_YEAR (1 << 0)
35+
#define RTC_CAP_4_DIGIT_YEAR BIT(0)
3536
#define RTC_DEF_CAPABILITIES RTC_CAP_4_DIGIT_YEAR
3637
#endif
3738

@@ -70,26 +71,26 @@
7071
*/
7172

7273
/* ALARM Bits - or with BCD encoded value */
73-
#define AR_ENB 0x80 /* Enable for alarm cmp */
74+
#define AR_ENB BIT(7) /* Enable for alarm cmp */
7475

7576
/* RCR1 Bits */
76-
#define RCR1_CF 0x80 /* Carry Flag */
77-
#define RCR1_CIE 0x10 /* Carry Interrupt Enable */
78-
#define RCR1_AIE 0x08 /* Alarm Interrupt Enable */
79-
#define RCR1_AF 0x01 /* Alarm Flag */
77+
#define RCR1_CF BIT(7) /* Carry Flag */
78+
#define RCR1_CIE BIT(4) /* Carry Interrupt Enable */
79+
#define RCR1_AIE BIT(3) /* Alarm Interrupt Enable */
80+
#define RCR1_AF BIT(0) /* Alarm Flag */
8081

8182
/* RCR2 Bits */
82-
#define RCR2_RTCEN 0x08 /* ENable RTC */
83-
#define RCR2_ADJ 0x04 /* ADJustment (30-second) */
84-
#define RCR2_RESET 0x02 /* Reset bit */
85-
#define RCR2_START 0x01 /* Start bit */
83+
#define RCR2_RTCEN BIT(3) /* ENable RTC */
84+
#define RCR2_ADJ BIT(2) /* ADJustment (30-second) */
85+
#define RCR2_RESET BIT(1) /* Reset bit */
86+
#define RCR2_START BIT(0) /* Start bit */
8687

8788
struct sh_rtc {
8889
void __iomem *regbase;
8990
int alarm_irq;
9091
struct clk *clk;
9192
struct rtc_device *rtc_dev;
92-
spinlock_t lock;
93+
spinlock_t lock; /* protecting register access */
9394
unsigned long capabilities; /* See asm/rtc.h for cap bits */
9495
};
9596

@@ -183,10 +184,8 @@ static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm)
183184
tm->tm_sec--;
184185
#endif
185186

186-
dev_dbg(dev, "%s: tm is secs=%d, mins=%d, hours=%d, "
187-
"mday=%d, mon=%d, year=%d, wday=%d\n",
188-
__func__,
189-
tm->tm_sec, tm->tm_min, tm->tm_hour,
187+
dev_dbg(dev, "%s: tm is secs=%d, mins=%d, hours=%d, mday=%d, mon=%d, year=%d, wday=%d\n",
188+
__func__, tm->tm_sec, tm->tm_min, tm->tm_hour,
190189
tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday);
191190

192191
return 0;
@@ -373,8 +372,9 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
373372
clk_id = 0;
374373

375374
snprintf(clk_name, sizeof(clk_name), "rtc%d", clk_id);
376-
} else
375+
} else {
377376
snprintf(clk_name, sizeof(clk_name), "fck");
377+
}
378378

379379
rtc->clk = devm_clk_get(&pdev->dev, clk_name);
380380
if (IS_ERR(rtc->clk)) {
@@ -501,8 +501,8 @@ static struct platform_driver sh_rtc_platform_driver __refdata = {
501501
module_platform_driver_probe(sh_rtc_platform_driver, sh_rtc_probe);
502502

503503
MODULE_DESCRIPTION("SuperH on-chip RTC driver");
504-
MODULE_AUTHOR("Paul Mundt <[email protected]>, "
505-
"Jamie Lenehan <[email protected]>, "
506-
"Angelo Castello <[email protected]>");
504+
MODULE_AUTHOR("Paul Mundt <[email protected]>");
505+
MODULE_AUTHOR("Jamie Lenehan <[email protected]>");
506+
MODULE_AUTHOR("Angelo Castello <[email protected]>");
507507
MODULE_LICENSE("GPL v2");
508508
MODULE_ALIAS("platform:" DRV_NAME);

0 commit comments

Comments
 (0)