Skip to content

Commit 4aa90c0

Browse files
rtc: pcf8523: rename register and bit defines
arch/arm/mach-ixp4xx/include/mach/platform.h now gets included indirectly and defines REG_OFFSET. Rename the register and bit definition to something specific to the driver. Fixes: 7fd70c6 ("ARM: irqstat: Get rid of duplicated declaration") Reported-by: kernel test robot <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 2f86198 commit 4aa90c0

File tree

1 file changed

+73
-73
lines changed

1 file changed

+73
-73
lines changed

drivers/rtc/rtc-pcf8523.c

Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,41 @@
1010
#include <linux/of.h>
1111
#include <linux/pm_wakeirq.h>
1212

13-
#define REG_CONTROL1 0x00
14-
#define REG_CONTROL1_CAP_SEL BIT(7)
15-
#define REG_CONTROL1_STOP BIT(5)
16-
#define REG_CONTROL1_AIE BIT(1)
17-
18-
#define REG_CONTROL2 0x01
19-
#define REG_CONTROL2_AF BIT(3)
20-
21-
#define REG_CONTROL3 0x02
22-
#define REG_CONTROL3_PM_BLD BIT(7) /* battery low detection disabled */
23-
#define REG_CONTROL3_PM_VDD BIT(6) /* switch-over disabled */
24-
#define REG_CONTROL3_PM_DSM BIT(5) /* direct switching mode */
25-
#define REG_CONTROL3_PM_MASK 0xe0
26-
#define REG_CONTROL3_BLF BIT(2) /* battery low bit, read-only */
27-
28-
#define REG_SECONDS 0x03
29-
#define REG_SECONDS_OS BIT(7)
30-
31-
#define REG_MINUTES 0x04
32-
#define REG_HOURS 0x05
33-
#define REG_DAYS 0x06
34-
#define REG_WEEKDAYS 0x07
35-
#define REG_MONTHS 0x08
36-
#define REG_YEARS 0x09
37-
38-
#define REG_MINUTE_ALARM 0x0a
39-
#define REG_HOUR_ALARM 0x0b
40-
#define REG_DAY_ALARM 0x0c
41-
#define REG_WEEKDAY_ALARM 0x0d
13+
#define PCF8523_REG_CONTROL1 0x00
14+
#define PCF8523_CONTROL1_CAP_SEL BIT(7)
15+
#define PCF8523_CONTROL1_STOP BIT(5)
16+
#define PCF8523_CONTROL1_AIE BIT(1)
17+
18+
#define PCF8523_REG_CONTROL2 0x01
19+
#define PCF8523_CONTROL2_AF BIT(3)
20+
21+
#define PCF8523_REG_CONTROL3 0x02
22+
#define PCF8523_CONTROL3_PM_BLD BIT(7) /* battery low detection disabled */
23+
#define PCF8523_CONTROL3_PM_VDD BIT(6) /* switch-over disabled */
24+
#define PCF8523_CONTROL3_PM_DSM BIT(5) /* direct switching mode */
25+
#define PCF8523_CONTROL3_PM_MASK 0xe0
26+
#define PCF8523_CONTROL3_BLF BIT(2) /* battery low bit, read-only */
27+
28+
#define PCF8523_REG_SECONDS 0x03
29+
#define PCF8523_SECONDS_OS BIT(7)
30+
31+
#define PCF8523_REG_MINUTES 0x04
32+
#define PCF8523_REG_HOURS 0x05
33+
#define PCF8523_REG_DAYS 0x06
34+
#define PCF8523_REG_WEEKDAYS 0x07
35+
#define PCF8523_REG_MONTHS 0x08
36+
#define PCF8523_REG_YEARS 0x09
37+
38+
#define PCF8523_REG_MINUTE_ALARM 0x0a
39+
#define PCF8523_REG_HOUR_ALARM 0x0b
40+
#define PCF8523_REG_DAY_ALARM 0x0c
41+
#define PCF8523_REG_WEEKDAY_ALARM 0x0d
4242
#define ALARM_DIS BIT(7)
4343

44-
#define REG_OFFSET 0x0e
45-
#define REG_OFFSET_MODE BIT(7)
44+
#define PCF8523_REG_OFFSET 0x0e
45+
#define PCF8523_OFFSET_MODE BIT(7)
4646

