linux-mips
[Top] [All Lists]

Re: [PATCH] M48T35: new RTC driver

To: tsbogend@alpha.franken.de
Subject: Re: [PATCH] M48T35: new RTC driver
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Mon, 04 Aug 2008 10:51:51 +0900 (JST)
Cc: rtc-linux@googlegroups.com, linux-mips@linux-mips.org, a.zummo@towertech.it, ralf@linux-mips.org
In-reply-to: <20080803174140.797B51DA6F4@solo.franken.de>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20080803174140.797B51DA6F4@solo.franken.de>
Sender: linux-mips-bounce@linux-mips.org
On Sun,  3 Aug 2008 19:41:40 +0200 (CEST), Thomas Bogendoerfer 
<tsbogend@alpha.franken.de> wrote:
> This driver replaces the broken ip27-rtc driver in drivers/char and
> gives back RTC support for SGI IP27 machines.
...
> +config RTC_DRV_M48T35
> +     tristate "ST M48T35"
> +     depends on SGI_IP27

Is this driver really IP27 specific?  Let's make drivers generic as
possible.

> +     if (yrs < 1970)
> +             return -EINVAL;
> +
> +     leap_yr = ((!(yrs % 4) && (yrs % 100)) || !(yrs % 400));
> +
> +     if ((mon > 12) || (day == 0))
> +             return -EINVAL;
> +
> +     if (day > (days_in_mo[mon] + ((mon == 2) && leap_yr)))
> +             return -EINVAL;
> +
> +     if ((hrs >= 24) || (min >= 60) || (sec >= 60))
> +             return -EINVAL;

rtc_valid_tm() can be used?

> +     if (!request_mem_region(res->start, priv->size, pdev->name)) {
> +             ret = -EBUSY;
> +             goto out;
> +     }
> +     priv->baseaddr = res->start;
> +     priv->reg = (struct m48t35_rtc __iomem *)res->start;

It seems priv->baseaddr is a physical address and priv->reg is a
virtual address.  ioremap() is not needed?

---
Atsushi Nemoto

<Prev in Thread] Current Thread [Next in Thread>