Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 73711
b: refs/heads/master
c: 9626f1f
h: refs/heads/master
i:
  73709: 6933622
  73707: 7c419e9
  73703: 52775f3
  73695: 816f3df
v: v3
  • Loading branch information
Bjorn Helgaas authored and Linus Torvalds committed Nov 15, 2007
1 parent db8cd9e commit 0b1b4d8
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4c06be10c790008aa2b2d19df2872ff39990b7bd
refs/heads/master: 9626f1f117be21b6e4b7a1cb49814fc065dd3d2d
36 changes: 30 additions & 6 deletions trunk/drivers/char/rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -918,12 +918,29 @@ static const struct file_operations rtc_proc_fops = {
};
#endif

static resource_size_t rtc_size;

static struct resource * __init rtc_request_region(resource_size_t size)
{
struct resource *r;

if (RTC_IOMAPPED)
r = request_region(RTC_PORT(0), size, "rtc");
else
r = request_mem_region(RTC_PORT(0), size, "rtc");

if (r)
rtc_size = size;

return r;
}

static void rtc_release_region(void)
{
if (RTC_IOMAPPED)
release_region(RTC_PORT(0), RTC_IO_EXTENT);
release_region(RTC_PORT(0), rtc_size);
else
release_mem_region(RTC_PORT(0), RTC_IO_EXTENT);
release_mem_region(RTC_PORT(0), rtc_size);
}

static int __init rtc_init(void)
Expand Down Expand Up @@ -976,10 +993,17 @@ static int __init rtc_init(void)
}
no_irq:
#else
if (RTC_IOMAPPED)
r = request_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc");
else
r = request_mem_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc");
r = rtc_request_region(RTC_IO_EXTENT);

/*
* If we've already requested a smaller range (for example, because
* PNPBIOS or ACPI told us how the device is configured), the request
* above might fail because it's too big.
*
* If so, request just the range we actually use.
*/
if (!r)
r = rtc_request_region(RTC_IO_EXTENT_USED);
if (!r) {
#ifdef RTC_IRQ
rtc_has_irq = 0;
Expand Down
3 changes: 3 additions & 0 deletions trunk/include/linux/mc146818rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,11 @@ struct cmos_rtc_board_info {
#ifndef ARCH_RTC_LOCATION /* Override by <asm/mc146818rtc.h>? */

#define RTC_IO_EXTENT 0x8
#define RTC_IO_EXTENT_USED 0x2
#define RTC_IOMAPPED 1 /* Default to I/O mapping. */

#else
#define RTC_IO_EXTENT_USED RTC_IO_EXTENT
#endif /* ARCH_RTC_LOCATION */

#endif /* _MC146818RTC_H */

0 comments on commit 0b1b4d8

Please sign in to comment.