47-
#define REG_TMR_CLKOUT_CTRL 0x0f
47+
#define PCF8523_TMR_CLKOUT_CTRL 0x0f
4848

4949
struct pcf8523 {
5050
struct rtc_device *rtc;
@@ -99,11 +99,11 @@ static int pcf8523_voltage_low(struct i2c_client *client)
9999
u8 value;
100100
int err;
101101

102-
err = pcf8523_read(client, REG_CONTROL3, &value);
102+
err = pcf8523_read(client, PCF8523_REG_CONTROL3, &value);
103103
if (err < 0)
104104
return err;
105105

106-
return !!(value & REG_CONTROL3_BLF);
106+
return !!(value & PCF8523_CONTROL3_BLF);
107107
}
108108

109109
static int pcf8523_load_capacitance(struct i2c_client *client)
@@ -112,7 +112,7 @@ static int pcf8523_load_capacitance(struct i2c_client *client)
112112
u8 value;
113113
int err;
114114

115-
err = pcf8523_read(client, REG_CONTROL1, &value);
115+
err = pcf8523_read(client, PCF8523_REG_CONTROL1, &value);
116116
if (err < 0)
117117
return err;
118118

@@ -126,14 +126,14 @@ static int pcf8523_load_capacitance(struct i2c_client *client)
126126
load);
127127
fallthrough;
128128
case 12500:
129-
value |= REG_CONTROL1_CAP_SEL;
129+
value |= PCF8523_CONTROL1_CAP_SEL;
130130
break;
131131
case 7000:
132-
value &= ~REG_CONTROL1_CAP_SEL;
132+
value &= ~PCF8523_CONTROL1_CAP_SEL;
133133
break;
134134
}
135135

136-
err = pcf8523_write(client, REG_CONTROL1, value);
136+
err = pcf8523_write(client, PCF8523_REG_CONTROL1, value);
137137

138138
return err;
139139
}
@@ -143,13 +143,13 @@ static int pcf8523_set_pm(struct i2c_client *client, u8 pm)
143143
u8 value;
144144
int err;
145145

146-
err = pcf8523_read(client, REG_CONTROL3, &value);
146+
err = pcf8523_read(client, PCF8523_REG_CONTROL3, &value);
147147
if (err < 0)
148148
return err;
149149

150-
value = (value & ~REG_CONTROL3_PM_MASK) | pm;
150+
value = (value & ~PCF8523_CONTROL3_PM_MASK) | pm;
151151

152-
err = pcf8523_write(client, REG_CONTROL3, value);
152+
err = pcf8523_write(client, PCF8523_REG_CONTROL3, value);
153153
if (err < 0)
154154
return err;
155155

@@ -162,13 +162,13 @@ static irqreturn_t pcf8523_irq(int irq, void *dev_id)
162162
u8 value;
163163
int err;
164164

165-
err = pcf8523_read(pcf8523->client, REG_CONTROL2, &value);
165+
err = pcf8523_read(pcf8523->client, PCF8523_REG_CONTROL2, &value);
166166
if (err < 0)
167167
return IRQ_HANDLED;
168168

