Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sparc64: fix wrong m48t59 RTC year

Correctly calculate offset to the year register for
Mostek RTC.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Krzysztof Helt and committed by
David S. Miller
3baca76f 1aa0365f

+4 -2
+4 -2
arch/sparc64/kernel/time.c
··· 500 500 static unsigned char mostek_read_byte(struct device *dev, u32 ofs) 501 501 { 502 502 struct platform_device *pdev = to_platform_device(dev); 503 + struct m48t59_plat_data *pdata = pdev->dev.platform_data; 503 504 void __iomem *regs; 504 505 unsigned char val; 505 506 ··· 508 507 val = readb(regs + ofs); 509 508 510 509 /* the year 0 is 1968 */ 511 - if (ofs == M48T59_YEAR) { 510 + if (ofs == pdata->offset + M48T59_YEAR) { 512 511 val += 0x68; 513 512 if ((val & 0xf) > 9) 514 513 val += 6; ··· 519 518 static void mostek_write_byte(struct device *dev, u32 ofs, u8 val) 520 519 { 521 520 struct platform_device *pdev = to_platform_device(dev); 521 + struct m48t59_plat_data *pdata = pdev->dev.platform_data; 522 522 void __iomem *regs; 523 523 524 524 regs = (void __iomem *) pdev->resource[0].start; 525 - if (ofs == M48T59_YEAR) { 525 + if (ofs == pdata->offset + M48T59_YEAR) { 526 526 if (val < 0x68) 527 527 val += 0x32; 528 528 else