X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fchar%2Fagp%2Ffrontend.c;fp=drivers%2Fchar%2Fagp%2Ffrontend.c;h=97eeb2345b18ad897c429196530ce7d49dec3980;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=0f2ed2aa2d815039d7cd6cd3dc26a20a4e15791e;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c index 0f2ed2aa2..97eeb2345 100644 --- a/drivers/char/agp/frontend.c +++ b/drivers/char/agp/frontend.c @@ -151,12 +151,35 @@ static void agp_add_seg_to_client(struct agp_client *client, client->segments = seg; } +/* Originally taken from linux/mm/mmap.c from the array + * protection_map. + * The original really should be exported to modules, or + * some routine which does the conversion for you + */ + +static const pgprot_t my_protect_map[16] = +{ + __P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111, + __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111 +}; + static pgprot_t agp_convert_mmap_flags(int prot) { +#define _trans(x,bit1,bit2) \ +((bit1==bit2)?(x&bit1):(x&bit1)?bit2:0) + unsigned long prot_bits; + pgprot_t temp; + + prot_bits = _trans(prot, PROT_READ, VM_READ) | + _trans(prot, PROT_WRITE, VM_WRITE) | + _trans(prot, PROT_EXEC, VM_EXEC); + + prot_bits |= VM_SHARED; - prot_bits = calc_vm_prot_bits(prot) | VM_SHARED; - return vm_get_page_prot(prot_bits); + temp = my_protect_map[prot_bits & 0x0000000f]; + + return temp; } static int agp_create_segment(struct agp_client *client, struct agp_region *region) @@ -758,7 +781,7 @@ static int agpioc_acquire_wrap(struct agp_file_private *priv) if (agp_fe.current_controller != NULL) return -EBUSY; - if (!agp_bridge) + if(!agp_bridge) return -ENODEV; if (atomic_read(&agp_bridge->agp_in_use)) @@ -1036,7 +1059,7 @@ ioctl_out: return ret_val; } -static const struct file_operations agp_fops = +static struct file_operations agp_fops = { .owner = THIS_MODULE, .llseek = no_llseek,