169-
if (value & REG_CONTROL2_AF) {
170-
value &= ~REG_CONTROL2_AF;
171-
pcf8523_write(pcf8523->client, REG_CONTROL2, value);
169+
if (value & PCF8523_CONTROL2_AF) {
170+
value &= ~PCF8523_CONTROL2_AF;
171+
pcf8523_write(pcf8523->client, PCF8523_REG_CONTROL2, value);
172172
rtc_update_irq(pcf8523->rtc, 1, RTC_IRQF | RTC_AF);
173173

174174
return IRQ_HANDLED;
@@ -182,13 +182,13 @@ static int pcf8523_stop_rtc(struct i2c_client *client)
182182
u8 value;
183183
int err;
184184

185-
err = pcf8523_read(client, REG_CONTROL1, &value);
185+
err = pcf8523_read(client, PCF8523_REG_CONTROL1, &value);
186186
if (err < 0)
187187
return err;
188188

189-
value |= REG_CONTROL1_STOP;
189+
value |= PCF8523_CONTROL1_STOP;
190190

191-
err = pcf8523_write(client, REG_CONTROL1, value);
191+
err = pcf8523_write(client, PCF8523_REG_CONTROL1, value);
192192
if (err < 0)
193193
return err;
194194

@@ -200,13 +200,13 @@ static int pcf8523_start_rtc(struct i2c_client *client)
200200
u8 value;
201201
int err;
202202

203-
err = pcf8523_read(client, REG_CONTROL1, &value);
203+
err = pcf8523_read(client, PCF8523_REG_CONTROL1, &value);
204204
if (err < 0)
205205
return err;
206206

207-
value &= ~REG_CONTROL1_STOP;
207+
value &= ~PCF8523_CONTROL1_STOP;
208208

209-
err = pcf8523_write(client, REG_CONTROL1, value);
209+
err = pcf8523_write(client, PCF8523_REG_CONTROL1, value);
210210
if (err < 0)
211211
return err;
212212

@@ -216,7 +216,7 @@ static int pcf8523_start_rtc(struct i2c_client *client)
216216
static int pcf8523_rtc_read_time(struct device *dev, struct rtc_time *tm)
217217
{
218218
struct i2c_client *client = to_i2c_client(dev);
219-
u8 start = REG_SECONDS, regs[7];
219+
u8 start = PCF8523_REG_SECONDS, regs[7];
220220
struct i2c_msg msgs[2];
221221
int err;
222222

@@ -242,7 +242,7 @@ static int pcf8523_rtc_read_time(struct device *dev, struct rtc_time *tm)
242242
if (err < 0)
243243
return err;
244244

245-
if (regs[0] & REG_SECONDS_OS)
245+
if (regs[0] & PCF8523_SECONDS_OS)
246246
return -EINVAL;
247247

248248
tm->tm_sec = bcd2bin(regs[0] & 0x7f);
@@ -267,8 +267,8 @@ static int pcf8523_rtc_set_time(struct device *dev, struct rtc_time *tm)
267267
if (err < 0)
268268
return err;
269269

270-
regs[0] = REG_SECONDS;
271-
/* This will purposely overwrite REG_SECONDS_OS */
270+
regs[0] = PCF8523_REG_SECONDS;
271+
/* This will purposely overwrite PCF8523_SECONDS_OS */
272272
regs[1] = bin2bcd(tm->tm_sec);
273273
regs[2] = bin2bcd(tm->tm_min);
274274
regs[3] = bin2bcd(tm->tm_hour);
@@ -299,7 +299,7 @@ static int pcf8523_rtc_set_time(struct device *dev, struct rtc_time *tm)
299299
static int pcf8523_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *tm)
300300
{
301301
struct i2c_client *client = to_i2c_client(dev);
302-
u8 start = REG_MINUTE_ALARM, regs[4];
302+
u8 start = PCF8523_REG_MINUTE_ALARM, regs[4];
303303
struct i2c_msg msgs[2];
304304
u8 value;
305305
int err;
@@ -324,15 +324,15 @@ static int pcf8523_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *tm)
324324
tm->time.tm_mday = bcd2bin(regs[2] & 0x3F);
325325
tm->time.tm_wday = bcd2bin(regs[3] & 0x7);
326326

327-
err = pcf8523_read(client, REG_CONTROL1, &value);
327+
err = pcf8523_read(client, PCF8523_REG_CONTROL1, &value);
328328
if (err < 0)
329329
return err;
330-
tm->enabled = !!(value & REG_CONTROL1_AIE);
330+
tm->enabled = !!(value & PCF8523_CONTROL1_AIE);
331331

332-
err = pcf8523_read(client, REG_CONTROL2, &value);
332+
err = pcf8523_read(client, PCF8523_REG_CONTROL2, &value);
333333
if (err < 0)
334334
return err;
335-
tm->pending = !!(value & REG_CONTROL2_AF);
335+
tm->pending = !!(value & PCF8523_CONTROL2_AF);
336336

337337
return 0;
338338
}
@@ -343,16 +343,16 @@ static int pcf8523_irq_enable(struct device *dev, unsigned int enabled)
343343
u8 value;
344344
int err;
345345

346-
err = pcf8523_read(client, REG_CONTROL1, &value);
346+
err = pcf8523_read(client, PCF8523_REG_CONTROL1, &value);
347347
if (err < 0)
348348
return err;
349349

350-
value &= REG_CONTROL1_AIE;
350+
value &= PCF8523_CONTROL1_AIE;
351351

352352
if (enabled)
353-
value |= REG_CONTROL1_AIE;
353+
value |= PCF8523_CONTROL1_AIE;
354354

355-
err = pcf8523_write(client, REG_CONTROL1, value);
355+
err = pcf8523_write(client, PCF8523_REG_CONTROL1, value);
356356
if (err < 0)
357357
return err;
358358

@@ -370,7 +370,7 @@ static int pcf8523_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *tm)
370370
if (err)
371371
return err;
372372

