Re: [PATCH] M48T35: new RTC driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun,  3 Aug 2008 19:41:40 +0200 (CEST), Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx> 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


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux