diff options
author | Axel Lin <axel.lin@ingics.com> | 2013-04-29 19:20:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 21:28:39 -0400 |
commit | 08348d2f10d2c6c326bb642eb6f46a696c26f31e (patch) | |
tree | b8d2057e525f25b57a3b1a00423d6ed95ad9693f | |
parent | 431c6c1df36d1511d48ccbd38b9561a486142d42 (diff) |
drivers/rtc/rtc-max6902.c: use register defines instead of magic numbers
Current code has defines for registers, use the defines rather than
magic numbers.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Cc: Raphael Assenat <raph@raphnet.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/rtc/rtc-max6902.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c index 7730a6559188..e3aea00c3145 100644 --- a/drivers/rtc/rtc-max6902.c +++ b/drivers/rtc/rtc-max6902.c | |||
@@ -93,24 +93,24 @@ static int max6902_set_time(struct device *dev, struct rtc_time *dt) | |||
93 | dt->tm_year = dt->tm_year + 1900; | 93 | dt->tm_year = dt->tm_year + 1900; |
94 | 94 | ||
95 | /* Remove write protection */ | 95 | /* Remove write protection */ |
96 | max6902_set_reg(dev, 0xF, 0); | 96 | max6902_set_reg(dev, MAX6902_REG_CONTROL, 0); |
97 | 97 | ||
98 | max6902_set_reg(dev, 0x01, bin2bcd(dt->tm_sec)); | 98 | max6902_set_reg(dev, MAX6902_REG_SECONDS, bin2bcd(dt->tm_sec)); |
99 | max6902_set_reg(dev, 0x03, bin2bcd(dt->tm_min)); | 99 | max6902_set_reg(dev, MAX6902_REG_MINUTES, bin2bcd(dt->tm_min)); |
100 | max6902_set_reg(dev, 0x05, bin2bcd(dt->tm_hour)); | 100 | max6902_set_reg(dev, MAX6902_REG_HOURS, bin2bcd(dt->tm_hour)); |
101 | 101 | ||
102 | max6902_set_reg(dev, 0x07, bin2bcd(dt->tm_mday)); | 102 | max6902_set_reg(dev, MAX6902_REG_DATE, bin2bcd(dt->tm_mday)); |
103 | max6902_set_reg(dev, 0x09, bin2bcd(dt->tm_mon + 1)); | 103 | max6902_set_reg(dev, MAX6902_REG_MONTH, bin2bcd(dt->tm_mon + 1)); |
104 | max6902_set_reg(dev, 0x0B, bin2bcd(dt->tm_wday)); | 104 | max6902_set_reg(dev, MAX6902_REG_DAY, bin2bcd(dt->tm_wday)); |
105 | max6902_set_reg(dev, 0x0D, bin2bcd(dt->tm_year % 100)); | 105 | max6902_set_reg(dev, MAX6902_REG_YEAR, bin2bcd(dt->tm_year % 100)); |
106 | max6902_set_reg(dev, 0x13, bin2bcd(dt->tm_year / 100)); | 106 | max6902_set_reg(dev, MAX6902_REG_CENTURY, bin2bcd(dt->tm_year / 100)); |
107 | 107 | ||
108 | /* Compulab used a delay here. However, the datasheet | 108 | /* Compulab used a delay here. However, the datasheet |
109 | * does not mention a delay being required anywhere... */ | 109 | * does not mention a delay being required anywhere... */ |
110 | /* delay(2000); */ | 110 | /* delay(2000); */ |
111 | 111 | ||
112 | /* Write protect */ | 112 | /* Write protect */ |
113 | max6902_set_reg(dev, 0xF, 0x80); | 113 | max6902_set_reg(dev, MAX6902_REG_CONTROL, 0x80); |
114 | 114 | ||
115 | return 0; | 115 | return 0; |
116 | } | 116 | } |