373-
err = pcf8523_write(client, REG_CONTROL2, 0);
373+
err = pcf8523_write(client, PCF8523_REG_CONTROL2, 0);
374374
if (err < 0)
375375
return err;
376376

@@ -382,7 +382,7 @@ static int pcf8523_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *tm)
382382
rtc_time64_to_tm(alarm_time, &tm->time);
383383
}
384384

385-
regs[0] = REG_MINUTE_ALARM;
385+
regs[0] = PCF8523_REG_MINUTE_ALARM;
386386
regs[1] = bin2bcd(tm->time.tm_min);
387387
regs[2] = bin2bcd(tm->time.tm_hour);
388388
regs[3] = bin2bcd(tm->time.tm_mday);
@@ -418,11 +418,11 @@ static int pcf8523_rtc_ioctl(struct device *dev, unsigned int cmd,
418418
if (ret)
419419
flags |= RTC_VL_BACKUP_LOW;
420420

421-
ret = pcf8523_read(client, REG_SECONDS, &value);
421+
ret = pcf8523_read(client, PCF8523_REG_SECONDS, &value);
422422
if (ret < 0)
423423
return ret;
424424

425-
if (value & REG_SECONDS_OS)
425+
if (value & PCF8523_SECONDS_OS)
426426
flags |= RTC_VL_DATA_INVALID;
427427

428428
return put_user(flags, (unsigned int __user *)arg);
@@ -442,13 +442,13 @@ static int pcf8523_rtc_read_offset(struct device *dev, long *offset)
442442
u8 value;
443443
s8 val;
444444

445-
err = pcf8523_read(client, REG_OFFSET, &value);
445+
err = pcf8523_read(client, PCF8523_REG_OFFSET, &value);
446446
if (err < 0)
447447
return err;
448448

449449
/* sign extend the 7-bit offset value */
450450
val = value << 1;
451-
*offset = (value & REG_OFFSET_MODE ? 4069 : 4340) * (val >> 1);
451+
*offset = (value & PCF8523_OFFSET_MODE ? 4069 : 4340) * (val >> 1);
452452

453453
return 0;
454454
}
@@ -465,9 +465,9 @@ static int pcf8523_rtc_set_offset(struct device *dev, long offset)
465465
if (abs(reg_m0 * 4340 - offset) < abs(reg_m1 * 4069 - offset))
466466
value = reg_m0 & 0x7f;
467467
else
468-
value = (reg_m1 & 0x7f) | REG_OFFSET_MODE;
468+
value = (reg_m1 & 0x7f) | PCF8523_OFFSET_MODE;
469469

470-
return pcf8523_write(client, REG_OFFSET, value);
470+
return pcf8523_write(client, PCF8523_REG_OFFSET, value);
471471
}
472472

473473
static const struct rtc_class_ops pcf8523_rtc_ops = {
@@ -519,7 +519,7 @@ static int pcf8523_probe(struct i2c_client *client,
519519
rtc->uie_unsupported = 1;
520520

521521
if (client->irq > 0) {
522-
err = pcf8523_write(client, REG_TMR_CLKOUT_CTRL, 0x38);
522+
err = pcf8523_write(client, PCF8523_TMR_CLKOUT_CTRL, 0x38);
523523
if (err < 0)
524524
return err;
525525

0 commit comments

Comments
 (0)