diff options
-rw-r--r-- | drivers/char/agp/agp.h | 2 | ||||
-rw-r--r-- | drivers/char/agp/backend.c | 2 | ||||
-rw-r--r-- | drivers/char/agp/efficeon-agp.c | 16 | ||||
-rw-r--r-- | drivers/char/agp/frontend.c | 27 | ||||
-rw-r--r-- | drivers/char/agp/intel-agp.c | 4 | ||||
-rw-r--r-- | drivers/char/agp/via-agp.c | 4 | ||||
-rw-r--r-- | include/linux/mm.h | 1 | ||||
-rw-r--r-- | mm/mmap.c | 7 |
8 files changed, 27 insertions, 36 deletions
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h index 3c623b67ea1c..8b3317fd46c9 100644 --- a/drivers/char/agp/agp.h +++ b/drivers/char/agp/agp.h | |||
@@ -117,7 +117,7 @@ struct agp_bridge_driver { | |||
117 | }; | 117 | }; |
118 | 118 | ||
119 | struct agp_bridge_data { | 119 | struct agp_bridge_data { |
120 | struct agp_version *version; | 120 | const struct agp_version *version; |
121 | struct agp_bridge_driver *driver; | 121 | struct agp_bridge_driver *driver; |
122 | struct vm_operations_struct *vm_ops; | 122 | struct vm_operations_struct *vm_ops; |
123 | void *previous_size; | 123 | void *previous_size; |
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c index 509adc403250..d59e037ddd12 100644 --- a/drivers/char/agp/backend.c +++ b/drivers/char/agp/backend.c | |||
@@ -44,7 +44,7 @@ | |||
44 | * past 0.99 at all due to some boolean logic error. */ | 44 | * past 0.99 at all due to some boolean logic error. */ |
45 | #define AGPGART_VERSION_MAJOR 0 | 45 | #define AGPGART_VERSION_MAJOR 0 |
46 | #define AGPGART_VERSION_MINOR 101 | 46 | #define AGPGART_VERSION_MINOR 101 |
47 | static struct agp_version agp_current_version = | 47 | static const struct agp_version agp_current_version = |
48 | { | 48 | { |
49 | .major = AGPGART_VERSION_MAJOR, | 49 | .major = AGPGART_VERSION_MAJOR, |
50 | .minor = AGPGART_VERSION_MINOR, | 50 | .minor = AGPGART_VERSION_MINOR, |
diff --git a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c index b788b0a3bbf3..30f730ff81c1 100644 --- a/drivers/char/agp/efficeon-agp.c +++ b/drivers/char/agp/efficeon-agp.c | |||
@@ -337,13 +337,6 @@ static struct agp_bridge_driver efficeon_driver = { | |||
337 | .agp_destroy_page = agp_generic_destroy_page, | 337 | .agp_destroy_page = agp_generic_destroy_page, |
338 | }; | 338 | }; |
339 | 339 | ||
340 | |||
341 | static int agp_efficeon_resume(struct pci_dev *pdev) | ||
342 | { | ||
343 | printk(KERN_DEBUG PFX "agp_efficeon_resume()\n"); | ||
344 | return efficeon_configure(); | ||
345 | } | ||
346 | |||
347 | static int __devinit agp_efficeon_probe(struct pci_dev *pdev, | 340 | static int __devinit agp_efficeon_probe(struct pci_dev *pdev, |
348 | const struct pci_device_id *ent) | 341 | const struct pci_device_id *ent) |
349 | { | 342 | { |
@@ -414,11 +407,18 @@ static void __devexit agp_efficeon_remove(struct pci_dev *pdev) | |||
414 | agp_put_bridge(bridge); | 407 | agp_put_bridge(bridge); |
415 | } | 408 | } |
416 | 409 | ||
410 | #ifdef CONFIG_PM | ||
417 | static int agp_efficeon_suspend(struct pci_dev *dev, pm_message_t state) | 411 | static int agp_efficeon_suspend(struct pci_dev *dev, pm_message_t state) |
418 | { | 412 | { |
419 | return 0; | 413 | return 0; |
420 | } | 414 | } |
421 | 415 | ||
416 | static int agp_efficeon_resume(struct pci_dev *pdev) | ||
417 | { | ||
418 | printk(KERN_DEBUG PFX "agp_efficeon_resume()\n"); | ||
419 | return efficeon_configure(); | ||
420 | } | ||
421 | #endif | ||
422 | 422 | ||
423 | static struct pci_device_id agp_efficeon_pci_table[] = { | 423 | static struct pci_device_id agp_efficeon_pci_table[] = { |
424 | { | 424 | { |
@@ -439,8 +439,10 @@ static struct pci_driver agp_efficeon_pci_driver = { | |||
439 | .id_table = agp_efficeon_pci_table, | 439 | .id_table = agp_efficeon_pci_table, |
440 | .probe = agp_efficeon_probe, | 440 | .probe = agp_efficeon_probe, |
441 | .remove = agp_efficeon_remove, | 441 | .remove = agp_efficeon_remove, |
442 | #ifdef CONFIG_PM | ||
442 | .suspend = agp_efficeon_suspend, | 443 | .suspend = agp_efficeon_suspend, |
443 | .resume = agp_efficeon_resume, | 444 | .resume = agp_efficeon_resume, |
445 | #endif | ||
444 | }; | 446 | }; |
445 | 447 | ||
446 | static int __init agp_efficeon_init(void) | 448 | static int __init agp_efficeon_init(void) |
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c index d9c5a9142ad1..0f2ed2aa2d81 100644 --- a/drivers/char/agp/frontend.c +++ b/drivers/char/agp/frontend.c | |||
@@ -151,35 +151,12 @@ static void agp_add_seg_to_client(struct agp_client *client, | |||
151 | client->segments = seg; | 151 | client->segments = seg; |
152 | } | 152 | } |
153 | 153 | ||
154 | /* Originally taken from linux/mm/mmap.c from the array | ||
155 | * protection_map. | ||
156 | * The original really should be exported to modules, or | ||
157 | * some routine which does the conversion for you | ||
158 | */ | ||
159 | |||
160 | static const pgprot_t my_protect_map[16] = | ||
161 | { | ||
162 | __P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111, | ||
163 | __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111 | ||
164 | }; | ||
165 | |||
166 | static pgprot_t agp_convert_mmap_flags(int prot) | 154 | static pgprot_t agp_convert_mmap_flags(int prot) |
167 | { | 155 | { |
168 | #define _trans(x,bit1,bit2) \ | ||
169 | ((bit1==bit2)?(x&bit1):(x&bit1)?bit2:0) | ||
170 | |||
171 | unsigned long prot_bits; | 156 | unsigned long prot_bits; |
172 | pgprot_t temp; | ||
173 | |||
174 | prot_bits = _trans(prot, PROT_READ, VM_READ) | | ||
175 | _trans(prot, PROT_WRITE, VM_WRITE) | | ||
176 | _trans(prot, PROT_EXEC, VM_EXEC); | ||
177 | |||
178 | prot_bits |= VM_SHARED; | ||
179 | 157 | ||
180 | temp = my_protect_map[prot_bits & 0x0000000f]; | 158 | prot_bits = calc_vm_prot_bits(prot) | VM_SHARED; |
181 | 159 | return vm_get_page_prot(prot_bits); | |
182 | return temp; | ||
183 | } | 160 | } |
184 | 161 | ||
185 | static int agp_create_segment(struct agp_client *client, struct agp_region *region) | 162 | static int agp_create_segment(struct agp_client *client, struct agp_region *region) |
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index 61ac3809f997..42a1cb871992 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -1766,6 +1766,7 @@ static void __devexit agp_intel_remove(struct pci_dev *pdev) | |||
1766 | agp_put_bridge(bridge); | 1766 | agp_put_bridge(bridge); |
1767 | } | 1767 | } |
1768 | 1768 | ||
1769 | #ifdef CONFIG_PM | ||
1769 | static int agp_intel_resume(struct pci_dev *pdev) | 1770 | static int agp_intel_resume(struct pci_dev *pdev) |
1770 | { | 1771 | { |
1771 | struct agp_bridge_data *bridge = pci_get_drvdata(pdev); | 1772 | struct agp_bridge_data *bridge = pci_get_drvdata(pdev); |
@@ -1789,6 +1790,7 @@ static int agp_intel_resume(struct pci_dev *pdev) | |||
1789 | 1790 | ||
1790 | return 0; | 1791 | return 0; |
1791 | } | 1792 | } |
1793 | #endif | ||
1792 | 1794 | ||
1793 | static struct pci_device_id agp_intel_pci_table[] = { | 1795 | static struct pci_device_id agp_intel_pci_table[] = { |
1794 | #define ID(x) \ | 1796 | #define ID(x) \ |
@@ -1835,7 +1837,9 @@ static struct pci_driver agp_intel_pci_driver = { | |||
1835 | .id_table = agp_intel_pci_table, | 1837 | .id_table = agp_intel_pci_table, |
1836 | .probe = agp_intel_probe, | 1838 | .probe = agp_intel_probe, |
1837 | .remove = __devexit_p(agp_intel_remove), | 1839 | .remove = __devexit_p(agp_intel_remove), |
1840 | #ifdef CONFIG_PM | ||
1838 | .resume = agp_intel_resume, | 1841 | .resume = agp_intel_resume, |
1842 | #endif | ||
1839 | }; | 1843 | }; |
1840 | 1844 | ||
1841 | static int __init agp_intel_init(void) | 1845 | static int __init agp_intel_init(void) |
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c index b8ec25d17478..c149ac9ce9a7 100644 --- a/drivers/char/agp/via-agp.c +++ b/drivers/char/agp/via-agp.c | |||
@@ -9,7 +9,7 @@ | |||
9 | #include <linux/agp_backend.h> | 9 | #include <linux/agp_backend.h> |
10 | #include "agp.h" | 10 | #include "agp.h" |
11 | 11 | ||
12 | static struct pci_device_id agp_via_pci_table[]; | 12 | static const struct pci_device_id agp_via_pci_table[]; |
13 | 13 | ||
14 | #define VIA_GARTCTRL 0x80 | 14 | #define VIA_GARTCTRL 0x80 |
15 | #define VIA_APSIZE 0x84 | 15 | #define VIA_APSIZE 0x84 |
@@ -485,7 +485,7 @@ static int agp_via_resume(struct pci_dev *pdev) | |||
485 | #endif /* CONFIG_PM */ | 485 | #endif /* CONFIG_PM */ |
486 | 486 | ||
487 | /* must be the same order as name table above */ | 487 | /* must be the same order as name table above */ |
488 | static struct pci_device_id agp_via_pci_table[] = { | 488 | static const struct pci_device_id agp_via_pci_table[] = { |
489 | #define ID(x) \ | 489 | #define ID(x) \ |
490 | { \ | 490 | { \ |
491 | .class = (PCI_CLASS_BRIDGE_HOST << 8), \ | 491 | .class = (PCI_CLASS_BRIDGE_HOST << 8), \ |
diff --git a/include/linux/mm.h b/include/linux/mm.h index f0b135cd86da..224178a000d2 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1013,6 +1013,7 @@ static inline unsigned long vma_pages(struct vm_area_struct *vma) | |||
1013 | return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; | 1013 | return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | pgprot_t vm_get_page_prot(unsigned long vm_flags); | ||
1016 | struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); | 1017 | struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); |
1017 | struct page *vmalloc_to_page(void *addr); | 1018 | struct page *vmalloc_to_page(void *addr); |
1018 | unsigned long vmalloc_to_pfn(void *addr); | 1019 | unsigned long vmalloc_to_pfn(void *addr); |
@@ -60,6 +60,13 @@ pgprot_t protection_map[16] = { | |||
60 | __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111 | 60 | __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111 |
61 | }; | 61 | }; |
62 | 62 | ||
63 | pgprot_t vm_get_page_prot(unsigned long vm_flags) | ||
64 | { | ||
65 | return protection_map[vm_flags & | ||
66 | (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]; | ||
67 | } | ||
68 | EXPORT_SYMBOL(vm_get_page_prot); | ||
69 | |||
63 | int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ | 70 | int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ |
64 | int sysctl_overcommit_ratio = 50; /* default is 50% */ | 71 | int sysctl_overcommit_ratio = 50; /* default is 50% */ |
65 | int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; | 72 | int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; |