aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-05-05 18:48:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-05 18:48:53 -0400
commit2e83fc4df5f27dfc1b53044c4f142b2f9d1db08c (patch)
tree6afd0fe3aba28ed7137a9b2916a8a6d517ff9c04
parent17aa7e034416e3080bc57a786d09ba0a4a044561 (diff)
parent9185ef6787f1c8f1c06aa0cb3c7746fb4f101f50 (diff)
Merge branch 'powerpc-next' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'powerpc-next' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: [POWERPC] Assign PDE->data before gluing PDE into /proc tree [POWERPC] devres: Add devm_ioremap_prot() [POWERPC] macintosh: ADB driver: adb_handler_sem semaphore to mutex [POWERPC] macintosh: windfarm_smu_sat: semaphore to mutex [POWERPC] macintosh: therm_pm72: driver_lock semaphore to mutex
-rw-r--r--arch/powerpc/lib/Makefile1
-rw-r--r--arch/powerpc/lib/devres.c42
-rw-r--r--arch/powerpc/platforms/pseries/scanlog.c19
-rw-r--r--drivers/macintosh/adb.c30
-rw-r--r--drivers/macintosh/therm_pm72.c31
-rw-r--r--drivers/macintosh/windfarm_smu_sat.c10
-rw-r--r--include/asm-powerpc/io.h8
-rw-r--r--include/linux/io.h1
-rw-r--r--lib/devres.c2
9 files changed, 90 insertions, 54 deletions
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 4bb023f4c869..f1d2cdc5331b 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -23,3 +23,4 @@ obj-$(CONFIG_SMP) += locks.o
23endif 23endif
24 24
25obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o 25obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
26obj-$(CONFIG_HAS_IOMEM) += devres.o
diff --git a/arch/powerpc/lib/devres.c b/arch/powerpc/lib/devres.c
new file mode 100644
index 000000000000..292115d98ea9
--- /dev/null
+++ b/arch/powerpc/lib/devres.c
@@ -0,0 +1,42 @@
1/*
2 * Copyright (C) 2008 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#include <linux/device.h> /* devres_*(), devm_ioremap_release() */
11#include <linux/io.h> /* ioremap_flags() */
12#include <linux/module.h> /* EXPORT_SYMBOL() */
13
14/**
15 * devm_ioremap_prot - Managed ioremap_flags()
16 * @dev: Generic device to remap IO address for
17 * @offset: BUS offset to map
18 * @size: Size of map
19 * @flags: Page flags
20 *
21 * Managed ioremap_prot(). Map is automatically unmapped on driver
22 * detach.
23 */
24void __iomem *devm_ioremap_prot(struct device *dev, resource_size_t offset,
25 size_t size, unsigned long flags)
26{
27 void __iomem **ptr, *addr;
28
29 ptr = devres_alloc(devm_ioremap_release, sizeof(*ptr), GFP_KERNEL);
30 if (!ptr)
31 return NULL;
32
33 addr = ioremap_flags(offset, size, flags);
34 if (addr) {
35 *ptr = addr;
36 devres_add(dev, ptr);
37 } else
38 devres_free(ptr);
39
40 return addr;
41}
42EXPORT_SYMBOL(devm_ioremap_prot);
diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c
index bec3803f0618..417eca79df69 100644
--- a/arch/powerpc/platforms/pseries/scanlog.c
+++ b/arch/powerpc/platforms/pseries/scanlog.c
@@ -55,11 +55,6 @@ static ssize_t scanlog_read(struct file *file, char __user *buf,
55 dp = PDE(inode); 55 dp = PDE(inode);
56 data = (unsigned int *)dp->data; 56 data = (unsigned int *)dp->data;
57 57
58 if (!data) {
59 printk(KERN_ERR "scanlog: read failed no data\n");
60 return -EIO;
61 }
62
63 if (count > RTAS_DATA_BUF_SIZE) 58 if (count > RTAS_DATA_BUF_SIZE)
64 count = RTAS_DATA_BUF_SIZE; 59 count = RTAS_DATA_BUF_SIZE;
65 60
@@ -146,11 +141,6 @@ static int scanlog_open(struct inode * inode, struct file * file)
146 struct proc_dir_entry *dp = PDE(inode); 141 struct proc_dir_entry *dp = PDE(inode);
147 unsigned int *data = (unsigned int *)dp->data; 142 unsigned int *data = (unsigned int *)dp->data;
148 143
149 if (!data) {
150 printk(KERN_ERR "scanlog: open failed no data\n");
151 return -EIO;
152 }
153
154 if (data[0] != 0) { 144 if (data[0] != 0) {
155 /* This imperfect test stops a second copy of the 145 /* This imperfect test stops a second copy of the
156 * data (or a reset while data is being copied) 146 * data (or a reset while data is being copied)
@@ -168,10 +158,6 @@ static int scanlog_release(struct inode * inode, struct file * file)
168 struct proc_dir_entry *dp = PDE(inode); 158 struct proc_dir_entry *dp = PDE(inode);
169 unsigned int *data = (unsigned int *)dp->data; 159 unsigned int *data = (unsigned int *)dp->data;
170 160
171 if (!data) {
172 printk(KERN_ERR "scanlog: release failed no data\n");
173 return -EIO;
174 }
175 data[0] = 0; 161 data[0] = 0;
176 162
177 return 0; 163 return 0;
@@ -200,12 +186,11 @@ static int __init scanlog_init(void)
200 if (!data) 186 if (!data)
201 goto err; 187 goto err;
202 188
203 ent = proc_create("ppc64/rtas/scan-log-dump", S_IRUSR, NULL, 189 ent = proc_create_data("ppc64/rtas/scan-log-dump", S_IRUSR, NULL,
204 &scanlog_fops); 190 &scanlog_fops, data);
205 if (!ent) 191 if (!ent)
206 goto err; 192 goto err;
207 193
208 ent->data = data;
209 proc_ppc64_scan_log_dump = ent; 194 proc_ppc64_scan_log_dump = ent;
210 195
211 return 0; 196 return 0;
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 20978205cd02..b8b9e44f7f4e 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -37,7 +37,7 @@
37#include <linux/device.h> 37#include <linux/device.h>
38#include <linux/kthread.h> 38#include <linux/kthread.h>
39#include <linux/platform_device.h> 39#include <linux/platform_device.h>
40#include <linux/semaphore.h> 40#include <linux/mutex.h>
41 41
42#include <asm/uaccess.h> 42#include <asm/uaccess.h>
43#ifdef CONFIG_PPC 43#ifdef CONFIG_PPC
@@ -102,7 +102,7 @@ static struct adb_handler {
102} adb_handler[16]; 102} adb_handler[16];
103 103
104/* 104/*
105 * The adb_handler_sem mutex protects all accesses to the original_address 105 * The adb_handler_mutex mutex protects all accesses to the original_address
106 * and handler_id fields of adb_handler[i] for all i, and changes to the 106 * and handler_id fields of adb_handler[i] for all i, and changes to the
107 * handler field. 107 * handler field.
108 * Accesses to the handler field are protected by the adb_handler_lock 108 * Accesses to the handler field are protected by the adb_handler_lock
@@ -110,7 +110,7 @@ static struct adb_handler {
110 * time adb_unregister returns, we know that the old handler isn't being 110 * time adb_unregister returns, we know that the old handler isn't being
111 * called. 111 * called.
112 */ 112 */
113static DECLARE_MUTEX(adb_handler_sem); 113static DEFINE_MUTEX(adb_handler_mutex);
114static DEFINE_RWLOCK(adb_handler_lock); 114static DEFINE_RWLOCK(adb_handler_lock);
115 115
116#if 0 116#if 0
@@ -355,7 +355,7 @@ do_adb_reset_bus(void)
355 msleep(500); 355 msleep(500);
356 } 356 }
357 357
358 down(&adb_handler_sem); 358 mutex_lock(&adb_handler_mutex);
359 write_lock_irq(&adb_handler_lock); 359 write_lock_irq(&adb_handler_lock);
360 memset(adb_handler, 0, sizeof(adb_handler)); 360 memset(adb_handler, 0, sizeof(adb_handler));
361 write_unlock_irq(&adb_handler_lock); 361 write_unlock_irq(&adb_handler_lock);
@@ -376,7 +376,7 @@ do_adb_reset_bus(void)
376 if (adb_controller->autopoll) 376 if (adb_controller->autopoll)
377 adb_controller->autopoll(autopoll_devs); 377 adb_controller->autopoll(autopoll_devs);
378 } 378 }
379 up(&adb_handler_sem); 379 mutex_unlock(&adb_handler_mutex);
380 380
381 blocking_notifier_call_chain(&adb_client_list, 381 blocking_notifier_call_chain(&adb_client_list,
382 ADB_MSG_POST_RESET, NULL); 382 ADB_MSG_POST_RESET, NULL);
@@ -454,7 +454,7 @@ adb_register(int default_id, int handler_id, struct adb_ids *ids,
454{ 454{
455 int i; 455 int i;
456 456
457 down(&adb_handler_sem); 457 mutex_lock(&adb_handler_mutex);
458 ids->nids = 0; 458 ids->nids = 0;
459 for (i = 1; i < 16; i++) { 459 for (i = 1; i < 16; i++) {
460 if ((adb_handler[i].original_address == default_id) && 460 if ((adb_handler[i].original_address == default_id) &&
@@ -472,7 +472,7 @@ adb_register(int default_id, int handler_id, struct adb_ids *ids,
472 ids->id[ids->nids++] = i; 472 ids->id[ids->nids++] = i;
473 } 473 }
474 } 474 }
475 up(&adb_handler_sem); 475 mutex_unlock(&adb_handler_mutex);
476 return ids->nids; 476 return ids->nids;
477} 477}
478 478
@@ -481,7 +481,7 @@ adb_unregister(int index)
481{ 481{
482 int ret = -ENODEV; 482 int ret = -ENODEV;
483 483
484 down(&adb_handler_sem); 484 mutex_lock(&adb_handler_mutex);
485 write_lock_irq(&adb_handler_lock); 485 write_lock_irq(&adb_handler_lock);
486 if (adb_handler[index].handler) { 486 if (adb_handler[index].handler) {
487 while(adb_handler[index].busy) { 487 while(adb_handler[index].busy) {
@@ -493,7 +493,7 @@ adb_unregister(int index)
493 adb_handler[index].handler = NULL; 493 adb_handler[index].handler = NULL;
494 } 494 }
495 write_unlock_irq(&adb_handler_lock); 495 write_unlock_irq(&adb_handler_lock);
496 up(&adb_handler_sem); 496 mutex_unlock(&adb_handler_mutex);
497 return ret; 497 return ret;
498} 498}
499 499
@@ -557,19 +557,19 @@ adb_try_handler_change(int address, int new_id)
557{ 557{
558 int ret; 558 int ret;
559 559
560 down(&adb_handler_sem); 560 mutex_lock(&adb_handler_mutex);
561 ret = try_handler_change(address, new_id); 561 ret = try_handler_change(address, new_id);
562 up(&adb_handler_sem); 562 mutex_unlock(&adb_handler_mutex);
563 return ret; 563 return ret;
564} 564}
565 565
566int 566int
567adb_get_infos(int address, int *original_address, int *handler_id) 567adb_get_infos(int address, int *original_address, int *handler_id)
568{ 568{
569 down(&adb_handler_sem); 569 mutex_lock(&adb_handler_mutex);
570 *original_address = adb_handler[address].original_address; 570 *original_address = adb_handler[address].original_address;
571 *handler_id = adb_handler[address].handler_id; 571 *handler_id = adb_handler[address].handler_id;
572 up(&adb_handler_sem); 572 mutex_unlock(&adb_handler_mutex);
573 573
574 return (*original_address != 0); 574 return (*original_address != 0);
575} 575}
@@ -628,10 +628,10 @@ do_adb_query(struct adb_request *req)
628 case ADB_QUERY_GETDEVINFO: 628 case ADB_QUERY_GETDEVINFO:
629 if (req->nbytes < 3) 629 if (req->nbytes < 3)
630 break; 630 break;
631 down(&adb_handler_sem); 631 mutex_lock(&adb_handler_mutex);
632 req->reply[0] = adb_handler[req->data[2]].original_address; 632 req->reply[0] = adb_handler[req->data[2]].original_address;
633 req->reply[1] = adb_handler[req->data[2]].handler_id; 633 req->reply[1] = adb_handler[req->data[2]].handler_id;
634 up(&adb_handler_sem); 634 mutex_unlock(&adb_handler_mutex);
635 req->complete = 1; 635 req->complete = 1;
636 req->reply_len = 2; 636 req->reply_len = 2;
637 adb_write_done(req); 637 adb_write_done(req);
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
index 1e0a69a5e815..ddfb426a9abd 100644
--- a/drivers/macintosh/therm_pm72.c
+++ b/drivers/macintosh/therm_pm72.c
@@ -122,6 +122,7 @@
122#include <linux/kmod.h> 122#include <linux/kmod.h>
123#include <linux/i2c.h> 123#include <linux/i2c.h>
124#include <linux/kthread.h> 124#include <linux/kthread.h>
125#include <linux/mutex.h>
125#include <asm/prom.h> 126#include <asm/prom.h>
126#include <asm/machdep.h> 127#include <asm/machdep.h>
127#include <asm/io.h> 128#include <asm/io.h>
@@ -169,7 +170,7 @@ static int rackmac;
169static s32 dimm_output_clamp; 170static s32 dimm_output_clamp;
170static int fcu_rpm_shift; 171static int fcu_rpm_shift;
171static int fcu_tickle_ticks; 172static int fcu_tickle_ticks;
172static DECLARE_MUTEX(driver_lock); 173static DEFINE_MUTEX(driver_lock);
173 174
174/* 175/*
175 * We have 3 types of CPU PID control. One is "split" old style control 176 * We have 3 types of CPU PID control. One is "split" old style control
@@ -729,9 +730,9 @@ static void fetch_cpu_pumps_minmax(void)
729static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \ 730static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \
730{ \ 731{ \
731 ssize_t r; \ 732 ssize_t r; \
732 down(&driver_lock); \ 733 mutex_lock(&driver_lock); \
733 r = sprintf(buf, "%d.%03d", FIX32TOPRINT(data)); \ 734 r = sprintf(buf, "%d.%03d", FIX32TOPRINT(data)); \
734 up(&driver_lock); \ 735 mutex_unlock(&driver_lock); \
735 return r; \ 736 return r; \
736} 737}
737#define BUILD_SHOW_FUNC_INT(name, data) \ 738#define BUILD_SHOW_FUNC_INT(name, data) \
@@ -1803,11 +1804,11 @@ static int main_control_loop(void *x)
1803{ 1804{
1804 DBG("main_control_loop started\n"); 1805 DBG("main_control_loop started\n");
1805 1806
1806 down(&driver_lock); 1807 mutex_lock(&driver_lock);
1807 1808
1808 if (start_fcu() < 0) { 1809 if (start_fcu() < 0) {
1809 printk(KERN_ERR "kfand: failed to start FCU\n"); 1810 printk(KERN_ERR "kfand: failed to start FCU\n");
1810 up(&driver_lock); 1811 mutex_unlock(&driver_lock);
1811 goto out; 1812 goto out;
1812 } 1813 }
1813 1814
@@ -1822,14 +1823,14 @@ static int main_control_loop(void *x)
1822 1823
1823 fcu_tickle_ticks = FCU_TICKLE_TICKS; 1824 fcu_tickle_ticks = FCU_TICKLE_TICKS;
1824 1825
1825 up(&driver_lock); 1826 mutex_unlock(&driver_lock);
1826 1827
1827 while (state == state_attached) { 1828 while (state == state_attached) {
1828 unsigned long elapsed, start; 1829 unsigned long elapsed, start;
1829 1830
1830 start = jiffies; 1831 start = jiffies;
1831 1832
1832 down(&driver_lock); 1833 mutex_lock(&driver_lock);
1833 1834
1834 /* Tickle the FCU just in case */ 1835 /* Tickle the FCU just in case */
1835 if (--fcu_tickle_ticks < 0) { 1836 if (--fcu_tickle_ticks < 0) {
@@ -1861,7 +1862,7 @@ static int main_control_loop(void *x)
1861 do_monitor_slots(&slots_state); 1862 do_monitor_slots(&slots_state);
1862 else 1863 else
1863 do_monitor_drives(&drives_state); 1864 do_monitor_drives(&drives_state);
1864 up(&driver_lock); 1865 mutex_unlock(&driver_lock);
1865 1866
1866 if (critical_state == 1) { 1867 if (critical_state == 1) {
1867 printk(KERN_WARNING "Temperature control detected a critical condition\n"); 1868 printk(KERN_WARNING "Temperature control detected a critical condition\n");
@@ -2019,13 +2020,13 @@ static void detach_fcu(void)
2019 */ 2020 */
2020static int therm_pm72_attach(struct i2c_adapter *adapter) 2021static int therm_pm72_attach(struct i2c_adapter *adapter)
2021{ 2022{
2022 down(&driver_lock); 2023 mutex_lock(&driver_lock);
2023 2024
2024 /* Check state */ 2025 /* Check state */
2025 if (state == state_detached) 2026 if (state == state_detached)
2026 state = state_attaching; 2027 state = state_attaching;
2027 if (state != state_attaching) { 2028 if (state != state_attaching) {
2028 up(&driver_lock); 2029 mutex_unlock(&driver_lock);
2029 return 0; 2030 return 0;
2030 } 2031 }
2031 2032
@@ -2054,7 +2055,7 @@ static int therm_pm72_attach(struct i2c_adapter *adapter)
2054 state = state_attached; 2055 state = state_attached;
2055 start_control_loops(); 2056 start_control_loops();
2056 } 2057 }
2057 up(&driver_lock); 2058 mutex_unlock(&driver_lock);
2058 2059
2059 return 0; 2060 return 0;
2060} 2061}
@@ -2065,16 +2066,16 @@ static int therm_pm72_attach(struct i2c_adapter *adapter)
2065 */ 2066 */
2066static int therm_pm72_detach(struct i2c_adapter *adapter) 2067static int therm_pm72_detach(struct i2c_adapter *adapter)
2067{ 2068{
2068 down(&driver_lock); 2069 mutex_lock(&driver_lock);
2069 2070
2070 if (state != state_detached) 2071 if (state != state_detached)
2071 state = state_detaching; 2072 state = state_detaching;
2072 2073
2073 /* Stop control loops if any */ 2074 /* Stop control loops if any */
2074 DBG("stopping control loops\n"); 2075 DBG("stopping control loops\n");
2075 up(&driver_lock); 2076 mutex_unlock(&driver_lock);
2076 stop_control_loops(); 2077 stop_control_loops();
2077 down(&driver_lock); 2078 mutex_lock(&driver_lock);
2078 2079
2079 if (u3_0 != NULL && !strcmp(adapter->name, "u3 0")) { 2080 if (u3_0 != NULL && !strcmp(adapter->name, "u3 0")) {
2080 DBG("lost U3-0, disposing control loops\n"); 2081 DBG("lost U3-0, disposing control loops\n");
@@ -2090,7 +2091,7 @@ static int therm_pm72_detach(struct i2c_adapter *adapter)
2090 if (u3_0 == NULL && u3_1 == NULL) 2091 if (u3_0 == NULL && u3_1 == NULL)
2091 state = state_detached; 2092 state = state_detached;
2092 2093
2093 up(&driver_lock); 2094 mutex_unlock(&driver_lock);
2094 2095
2095 return 0; 2096 return 0;
2096} 2097}
diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c
index 797918d0e59c..7f2be4baaeda 100644
--- a/drivers/macintosh/windfarm_smu_sat.c
+++ b/drivers/macintosh/windfarm_smu_sat.c
@@ -13,7 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/wait.h> 14#include <linux/wait.h>
15#include <linux/i2c.h> 15#include <linux/i2c.h>
16#include <linux/semaphore.h> 16#include <linux/mutex.h>
17#include <asm/prom.h> 17#include <asm/prom.h>
18#include <asm/smu.h> 18#include <asm/smu.h>
19#include <asm/pmac_low_i2c.h> 19#include <asm/pmac_low_i2c.h>
@@ -36,7 +36,7 @@
36struct wf_sat { 36struct wf_sat {
37 int nr; 37 int nr;
38 atomic_t refcnt; 38 atomic_t refcnt;
39 struct semaphore mutex; 39 struct mutex mutex;
40 unsigned long last_read; /* jiffies when cache last updated */ 40 unsigned long last_read; /* jiffies when cache last updated */
41 u8 cache[16]; 41 u8 cache[16];
42 struct i2c_client i2c; 42 struct i2c_client i2c;
@@ -163,7 +163,7 @@ static int wf_sat_get(struct wf_sensor *sr, s32 *value)
163 if (sat->i2c.adapter == NULL) 163 if (sat->i2c.adapter == NULL)
164 return -ENODEV; 164 return -ENODEV;
165 165
166 down(&sat->mutex); 166 mutex_lock(&sat->mutex);
167 if (time_after(jiffies, (sat->last_read + MAX_AGE))) { 167 if (time_after(jiffies, (sat->last_read + MAX_AGE))) {
168 err = wf_sat_read_cache(sat); 168 err = wf_sat_read_cache(sat);
169 if (err) 169 if (err)
@@ -182,7 +182,7 @@ static int wf_sat_get(struct wf_sensor *sr, s32 *value)
182 err = 0; 182 err = 0;
183 183
184 fail: 184 fail:
185 up(&sat->mutex); 185 mutex_unlock(&sat->mutex);
186 return err; 186 return err;
187} 187}
188 188
@@ -233,7 +233,7 @@ static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev)
233 sat->nr = -1; 233 sat->nr = -1;
234 sat->node = of_node_get(dev); 234 sat->node = of_node_get(dev);
235 atomic_set(&sat->refcnt, 0); 235 atomic_set(&sat->refcnt, 0);
236 init_MUTEX(&sat->mutex); 236 mutex_init(&sat->mutex);
237 sat->i2c.addr = (addr >> 1) & 0x7f; 237 sat->i2c.addr = (addr >> 1) & 0x7f;
238 sat->i2c.adapter = adapter; 238 sat->i2c.adapter = adapter;
239 sat->i2c.driver = &wf_sat_driver; 239 sat->i2c.driver = &wf_sat_driver;
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index afae0697e8ce..e0062d73db1c 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -2,7 +2,7 @@
2#define _ASM_POWERPC_IO_H 2#define _ASM_POWERPC_IO_H
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5/* 5/*
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License 7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
@@ -18,6 +18,9 @@ extern int check_legacy_ioport(unsigned long base_port);
18#define _PNPWRP 0xa79 18#define _PNPWRP 0xa79
19#define PNPBIOS_BASE 0xf000 19#define PNPBIOS_BASE 0xf000
20 20
21#include <linux/device.h>
22#include <linux/io.h>
23
21#include <linux/compiler.h> 24#include <linux/compiler.h>
22#include <asm/page.h> 25#include <asm/page.h>
23#include <asm/byteorder.h> 26#include <asm/byteorder.h>
@@ -744,6 +747,9 @@ static inline void * bus_to_virt(unsigned long address)
744 747
745#define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set) 748#define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set)
746 749
750void __iomem *devm_ioremap_prot(struct device *dev, resource_size_t offset,
751 size_t size, unsigned long flags);
752
747#endif /* __KERNEL__ */ 753#endif /* __KERNEL__ */
748 754
749#endif /* _ASM_POWERPC_IO_H */ 755#endif /* _ASM_POWERPC_IO_H */
diff --git a/include/linux/io.h b/include/linux/io.h
index 3a03a3604cce..6c7f0ba0d5fa 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -65,5 +65,6 @@ void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
65void devm_iounmap(struct device *dev, void __iomem *addr); 65void devm_iounmap(struct device *dev, void __iomem *addr);
66int check_signature(const volatile void __iomem *io_addr, 66int check_signature(const volatile void __iomem *io_addr,
67 const unsigned char *signature, int length); 67 const unsigned char *signature, int length);
68void devm_ioremap_release(struct device *dev, void *res);
68 69
69#endif /* _LINUX_IO_H */ 70#endif /* _LINUX_IO_H */
diff --git a/lib/devres.c b/lib/devres.c
index 26c87c49d776..72c8909006da 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -2,7 +2,7 @@
2#include <linux/io.h> 2#include <linux/io.h>
3#include <linux/module.h> 3#include <linux/module.h>
4 4
5static void devm_ioremap_release(struct device *dev, void *res) 5void devm_ioremap_release(struct device *dev, void *res)
6{ 6{
7 iounmap(*(void __iomem **)res); 7 iounmap(*(void __iomem **)res);
8} 8}