Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 296200
b: refs/heads/master
c: 2983129
h: refs/heads/master
v: v3
  • Loading branch information
Nicolas Ferre committed Mar 1, 2012
1 parent 6ae1dbf commit 9e2a2cf
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 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: 986c265729cb798bb8414bd5d6c6006240a1011c
refs/heads/master: 298312971b2fe8b922a1a15e0a6f5b4da89677d8
4 changes: 2 additions & 2 deletions trunk/arch/arm/mach-at91/at91sam9260_devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
static struct resource tcb0_resources[] = {
[0] = {
.start = AT91SAM9260_BASE_TCB0,
.end = AT91SAM9260_BASE_TCB0 + SZ_16K - 1,
.end = AT91SAM9260_BASE_TCB0 + SZ_256 - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
Expand Down Expand Up @@ -672,7 +672,7 @@ static struct platform_device at91sam9260_tcb0_device = {
static struct resource tcb1_resources[] = {
[0] = {
.start = AT91SAM9260_BASE_TCB1,
.end = AT91SAM9260_BASE_TCB1 + SZ_16K - 1,
.end = AT91SAM9260_BASE_TCB1 + SZ_256 - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/arm/mach-at91/at91sam9g45_devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
static struct resource tcb0_resources[] = {
[0] = {
.start = AT91SAM9G45_BASE_TCB0,
.end = AT91SAM9G45_BASE_TCB0 + SZ_16K - 1,
.end = AT91SAM9G45_BASE_TCB0 + SZ_256 - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
Expand All @@ -1073,7 +1073,7 @@ static struct platform_device at91sam9g45_tcb0_device = {
static struct resource tcb1_resources[] = {
[0] = {
.start = AT91SAM9G45_BASE_TCB1,
.end = AT91SAM9G45_BASE_TCB1 + SZ_16K - 1,
.end = AT91SAM9G45_BASE_TCB1 + SZ_256 - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
Expand Down
17 changes: 9 additions & 8 deletions trunk/drivers/misc/atmel_tclib.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
#include <linux/slab.h>
#include <linux/export.h>

/* Number of bytes to reserve for the iomem resource */
#define ATMEL_TC_IOMEM_SIZE 256


/*
* This is a thin library to solve the problem of how to portably allocate
* one of the TC blocks. For simplicity, it doesn't currently expect to
Expand Down Expand Up @@ -48,6 +44,7 @@ struct atmel_tc *atmel_tc_alloc(unsigned block, const char *name)
struct atmel_tc *tc;
struct platform_device *pdev = NULL;
struct resource *r;
size_t size;

spin_lock(&tc_list_lock);
list_for_each_entry(tc, &tc_list, node) {
Expand All @@ -61,11 +58,15 @@ struct atmel_tc *atmel_tc_alloc(unsigned block, const char *name)
goto fail;

r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
r = request_mem_region(r->start, ATMEL_TC_IOMEM_SIZE, name);
if (!r)
goto fail;

tc->regs = ioremap(r->start, ATMEL_TC_IOMEM_SIZE);
size = resource_size(r);
r = request_mem_region(r->start, size, name);
if (!r)
goto fail;

tc->regs = ioremap(r->start, size);
if (!tc->regs)
goto fail_ioremap;

Expand All @@ -76,7 +77,7 @@ struct atmel_tc *atmel_tc_alloc(unsigned block, const char *name)
return tc;

fail_ioremap:
release_mem_region(r->start, ATMEL_TC_IOMEM_SIZE);
release_mem_region(r->start, size);
fail:
tc = NULL;
goto out;
Expand All @@ -96,7 +97,7 @@ void atmel_tc_free(struct atmel_tc *tc)
spin_lock(&tc_list_lock);
if (tc->regs) {
iounmap(tc->regs);
release_mem_region(tc->iomem->start, ATMEL_TC_IOMEM_SIZE);
release_mem_region(tc->iomem->start, resource_size(tc->iomem));
tc->regs = NULL;
tc->iomem = NULL;
}
Expand Down

0 comments on commit 9e2a2cf

Please sign in to comment.