aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/agp/agp.h5
-rw-r--r--drivers/char/agp/alpha-agp.c2
-rw-r--r--drivers/char/agp/amd-k7-agp.c2
-rw-r--r--drivers/char/agp/amd64-agp.c2
-rw-r--r--drivers/char/agp/ati-agp.c2
-rw-r--r--drivers/char/agp/efficeon-agp.c2
-rw-r--r--drivers/char/agp/generic.c97
-rw-r--r--drivers/char/agp/hp-agp.c2
-rw-r--r--drivers/char/agp/i460-agp.c2
-rw-r--r--drivers/char/agp/intel-agp.c28
-rw-r--r--drivers/char/agp/nvidia-agp.c2
-rw-r--r--drivers/char/agp/parisc-agp.c2
-rw-r--r--drivers/char/agp/sis-agp.c2
-rw-r--r--drivers/char/agp/sworks-agp.c2
-rw-r--r--drivers/char/agp/uninorth-agp.c4
-rw-r--r--drivers/char/agp/via-agp.c4
-rw-r--r--drivers/char/hvc_xen.c6
-rw-r--r--drivers/char/hw_random/n2-drv.c2
-rw-r--r--drivers/char/rtc.c30
19 files changed, 173 insertions, 25 deletions
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h
index 4bada0e8b812..46f507531177 100644
--- a/drivers/char/agp/agp.h
+++ b/drivers/char/agp/agp.h
@@ -116,7 +116,9 @@ struct agp_bridge_driver {
116 struct agp_memory *(*alloc_by_type) (size_t, int); 116 struct agp_memory *(*alloc_by_type) (size_t, int);
117 void (*free_by_type)(struct agp_memory *); 117 void (*free_by_type)(struct agp_memory *);
118 void *(*agp_alloc_page)(struct agp_bridge_data *); 118 void *(*agp_alloc_page)(struct agp_bridge_data *);
119 int (*agp_alloc_pages)(struct agp_bridge_data *, struct agp_memory *, size_t);
119 void (*agp_destroy_page)(void *, int flags); 120 void (*agp_destroy_page)(void *, int flags);
121 void (*agp_destroy_pages)(struct agp_memory *);
120 int (*agp_type_to_mask_type) (struct agp_bridge_data *, int); 122 int (*agp_type_to_mask_type) (struct agp_bridge_data *, int);
121 void (*chipset_flush)(struct agp_bridge_data *); 123 void (*chipset_flush)(struct agp_bridge_data *);
122}; 124};
@@ -277,7 +279,10 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type);
277struct agp_memory *agp_generic_alloc_by_type(size_t page_count, int type); 279struct agp_memory *agp_generic_alloc_by_type(size_t page_count, int type);
278void agp_generic_free_by_type(struct agp_memory *curr); 280void agp_generic_free_by_type(struct agp_memory *curr);
279void *agp_generic_alloc_page(struct agp_bridge_data *bridge); 281void *agp_generic_alloc_page(struct agp_bridge_data *bridge);
282int agp_generic_alloc_pages(struct agp_bridge_data *agp_bridge,
283 struct agp_memory *memory, size_t page_count);
280void agp_generic_destroy_page(void *addr, int flags); 284void agp_generic_destroy_page(void *addr, int flags);
285void agp_generic_destroy_pages(struct agp_memory *memory);
281void agp_free_key(int key); 286void agp_free_key(int key);
282int agp_num_entries(void); 287int agp_num_entries(void);
283u32 agp_collect_device_status(struct agp_bridge_data *bridge, u32 mode, u32 command); 288u32 agp_collect_device_status(struct agp_bridge_data *bridge, u32 mode, u32 command);
diff --git a/drivers/char/agp/alpha-agp.c b/drivers/char/agp/alpha-agp.c
index 5da89f6c6c25..5ea4da8e9954 100644
--- a/drivers/char/agp/alpha-agp.c
+++ b/drivers/char/agp/alpha-agp.c
@@ -143,7 +143,9 @@ struct agp_bridge_driver alpha_core_agp_driver = {
143 .alloc_by_type = agp_generic_alloc_by_type, 143 .alloc_by_type = agp_generic_alloc_by_type,
144 .free_by_type = agp_generic_free_by_type, 144 .free_by_type = agp_generic_free_by_type,
145 .agp_alloc_page = agp_generic_alloc_page, 145 .agp_alloc_page = agp_generic_alloc_page,
146 .agp_alloc_pages = agp_generic_alloc_pages,
146 .agp_destroy_page = agp_generic_destroy_page, 147 .agp_destroy_page = agp_generic_destroy_page,
148 .agp_destroy_pages = agp_generic_destroy_pages,
147 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 149 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
148}; 150};
149 151
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index e280531843be..603a986e96af 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -386,7 +386,9 @@ static const struct agp_bridge_driver amd_irongate_driver = {
386 .alloc_by_type = agp_generic_alloc_by_type, 386 .alloc_by_type = agp_generic_alloc_by_type,
387 .free_by_type = agp_generic_free_by_type, 387 .free_by_type = agp_generic_free_by_type,
388 .agp_alloc_page = agp_generic_alloc_page, 388 .agp_alloc_page = agp_generic_alloc_page,
389 .agp_alloc_pages = agp_generic_alloc_pages,
389 .agp_destroy_page = agp_generic_destroy_page, 390 .agp_destroy_page = agp_generic_destroy_page,
391 .agp_destroy_pages = agp_generic_destroy_pages,
390 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 392 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
391}; 393};
392 394
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 7495c522d8e4..2812ee2b165a 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -224,7 +224,9 @@ static const struct agp_bridge_driver amd_8151_driver = {
224 .alloc_by_type = agp_generic_alloc_by_type, 224 .alloc_by_type = agp_generic_alloc_by_type,
225 .free_by_type = agp_generic_free_by_type, 225 .free_by_type = agp_generic_free_by_type,
226 .agp_alloc_page = agp_generic_alloc_page, 226 .agp_alloc_page = agp_generic_alloc_page,
227 .agp_alloc_pages = agp_generic_alloc_pages,
227 .agp_destroy_page = agp_generic_destroy_page, 228 .agp_destroy_page = agp_generic_destroy_page,
229 .agp_destroy_pages = agp_generic_destroy_pages,
228 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 230 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
229}; 231};
230 232
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index 6ecbcafb34b1..ae2791b926b9 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -418,7 +418,9 @@ static const struct agp_bridge_driver ati_generic_bridge = {
418 .alloc_by_type = agp_generic_alloc_by_type, 418 .alloc_by_type = agp_generic_alloc_by_type,
419 .free_by_type = agp_generic_free_by_type, 419 .free_by_type = agp_generic_free_by_type,
420 .agp_alloc_page = agp_generic_alloc_page, 420 .agp_alloc_page = agp_generic_alloc_page,
421 .agp_alloc_pages = agp_generic_alloc_pages,
421 .agp_destroy_page = agp_generic_destroy_page, 422 .agp_destroy_page = agp_generic_destroy_page,
423 .agp_destroy_pages = agp_generic_destroy_pages,
422 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 424 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
423}; 425};
424 426
diff --git a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c
index 8ca6f262ef85..453543a1f293 100644
--- a/drivers/char/agp/efficeon-agp.c
+++ b/drivers/char/agp/efficeon-agp.c
@@ -335,7 +335,9 @@ static const struct agp_bridge_driver efficeon_driver = {
335 .alloc_by_type = agp_generic_alloc_by_type, 335 .alloc_by_type = agp_generic_alloc_by_type,
336 .free_by_type = agp_generic_free_by_type, 336 .free_by_type = agp_generic_free_by_type,
337 .agp_alloc_page = agp_generic_alloc_page, 337 .agp_alloc_page = agp_generic_alloc_page,
338 .agp_alloc_pages = agp_generic_alloc_pages,
338 .agp_destroy_page = agp_generic_destroy_page, 339 .agp_destroy_page = agp_generic_destroy_page,
340 .agp_destroy_pages = agp_generic_destroy_pages,
339 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 341 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
340}; 342};
341 343
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index 118dbde25dc7..10d6cbd7c05e 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -201,14 +201,22 @@ void agp_free_memory(struct agp_memory *curr)
201 return; 201 return;
202 } 202 }
203 if (curr->page_count != 0) { 203 if (curr->page_count != 0) {
204 for (i = 0; i < curr->page_count; i++) { 204 if (curr->bridge->driver->agp_destroy_pages) {
205 curr->memory[i] = (unsigned long)gart_to_virt(curr->memory[i]); 205 curr->bridge->driver->agp_destroy_pages(curr);
206 curr->bridge->driver->agp_destroy_page((void *)curr->memory[i], 206 } else {
207 AGP_PAGE_DESTROY_UNMAP); 207
208 } 208 for (i = 0; i < curr->page_count; i++) {
209 for (i = 0; i < curr->page_count; i++) { 209 curr->memory[i] = (unsigned long)gart_to_virt(
210 curr->bridge->driver->agp_destroy_page((void *)curr->memory[i], 210 curr->memory[i]);
211 AGP_PAGE_DESTROY_FREE); 211 curr->bridge->driver->agp_destroy_page(
212 (void *)curr->memory[i],
213 AGP_PAGE_DESTROY_UNMAP);
214 }
215 for (i = 0; i < curr->page_count; i++) {
216 curr->bridge->driver->agp_destroy_page(
217 (void *)curr->memory[i],
218 AGP_PAGE_DESTROY_FREE);
219 }
212 } 220 }
213 } 221 }
214 agp_free_key(curr->key); 222 agp_free_key(curr->key);
@@ -264,6 +272,15 @@ struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge,
264 if (new == NULL) 272 if (new == NULL)
265 return NULL; 273 return NULL;
266 274
275 if (bridge->driver->agp_alloc_pages) {
276 if (bridge->driver->agp_alloc_pages(bridge, new, page_count)) {
277 agp_free_memory(new);
278 return NULL;
279 }
280 new->bridge = bridge;
281 return new;
282 }
283
267 for (i = 0; i < page_count; i++) { 284 for (i = 0; i < page_count; i++) {
268 void *addr = bridge->driver->agp_alloc_page(bridge); 285 void *addr = bridge->driver->agp_alloc_page(bridge);
269 286
@@ -1203,6 +1220,39 @@ EXPORT_SYMBOL(agp_generic_alloc_user);
1203 * against a maximum value. 1220 * against a maximum value.
1204 */ 1221 */
1205 1222
1223int agp_generic_alloc_pages(struct agp_bridge_data *bridge, struct agp_memory *mem, size_t num_pages)
1224{
1225 struct page * page;
1226 int i, ret = -ENOMEM;
1227
1228 for (i = 0; i < num_pages; i++) {
1229 page = alloc_page(GFP_KERNEL | GFP_DMA32);
1230 /* agp_free_memory() needs gart address */
1231 if (page == NULL)
1232 goto out;
1233
1234#ifndef CONFIG_X86
1235 map_page_into_agp(page);
1236#endif
1237 get_page(page);
1238 atomic_inc(&agp_bridge->current_memory_agp);
1239
1240 /* set_memory_array_uc() needs virtual address */
1241 mem->memory[i] = (unsigned long)page_address(page);
1242 mem->page_count++;
1243 }
1244
1245#ifdef CONFIG_X86
1246 set_memory_array_uc(mem->memory, num_pages);
1247#endif
1248 ret = 0;
1249out:
1250 for (i = 0; i < mem->page_count; i++)
1251 mem->memory[i] = virt_to_gart((void *)mem->memory[i]);
1252 return ret;
1253}
1254EXPORT_SYMBOL(agp_generic_alloc_pages);
1255
1206void *agp_generic_alloc_page(struct agp_bridge_data *bridge) 1256void *agp_generic_alloc_page(struct agp_bridge_data *bridge)
1207{ 1257{
1208 struct page * page; 1258 struct page * page;
@@ -1219,6 +1269,37 @@ void *agp_generic_alloc_page(struct agp_bridge_data *bridge)
1219} 1269}
1220EXPORT_SYMBOL(agp_generic_alloc_page); 1270EXPORT_SYMBOL(agp_generic_alloc_page);
1221 1271
1272void agp_generic_destroy_pages(struct agp_memory *mem)
1273{
1274 int i;
1275 void *addr;
1276 struct page *page;
1277
1278 if (!mem)
1279 return;
1280
1281 for (i = 0; i < mem->page_count; i++)
1282 mem->memory[i] = (unsigned long)gart_to_virt(mem->memory[i]);
1283
1284#ifdef CONFIG_X86
1285 set_memory_array_wb(mem->memory, mem->page_count);
1286#endif
1287
1288 for (i = 0; i < mem->page_count; i++) {
1289 addr = (void *)mem->memory[i];
1290 page = virt_to_page(addr);
1291
1292#ifndef CONFIG_X86
1293 unmap_page_from_agp(page);
1294#endif
1295
1296 put_page(page);
1297 free_page((unsigned long)addr);
1298 atomic_dec(&agp_bridge->current_memory_agp);
1299 mem->memory[i] = 0;
1300 }
1301}
1302EXPORT_SYMBOL(agp_generic_destroy_pages);
1222 1303
1223void agp_generic_destroy_page(void *addr, int flags) 1304void agp_generic_destroy_page(void *addr, int flags)
1224{ 1305{
diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c
index 80d7317f85c9..183ac3fe44fb 100644
--- a/drivers/char/agp/hp-agp.c
+++ b/drivers/char/agp/hp-agp.c
@@ -435,7 +435,9 @@ const struct agp_bridge_driver hp_zx1_driver = {
435 .alloc_by_type = agp_generic_alloc_by_type, 435 .alloc_by_type = agp_generic_alloc_by_type,
436 .free_by_type = agp_generic_free_by_type, 436 .free_by_type = agp_generic_free_by_type,
437 .agp_alloc_page = agp_generic_alloc_page, 437 .agp_alloc_page = agp_generic_alloc_page,
438 .agp_alloc_pages = agp_generic_alloc_pages,
438 .agp_destroy_page = agp_generic_destroy_page, 439 .agp_destroy_page = agp_generic_destroy_page,
440 .agp_destroy_pages = agp_generic_destroy_pages,
439 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 441 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
440 .cant_use_aperture = true, 442 .cant_use_aperture = true,
441}; 443};
diff --git a/drivers/char/agp/i460-agp.c b/drivers/char/agp/i460-agp.c
index e587eebebc67..10da687d131a 100644
--- a/drivers/char/agp/i460-agp.c
+++ b/drivers/char/agp/i460-agp.c
@@ -575,7 +575,9 @@ const struct agp_bridge_driver intel_i460_driver = {
575 .insert_memory = i460_insert_memory_small_io_page, 575 .insert_memory = i460_insert_memory_small_io_page,
576 .remove_memory = i460_remove_memory_small_io_page, 576 .remove_memory = i460_remove_memory_small_io_page,
577 .agp_alloc_page = agp_generic_alloc_page, 577 .agp_alloc_page = agp_generic_alloc_page,
578 .agp_alloc_pages = agp_generic_alloc_pages,
578 .agp_destroy_page = agp_generic_destroy_page, 579 .agp_destroy_page = agp_generic_destroy_page,
580 .agp_destroy_pages = agp_generic_destroy_pages,
579#endif 581#endif
580 .alloc_by_type = agp_generic_alloc_by_type, 582 .alloc_by_type = agp_generic_alloc_by_type,
581 .free_by_type = agp_generic_free_by_type, 583 .free_by_type = agp_generic_free_by_type,
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index 016fdf0623a4..043e36628d6d 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -1711,7 +1711,9 @@ static const struct agp_bridge_driver intel_generic_driver = {
1711 .alloc_by_type = agp_generic_alloc_by_type, 1711 .alloc_by_type = agp_generic_alloc_by_type,
1712 .free_by_type = agp_generic_free_by_type, 1712 .free_by_type = agp_generic_free_by_type,
1713 .agp_alloc_page = agp_generic_alloc_page, 1713 .agp_alloc_page = agp_generic_alloc_page,
1714 .agp_alloc_pages = agp_generic_alloc_pages,
1714 .agp_destroy_page = agp_generic_destroy_page, 1715 .agp_destroy_page = agp_generic_destroy_page,
1716 .agp_destroy_pages = agp_generic_destroy_pages,
1715 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1717 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1716}; 1718};
1717 1719
@@ -1736,7 +1738,9 @@ static const struct agp_bridge_driver intel_810_driver = {
1736 .alloc_by_type = intel_i810_alloc_by_type, 1738 .alloc_by_type = intel_i810_alloc_by_type,
1737 .free_by_type = intel_i810_free_by_type, 1739 .free_by_type = intel_i810_free_by_type,
1738 .agp_alloc_page = agp_generic_alloc_page, 1740 .agp_alloc_page = agp_generic_alloc_page,
1741 .agp_alloc_pages = agp_generic_alloc_pages,
1739 .agp_destroy_page = agp_generic_destroy_page, 1742 .agp_destroy_page = agp_generic_destroy_page,
1743 .agp_destroy_pages = agp_generic_destroy_pages,
1740 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1744 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1741}; 1745};
1742 1746
@@ -1760,7 +1764,9 @@ static const struct agp_bridge_driver intel_815_driver = {
1760 .alloc_by_type = agp_generic_alloc_by_type, 1764 .alloc_by_type = agp_generic_alloc_by_type,
1761 .free_by_type = agp_generic_free_by_type, 1765 .free_by_type = agp_generic_free_by_type,
1762 .agp_alloc_page = agp_generic_alloc_page, 1766 .agp_alloc_page = agp_generic_alloc_page,
1767 .agp_alloc_pages = agp_generic_alloc_pages,
1763 .agp_destroy_page = agp_generic_destroy_page, 1768 .agp_destroy_page = agp_generic_destroy_page,
1769 .agp_destroy_pages = agp_generic_destroy_pages,
1764 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1770 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1765}; 1771};
1766 1772
@@ -1785,7 +1791,9 @@ static const struct agp_bridge_driver intel_830_driver = {
1785 .alloc_by_type = intel_i830_alloc_by_type, 1791 .alloc_by_type = intel_i830_alloc_by_type,
1786 .free_by_type = intel_i810_free_by_type, 1792 .free_by_type = intel_i810_free_by_type,
1787 .agp_alloc_page = agp_generic_alloc_page, 1793 .agp_alloc_page = agp_generic_alloc_page,
1794 .agp_alloc_pages = agp_generic_alloc_pages,
1788 .agp_destroy_page = agp_generic_destroy_page, 1795 .agp_destroy_page = agp_generic_destroy_page,
1796 .agp_destroy_pages = agp_generic_destroy_pages,
1789 .agp_type_to_mask_type = intel_i830_type_to_mask_type, 1797 .agp_type_to_mask_type = intel_i830_type_to_mask_type,
1790 .chipset_flush = intel_i830_chipset_flush, 1798 .chipset_flush = intel_i830_chipset_flush,
1791}; 1799};
@@ -1810,7 +1818,9 @@ static const struct agp_bridge_driver intel_820_driver = {
1810 .alloc_by_type = agp_generic_alloc_by_type, 1818 .alloc_by_type = agp_generic_alloc_by_type,
1811 .free_by_type = agp_generic_free_by_type, 1819 .free_by_type = agp_generic_free_by_type,
1812 .agp_alloc_page = agp_generic_alloc_page, 1820 .agp_alloc_page = agp_generic_alloc_page,
1821 .agp_alloc_pages = agp_generic_alloc_pages,
1813 .agp_destroy_page = agp_generic_destroy_page, 1822 .agp_destroy_page = agp_generic_destroy_page,
1823 .agp_destroy_pages = agp_generic_destroy_pages,
1814 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1824 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1815}; 1825};
1816 1826
@@ -1834,7 +1844,9 @@ static const struct agp_bridge_driver intel_830mp_driver = {
1834 .alloc_by_type = agp_generic_alloc_by_type, 1844 .alloc_by_type = agp_generic_alloc_by_type,
1835 .free_by_type = agp_generic_free_by_type, 1845 .free_by_type = agp_generic_free_by_type,
1836 .agp_alloc_page = agp_generic_alloc_page, 1846 .agp_alloc_page = agp_generic_alloc_page,
1847 .agp_alloc_pages = agp_generic_alloc_pages,
1837 .agp_destroy_page = agp_generic_destroy_page, 1848 .agp_destroy_page = agp_generic_destroy_page,
1849 .agp_destroy_pages = agp_generic_destroy_pages,
1838 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1850 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1839}; 1851};
1840 1852
@@ -1858,7 +1870,9 @@ static const struct agp_bridge_driver intel_840_driver = {
1858 .alloc_by_type = agp_generic_alloc_by_type, 1870 .alloc_by_type = agp_generic_alloc_by_type,
1859 .free_by_type = agp_generic_free_by_type, 1871 .free_by_type = agp_generic_free_by_type,
1860 .agp_alloc_page = agp_generic_alloc_page, 1872 .agp_alloc_page = agp_generic_alloc_page,
1873 .agp_alloc_pages = agp_generic_alloc_pages,
1861 .agp_destroy_page = agp_generic_destroy_page, 1874 .agp_destroy_page = agp_generic_destroy_page,
1875 .agp_destroy_pages = agp_generic_destroy_pages,
1862 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1876 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1863}; 1877};
1864 1878
@@ -1882,7 +1896,9 @@ static const struct agp_bridge_driver intel_845_driver = {
1882 .alloc_by_type = agp_generic_alloc_by_type, 1896 .alloc_by_type = agp_generic_alloc_by_type,
1883 .free_by_type = agp_generic_free_by_type, 1897 .free_by_type = agp_generic_free_by_type,
1884 .agp_alloc_page = agp_generic_alloc_page, 1898 .agp_alloc_page = agp_generic_alloc_page,
1899 .agp_alloc_pages = agp_generic_alloc_pages,
1885 .agp_destroy_page = agp_generic_destroy_page, 1900 .agp_destroy_page = agp_generic_destroy_page,
1901 .agp_destroy_pages = agp_generic_destroy_pages,
1886 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1902 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1887 .chipset_flush = intel_i830_chipset_flush, 1903 .chipset_flush = intel_i830_chipset_flush,
1888}; 1904};
@@ -1907,7 +1923,9 @@ static const struct agp_bridge_driver intel_850_driver = {
1907 .alloc_by_type = agp_generic_alloc_by_type, 1923 .alloc_by_type = agp_generic_alloc_by_type,
1908 .free_by_type = agp_generic_free_by_type, 1924 .free_by_type = agp_generic_free_by_type,
1909 .agp_alloc_page = agp_generic_alloc_page, 1925 .agp_alloc_page = agp_generic_alloc_page,
1926 .agp_alloc_pages = agp_generic_alloc_pages,
1910 .agp_destroy_page = agp_generic_destroy_page, 1927 .agp_destroy_page = agp_generic_destroy_page,
1928 .agp_destroy_pages = agp_generic_destroy_pages,
1911 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1929 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1912}; 1930};
1913 1931
@@ -1931,7 +1949,9 @@ static const struct agp_bridge_driver intel_860_driver = {
1931 .alloc_by_type = agp_generic_alloc_by_type, 1949 .alloc_by_type = agp_generic_alloc_by_type,
1932 .free_by_type = agp_generic_free_by_type, 1950 .free_by_type = agp_generic_free_by_type,
1933 .agp_alloc_page = agp_generic_alloc_page, 1951 .agp_alloc_page = agp_generic_alloc_page,
1952 .agp_alloc_pages = agp_generic_alloc_pages,
1934 .agp_destroy_page = agp_generic_destroy_page, 1953 .agp_destroy_page = agp_generic_destroy_page,
1954 .agp_destroy_pages = agp_generic_destroy_pages,
1935 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1955 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1936}; 1956};
1937 1957
@@ -1956,7 +1976,9 @@ static const struct agp_bridge_driver intel_915_driver = {
1956 .alloc_by_type = intel_i830_alloc_by_type, 1976 .alloc_by_type = intel_i830_alloc_by_type,
1957 .free_by_type = intel_i810_free_by_type, 1977 .free_by_type = intel_i810_free_by_type,
1958 .agp_alloc_page = agp_generic_alloc_page, 1978 .agp_alloc_page = agp_generic_alloc_page,
1979 .agp_alloc_pages = agp_generic_alloc_pages,
1959 .agp_destroy_page = agp_generic_destroy_page, 1980 .agp_destroy_page = agp_generic_destroy_page,
1981 .agp_destroy_pages = agp_generic_destroy_pages,
1960 .agp_type_to_mask_type = intel_i830_type_to_mask_type, 1982 .agp_type_to_mask_type = intel_i830_type_to_mask_type,
1961 .chipset_flush = intel_i915_chipset_flush, 1983 .chipset_flush = intel_i915_chipset_flush,
1962}; 1984};
@@ -1982,7 +2004,9 @@ static const struct agp_bridge_driver intel_i965_driver = {
1982 .alloc_by_type = intel_i830_alloc_by_type, 2004 .alloc_by_type = intel_i830_alloc_by_type,
1983 .free_by_type = intel_i810_free_by_type, 2005 .free_by_type = intel_i810_free_by_type,
1984 .agp_alloc_page = agp_generic_alloc_page, 2006 .agp_alloc_page = agp_generic_alloc_page,
2007 .agp_alloc_pages = agp_generic_alloc_pages,
1985 .agp_destroy_page = agp_generic_destroy_page, 2008 .agp_destroy_page = agp_generic_destroy_page,
2009 .agp_destroy_pages = agp_generic_destroy_pages,
1986 .agp_type_to_mask_type = intel_i830_type_to_mask_type, 2010 .agp_type_to_mask_type = intel_i830_type_to_mask_type,
1987 .chipset_flush = intel_i915_chipset_flush, 2011 .chipset_flush = intel_i915_chipset_flush,
1988}; 2012};
@@ -2007,7 +2031,9 @@ static const struct agp_bridge_driver intel_7505_driver = {
2007 .alloc_by_type = agp_generic_alloc_by_type, 2031 .alloc_by_type = agp_generic_alloc_by_type,
2008 .free_by_type = agp_generic_free_by_type, 2032 .free_by_type = agp_generic_free_by_type,
2009 .agp_alloc_page = agp_generic_alloc_page, 2033 .agp_alloc_page = agp_generic_alloc_page,
2034 .agp_alloc_pages = agp_generic_alloc_pages,
2010 .agp_destroy_page = agp_generic_destroy_page, 2035 .agp_destroy_page = agp_generic_destroy_page,
2036 .agp_destroy_pages = agp_generic_destroy_pages,
2011 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 2037 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
2012}; 2038};
2013 2039
@@ -2032,7 +2058,9 @@ static const struct agp_bridge_driver intel_g33_driver = {
2032 .alloc_by_type = intel_i830_alloc_by_type, 2058 .alloc_by_type = intel_i830_alloc_by_type,
2033 .free_by_type = intel_i810_free_by_type, 2059 .free_by_type = intel_i810_free_by_type,
2034 .agp_alloc_page = agp_generic_alloc_page, 2060 .agp_alloc_page = agp_generic_alloc_page,
2061 .agp_alloc_pages = agp_generic_alloc_pages,
2035 .agp_destroy_page = agp_generic_destroy_page, 2062 .agp_destroy_page = agp_generic_destroy_page,
2063 .agp_destroy_pages = agp_generic_destroy_pages,
2036 .agp_type_to_mask_type = intel_i830_type_to_mask_type, 2064 .agp_type_to_mask_type = intel_i830_type_to_mask_type,
2037 .chipset_flush = intel_i915_chipset_flush, 2065 .chipset_flush = intel_i915_chipset_flush,
2038}; 2066};
diff --git a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c
index eaceb61ba2dc..dc70d3771811 100644
--- a/drivers/char/agp/nvidia-agp.c
+++ b/drivers/char/agp/nvidia-agp.c
@@ -312,7 +312,9 @@ static const struct agp_bridge_driver nvidia_driver = {
312 .alloc_by_type = agp_generic_alloc_by_type, 312 .alloc_by_type = agp_generic_alloc_by_type,
313 .free_by_type = agp_generic_free_by_type, 313 .free_by_type = agp_generic_free_by_type,
314 .agp_alloc_page = agp_generic_alloc_page, 314 .agp_alloc_page = agp_generic_alloc_page,
315 .agp_alloc_pages = agp_generic_alloc_pages,
315 .agp_destroy_page = agp_generic_destroy_page, 316 .agp_destroy_page = agp_generic_destroy_page,
317 .agp_destroy_pages = agp_generic_destroy_pages,
316 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 318 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
317}; 319};
318 320
diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c
index 8c42dcc5958c..f2492ecf0824 100644
--- a/drivers/char/agp/parisc-agp.c
+++ b/drivers/char/agp/parisc-agp.c
@@ -224,7 +224,9 @@ static const struct agp_bridge_driver parisc_agp_driver = {
224 .alloc_by_type = agp_generic_alloc_by_type, 224 .alloc_by_type = agp_generic_alloc_by_type,
225 .free_by_type = agp_generic_free_by_type, 225 .free_by_type = agp_generic_free_by_type,
226 .agp_alloc_page = agp_generic_alloc_page, 226 .agp_alloc_page = agp_generic_alloc_page,
227 .agp_alloc_pages = agp_generic_alloc_pages,
227 .agp_destroy_page = agp_generic_destroy_page, 228 .agp_destroy_page = agp_generic_destroy_page,
229 .agp_destroy_pages = agp_generic_destroy_pages,
228 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 230 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
229 .cant_use_aperture = true, 231 .cant_use_aperture = true,
230}; 232};
diff --git a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c
index 2587ef96a960..6c3837a0184d 100644
--- a/drivers/char/agp/sis-agp.c
+++ b/drivers/char/agp/sis-agp.c
@@ -140,7 +140,9 @@ static struct agp_bridge_driver sis_driver = {
140 .alloc_by_type = agp_generic_alloc_by_type, 140 .alloc_by_type = agp_generic_alloc_by_type,
141 .free_by_type = agp_generic_free_by_type, 141 .free_by_type = agp_generic_free_by_type,
142 .agp_alloc_page = agp_generic_alloc_page, 142 .agp_alloc_page = agp_generic_alloc_page,
143 .agp_alloc_pages = agp_generic_alloc_pages,
143 .agp_destroy_page = agp_generic_destroy_page, 144 .agp_destroy_page = agp_generic_destroy_page,
145 .agp_destroy_pages = agp_generic_destroy_pages,
144 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 146 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
145}; 147};
146 148
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c
index 2fb27fe4c10c..6224df8b7f0a 100644
--- a/drivers/char/agp/sworks-agp.c
+++ b/drivers/char/agp/sworks-agp.c
@@ -437,7 +437,9 @@ static const struct agp_bridge_driver sworks_driver = {
437 .alloc_by_type = agp_generic_alloc_by_type, 437 .alloc_by_type = agp_generic_alloc_by_type,
438 .free_by_type = agp_generic_free_by_type, 438 .free_by_type = agp_generic_free_by_type,
439 .agp_alloc_page = agp_generic_alloc_page, 439 .agp_alloc_page = agp_generic_alloc_page,
440 .agp_alloc_pages = agp_generic_alloc_pages,
440 .agp_destroy_page = agp_generic_destroy_page, 441 .agp_destroy_page = agp_generic_destroy_page,
442 .agp_destroy_pages = agp_generic_destroy_pages,
441 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 443 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
442}; 444};
443 445
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index eef72709ec53..0f004b65ec03 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -509,7 +509,9 @@ const struct agp_bridge_driver uninorth_agp_driver = {
509 .alloc_by_type = agp_generic_alloc_by_type, 509 .alloc_by_type = agp_generic_alloc_by_type,
510 .free_by_type = agp_generic_free_by_type, 510 .free_by_type = agp_generic_free_by_type,
511 .agp_alloc_page = agp_generic_alloc_page, 511 .agp_alloc_page = agp_generic_alloc_page,
512 .agp_alloc_pages = agp_generic_alloc_pages,
512 .agp_destroy_page = agp_generic_destroy_page, 513 .agp_destroy_page = agp_generic_destroy_page,
514 .agp_destroy_pages = agp_generic_destroy_pages,
513 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 515 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
514 .cant_use_aperture = true, 516 .cant_use_aperture = true,
515}; 517};
@@ -534,7 +536,9 @@ const struct agp_bridge_driver u3_agp_driver = {
534 .alloc_by_type = agp_generic_alloc_by_type, 536 .alloc_by_type = agp_generic_alloc_by_type,
535 .free_by_type = agp_generic_free_by_type, 537 .free_by_type = agp_generic_free_by_type,
536 .agp_alloc_page = agp_generic_alloc_page, 538 .agp_alloc_page = agp_generic_alloc_page,
539 .agp_alloc_pages = agp_generic_alloc_pages,
537 .agp_destroy_page = agp_generic_destroy_page, 540 .agp_destroy_page = agp_generic_destroy_page,
541 .agp_destroy_pages = agp_generic_destroy_pages,
538 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 542 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
539 .cant_use_aperture = true, 543 .cant_use_aperture = true,
540 .needs_scratch_page = true, 544 .needs_scratch_page = true,
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
index 7b36476dff41..9f4d49e1b59a 100644
--- a/drivers/char/agp/via-agp.c
+++ b/drivers/char/agp/via-agp.c
@@ -190,7 +190,9 @@ static const struct agp_bridge_driver via_agp3_driver = {
190 .alloc_by_type = agp_generic_alloc_by_type, 190 .alloc_by_type = agp_generic_alloc_by_type,
191 .free_by_type = agp_generic_free_by_type, 191 .free_by_type = agp_generic_free_by_type,
192 .agp_alloc_page = agp_generic_alloc_page, 192 .agp_alloc_page = agp_generic_alloc_page,
193 .agp_alloc_pages = agp_generic_alloc_pages,
193 .agp_destroy_page = agp_generic_destroy_page, 194 .agp_destroy_page = agp_generic_destroy_page,
195 .agp_destroy_pages = agp_generic_destroy_pages,
194 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 196 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
195}; 197};
196 198
@@ -214,7 +216,9 @@ static const struct agp_bridge_driver via_driver = {
214 .alloc_by_type = agp_generic_alloc_by_type, 216 .alloc_by_type = agp_generic_alloc_by_type,
215 .free_by_type = agp_generic_free_by_type, 217 .free_by_type = agp_generic_free_by_type,
216 .agp_alloc_page = agp_generic_alloc_page, 218 .agp_alloc_page = agp_generic_alloc_page,
219 .agp_alloc_pages = agp_generic_alloc_pages,
217 .agp_destroy_page = agp_generic_destroy_page, 220 .agp_destroy_page = agp_generic_destroy_page,
221 .agp_destroy_pages = agp_generic_destroy_pages,
218 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 222 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
219}; 223};
220 224
diff --git a/drivers/char/hvc_xen.c b/drivers/char/hvc_xen.c
index 6b70aa66a587..538ceea5e7df 100644
--- a/drivers/char/hvc_xen.c
+++ b/drivers/char/hvc_xen.c
@@ -108,8 +108,8 @@ static int __init xen_init(void)
108{ 108{
109 struct hvc_struct *hp; 109 struct hvc_struct *hp;
110 110
111 if (!is_running_on_xen() || 111 if (!xen_pv_domain() ||
112 is_initial_xendomain() || 112 xen_initial_domain() ||
113 !xen_start_info->console.domU.evtchn) 113 !xen_start_info->console.domU.evtchn)
114 return -ENODEV; 114 return -ENODEV;
115 115
@@ -142,7 +142,7 @@ static void __exit xen_fini(void)
142 142
143static int xen_cons_init(void) 143static int xen_cons_init(void)
144{ 144{
145 if (!is_running_on_xen()) 145 if (!xen_pv_domain())
146 return 0; 146 return 0;
147 147
148 hvc_instantiate(HVC_COOKIE, 0, &hvc_ops); 148 hvc_instantiate(HVC_COOKIE, 0, &hvc_ops);
diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c
index 5220f541df25..8859aeac2d25 100644
--- a/drivers/char/hw_random/n2-drv.c
+++ b/drivers/char/hw_random/n2-drv.c
@@ -736,7 +736,7 @@ static int __devexit n2rng_remove(struct of_device *op)
736 return 0; 736 return 0;
737} 737}
738 738
739static struct of_device_id n2rng_match[] = { 739static const struct of_device_id n2rng_match[] = {
740 { 740 {
741 .name = "random-number-generator", 741 .name = "random-number-generator",
742 .compatible = "SUNW,n2-rng", 742 .compatible = "SUNW,n2-rng",
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index f53d4d00faf0..b47710c17885 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -88,12 +88,12 @@
88#endif 88#endif
89 89
90#ifdef CONFIG_SPARC32 90#ifdef CONFIG_SPARC32
91#include <linux/pci.h> 91#include <linux/of.h>
92#include <linux/jiffies.h> 92#include <linux/of_device.h>
93#include <asm/ebus.h> 93#include <asm/io.h>
94 94
95static unsigned long rtc_port; 95static unsigned long rtc_port;
96static int rtc_irq = PCI_IRQ_NONE; 96static int rtc_irq;
97#endif 97#endif
98 98
99#ifdef CONFIG_HPET_RTC_IRQ 99#ifdef CONFIG_HPET_RTC_IRQ
@@ -973,8 +973,8 @@ static int __init rtc_init(void)
973 char *guess = NULL; 973 char *guess = NULL;
974#endif 974#endif
975#ifdef CONFIG_SPARC32 975#ifdef CONFIG_SPARC32
976 struct linux_ebus *ebus; 976 struct device_node *ebus_dp;
977 struct linux_ebus_device *edev; 977 struct of_device *op;
978#else 978#else
979 void *r; 979 void *r;
980#ifdef RTC_IRQ 980#ifdef RTC_IRQ
@@ -983,12 +983,16 @@ static int __init rtc_init(void)
983#endif 983#endif
984 984
985#ifdef CONFIG_SPARC32 985#ifdef CONFIG_SPARC32
986 for_each_ebus(ebus) { 986 for_each_node_by_name(ebus_dp, "ebus") {
987 for_each_ebusdev(edev, ebus) { 987 struct device_node *dp;
988 if (strcmp(edev->prom_node->name, "rtc") == 0) { 988 for (dp = ebus_dp; dp; dp = dp->sibling) {
989 rtc_port = edev->resource[0].start; 989 if (!strcmp(dp->name, "rtc")) {
990 rtc_irq = edev->irqs[0]; 990 op = of_find_device_by_node(dp);
991 goto found; 991 if (op) {
992 rtc_port = op->resource[0].start;
993 rtc_irq = op->irqs[0];
994 goto found;
995 }
992 } 996 }
993 } 997 }
994 } 998 }
@@ -997,7 +1001,7 @@ static int __init rtc_init(void)
997 return -EIO; 1001 return -EIO;
998 1002
999found: 1003found:
1000 if (rtc_irq == PCI_IRQ_NONE) { 1004 if (!rtc_irq) {
1001 rtc_has_irq = 0; 1005 rtc_has_irq = 0;
1002 goto no_irq; 1006 goto no_irq;
1003 } 1007 }