diff options
author | Adrian Bunk <bunk@kernel.org> | 2008-10-18 23:28:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 11:52:41 -0400 |
commit | e4d33969c2d0a9b92c7a2853e3f890dcb4ea37d1 (patch) | |
tree | b5543d1e16c789649c28922246fa7c3325c9f795 /drivers/i2c | |
parent | f6a2298c5fd1f074aa3626febea33f48cd3b5a94 (diff) |
i2c: use bcd2bin/bin2bcd
Change i2c to use the new bcd2bin/bin2bcd functions instead of the
obsolete BCD2BIN/BIN2BCD macros.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/chips/menelaus.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/i2c/chips/menelaus.c b/drivers/i2c/chips/menelaus.c index 176126d3a01d..4b364bae6b3e 100644 --- a/drivers/i2c/chips/menelaus.c +++ b/drivers/i2c/chips/menelaus.c | |||
@@ -832,52 +832,52 @@ static irqreturn_t menelaus_irq(int irq, void *_menelaus) | |||
832 | 832 | ||
833 | static void menelaus_to_time(char *regs, struct rtc_time *t) | 833 | static void menelaus_to_time(char *regs, struct rtc_time *t) |
834 | { | 834 | { |
835 | t->tm_sec = BCD2BIN(regs[0]); | 835 | t->tm_sec = bcd2bin(regs[0]); |
836 | t->tm_min = BCD2BIN(regs[1]); | 836 | t->tm_min = bcd2bin(regs[1]); |
837 | if (the_menelaus->rtc_control & RTC_CTRL_MODE12) { | 837 | if (the_menelaus->rtc_control & RTC_CTRL_MODE12) { |
838 | t->tm_hour = BCD2BIN(regs[2] & 0x1f) - 1; | 838 | t->tm_hour = bcd2bin(regs[2] & 0x1f) - 1; |
839 | if (regs[2] & RTC_HR_PM) | 839 | if (regs[2] & RTC_HR_PM) |
840 | t->tm_hour += 12; | 840 | t->tm_hour += 12; |
841 | } else | 841 | } else |
842 | t->tm_hour = BCD2BIN(regs[2] & 0x3f); | 842 | t->tm_hour = bcd2bin(regs[2] & 0x3f); |
843 | t->tm_mday = BCD2BIN(regs[3]); | 843 | t->tm_mday = bcd2bin(regs[3]); |
844 | t->tm_mon = BCD2BIN(regs[4]) - 1; | 844 | t->tm_mon = bcd2bin(regs[4]) - 1; |
845 | t->tm_year = BCD2BIN(regs[5]) + 100; | 845 | t->tm_year = bcd2bin(regs[5]) + 100; |
846 | } | 846 | } |
847 | 847 | ||
848 | static int time_to_menelaus(struct rtc_time *t, int regnum) | 848 | static int time_to_menelaus(struct rtc_time *t, int regnum) |
849 | { | 849 | { |
850 | int hour, status; | 850 | int hour, status; |
851 | 851 | ||
852 | status = menelaus_write_reg(regnum++, BIN2BCD(t->tm_sec)); | 852 | status = menelaus_write_reg(regnum++, bin2bcd(t->tm_sec)); |
853 | if (status < 0) | 853 | if (status < 0) |
854 | goto fail; | 854 | goto fail; |
855 | 855 | ||
856 | status = menelaus_write_reg(regnum++, BIN2BCD(t->tm_min)); | 856 | status = menelaus_write_reg(regnum++, bin2bcd(t->tm_min)); |
857 | if (status < 0) | 857 | if (status < 0) |
858 | goto fail; | 858 | goto fail; |
859 | 859 | ||
860 | if (the_menelaus->rtc_control & RTC_CTRL_MODE12) { | 860 | if (the_menelaus->rtc_control & RTC_CTRL_MODE12) { |
861 | hour = t->tm_hour + 1; | 861 | hour = t->tm_hour + 1; |
862 | if (hour > 12) | 862 | if (hour > 12) |
863 | hour = RTC_HR_PM | BIN2BCD(hour - 12); | 863 | hour = RTC_HR_PM | bin2bcd(hour - 12); |
864 | else | 864 | else |
865 | hour = BIN2BCD(hour); | 865 | hour = bin2bcd(hour); |
866 | } else | 866 | } else |
867 | hour = BIN2BCD(t->tm_hour); | 867 | hour = bin2bcd(t->tm_hour); |
868 | status = menelaus_write_reg(regnum++, hour); | 868 | status = menelaus_write_reg(regnum++, hour); |
869 | if (status < 0) | 869 | if (status < 0) |
870 | goto fail; | 870 | goto fail; |
871 | 871 | ||
872 | status = menelaus_write_reg(regnum++, BIN2BCD(t->tm_mday)); | 872 | status = menelaus_write_reg(regnum++, bin2bcd(t->tm_mday)); |
873 | if (status < 0) | 873 | if (status < 0) |
874 | goto fail; | 874 | goto fail; |
875 | 875 | ||
876 | status = menelaus_write_reg(regnum++, BIN2BCD(t->tm_mon + 1)); | 876 | status = menelaus_write_reg(regnum++, bin2bcd(t->tm_mon + 1)); |
877 | if (status < 0) | 877 | if (status < 0) |
878 | goto fail; | 878 | goto fail; |
879 | 879 | ||
880 | status = menelaus_write_reg(regnum++, BIN2BCD(t->tm_year - 100)); | 880 | status = menelaus_write_reg(regnum++, bin2bcd(t->tm_year - 100)); |
881 | if (status < 0) | 881 | if (status < 0) |
882 | goto fail; | 882 | goto fail; |
883 | 883 | ||
@@ -914,7 +914,7 @@ static int menelaus_read_time(struct device *dev, struct rtc_time *t) | |||
914 | } | 914 | } |
915 | 915 | ||
916 | menelaus_to_time(regs, t); | 916 | menelaus_to_time(regs, t); |
917 | t->tm_wday = BCD2BIN(regs[6]); | 917 | t->tm_wday = bcd2bin(regs[6]); |
918 | 918 | ||
919 | return 0; | 919 | return 0; |
920 | } | 920 | } |
@@ -927,7 +927,7 @@ static int menelaus_set_time(struct device *dev, struct rtc_time *t) | |||
927 | status = time_to_menelaus(t, MENELAUS_RTC_SEC); | 927 | status = time_to_menelaus(t, MENELAUS_RTC_SEC); |
928 | if (status < 0) | 928 | if (status < 0) |
929 | return status; | 929 | return status; |
930 | status = menelaus_write_reg(MENELAUS_RTC_WKDAY, BIN2BCD(t->tm_wday)); | 930 | status = menelaus_write_reg(MENELAUS_RTC_WKDAY, bin2bcd(t->tm_wday)); |
931 | if (status < 0) { | 931 | if (status < 0) { |
932 | dev_err(&the_menelaus->client->dev, "rtc write reg %02x " | 932 | dev_err(&the_menelaus->client->dev, "rtc write reg %02x " |
933 | "err %d\n", MENELAUS_RTC_WKDAY, status); | 933 | "err %d\n", MENELAUS_RTC_WKDAY, status); |