aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sparc/kernel/ioport.c4
-rw-r--r--include/linux/ioport.h23
-rw-r--r--kernel/resource.c34
3 files changed, 33 insertions, 28 deletions
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 99d716b9507a..79d177149fdb 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -208,7 +208,7 @@ _sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz)
208 pa &= PAGE_MASK; 208 pa &= PAGE_MASK;
209 sparc_mapiorange(bus, pa, res->start, res->end - res->start + 1); 209 sparc_mapiorange(bus, pa, res->start, res->end - res->start + 1);
210 210
211 return (void __iomem *) (res->start + offset); 211 return (void __iomem *)(unsigned long)(res->start + offset);
212} 212}
213 213
214/* 214/*
@@ -325,7 +325,7 @@ void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp)
325 res->name = sdev->prom_name; 325 res->name = sdev->prom_name;
326 } 326 }
327 327
328 return (void *)res->start; 328 return (void *)(unsigned long)res->start;
329 329
330err_noiommu: 330err_noiommu:
331 release_resource(res); 331 release_resource(res);
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 535bd9585897..d4895236b7e9 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -98,31 +98,34 @@ extern struct resource * ____request_resource(struct resource *root, struct reso
98extern int release_resource(struct resource *new); 98extern int release_resource(struct resource *new);
99extern __deprecated_for_modules int insert_resource(struct resource *parent, struct resource *new); 99extern __deprecated_for_modules int insert_resource(struct resource *parent, struct resource *new);
100extern int allocate_resource(struct resource *root, struct resource *new, 100extern int allocate_resource(struct resource *root, struct resource *new,
101 unsigned long size, 101 resource_size_t size, resource_size_t min,
102 unsigned long min, unsigned long max, 102 resource_size_t max, resource_size_t align,
103 unsigned long align,
104 void (*alignf)(void *, struct resource *, 103 void (*alignf)(void *, struct resource *,
105 unsigned long, unsigned long), 104 resource_size_t, resource_size_t),
106 void *alignf_data); 105 void *alignf_data);
107int adjust_resource(struct resource *res, unsigned long start, 106int adjust_resource(struct resource *res, resource_size_t start,
108 unsigned long size); 107 resource_size_t size);
109 108
110/* Convenience shorthand with allocation */ 109/* Convenience shorthand with allocation */
111#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) 110#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name))
112#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name)) 111#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name))
113#define rename_region(region, newname) do { (region)->name = (newname); } while (0) 112#define rename_region(region, newname) do { (region)->name = (newname); } while (0)
114 113
115extern struct resource * __request_region(struct resource *, unsigned long start, unsigned long n, const char *name); 114extern struct resource * __request_region(struct resource *,
115 resource_size_t start,
116 resource_size_t n, const char *name);
116 117
117/* Compatibility cruft */ 118/* Compatibility cruft */
118#define release_region(start,n) __release_region(&ioport_resource, (start), (n)) 119#define release_region(start,n) __release_region(&ioport_resource, (start), (n))
119#define check_mem_region(start,n) __check_region(&iomem_resource, (start), (n)) 120#define check_mem_region(start,n) __check_region(&iomem_resource, (start), (n))
120#define release_mem_region(start,n) __release_region(&iomem_resource, (start), (n)) 121#define release_mem_region(start,n) __release_region(&iomem_resource, (start), (n))
121 122
122extern int __check_region(struct resource *, unsigned long, unsigned long); 123extern int __check_region(struct resource *, resource_size_t, resource_size_t);
123extern void __release_region(struct resource *, unsigned long, unsigned long); 124extern void __release_region(struct resource *, resource_size_t,
125 resource_size_t);
124 126
125static inline int __deprecated check_region(unsigned long s, unsigned long n) 127static inline int __deprecated check_region(resource_size_t s,
128 resource_size_t n)
126{ 129{
127 return __check_region(&ioport_resource, s, n); 130 return __check_region(&ioport_resource, s, n);
128} 131}
diff --git a/kernel/resource.c b/kernel/resource.c
index ea5f7811a408..54835c02ab37 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -151,8 +151,8 @@ __initcall(ioresources_init);
151/* Return the conflict entry if you can't request it */ 151/* Return the conflict entry if you can't request it */
152static struct resource * __request_resource(struct resource *root, struct resource *new) 152static struct resource * __request_resource(struct resource *root, struct resource *new)
153{ 153{
154 unsigned long start = new->start; 154 resource_size_t start = new->start;
155 unsigned long end = new->end; 155 resource_size_t end = new->end;
156 struct resource *tmp, **p; 156 struct resource *tmp, **p;
157 157
158 if (end < start) 158 if (end < start)
@@ -236,11 +236,10 @@ EXPORT_SYMBOL(release_resource);
236 * Find empty slot in the resource tree given range and alignment. 236 * Find empty slot in the resource tree given range and alignment.
237 */ 237 */
238static int find_resource(struct resource *root, struct resource *new, 238static int find_resource(struct resource *root, struct resource *new,
239 unsigned long size, 239 resource_size_t size, resource_size_t min,
240 unsigned long min, unsigned long max, 240 resource_size_t max, resource_size_t align,
241 unsigned long align,
242 void (*alignf)(void *, struct resource *, 241 void (*alignf)(void *, struct resource *,
243 unsigned long, unsigned long), 242 resource_size_t, resource_size_t),
244 void *alignf_data) 243 void *alignf_data)
245{ 244{
246 struct resource *this = root->child; 245 struct resource *this = root->child;
@@ -282,11 +281,10 @@ static int find_resource(struct resource *root, struct resource *new,
282 * Allocate empty slot in the resource tree given range and alignment. 281 * Allocate empty slot in the resource tree given range and alignment.
283 */ 282 */
284int allocate_resource(struct resource *root, struct resource *new, 283int allocate_resource(struct resource *root, struct resource *new,
285 unsigned long size, 284 resource_size_t size, resource_size_t min,
286 unsigned long min, unsigned long max, 285 resource_size_t max, resource_size_t align,
287 unsigned long align,
288 void (*alignf)(void *, struct resource *, 286 void (*alignf)(void *, struct resource *,
289 unsigned long, unsigned long), 287 resource_size_t, resource_size_t),
290 void *alignf_data) 288 void *alignf_data)
291{ 289{
292 int err; 290 int err;
@@ -378,10 +376,10 @@ EXPORT_SYMBOL(insert_resource);
378 * arguments. Returns -EBUSY if it can't fit. Existing children of 376 * arguments. Returns -EBUSY if it can't fit. Existing children of
379 * the resource are assumed to be immutable. 377 * the resource are assumed to be immutable.
380 */ 378 */
381int adjust_resource(struct resource *res, unsigned long start, unsigned long size) 379int adjust_resource(struct resource *res, resource_size_t start, resource_size_t size)
382{ 380{
383 struct resource *tmp, *parent = res->parent; 381 struct resource *tmp, *parent = res->parent;
384 unsigned long end = start + size - 1; 382 resource_size_t end = start + size - 1;
385 int result = -EBUSY; 383 int result = -EBUSY;
386 384
387 write_lock(&resource_lock); 385 write_lock(&resource_lock);
@@ -428,7 +426,9 @@ EXPORT_SYMBOL(adjust_resource);
428 * 426 *
429 * Release-region releases a matching busy region. 427 * Release-region releases a matching busy region.
430 */ 428 */
431struct resource * __request_region(struct resource *parent, unsigned long start, unsigned long n, const char *name) 429struct resource * __request_region(struct resource *parent,
430 resource_size_t start, resource_size_t n,
431 const char *name)
432{ 432{
433 struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL); 433 struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL);
434 434
@@ -464,7 +464,8 @@ struct resource * __request_region(struct resource *parent, unsigned long start,
464 464
465EXPORT_SYMBOL(__request_region); 465EXPORT_SYMBOL(__request_region);
466 466
467int __check_region(struct resource *parent, unsigned long start, unsigned long n) 467int __check_region(struct resource *parent, resource_size_t start,
468 resource_size_t n)
468{ 469{
469 struct resource * res; 470 struct resource * res;
470 471
@@ -479,10 +480,11 @@ int __check_region(struct resource *parent, unsigned long start, unsigned long n
479 480
480EXPORT_SYMBOL(__check_region); 481EXPORT_SYMBOL(__check_region);
481 482
482void __release_region(struct resource *parent, unsigned long start, unsigned long n) 483void __release_region(struct resource *parent, resource_size_t start,
484 resource_size_t n)
483{ 485{
484 struct resource **p; 486 struct resource **p;
485 unsigned long end; 487 resource_size_t end;
486 488
487 p = &parent->child; 489 p = &parent->child;
488 end = start + n - 1; 490 end = start + n - 1;