aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakpm@osdl.org <akpm@osdl.org>2006-01-13 18:51:02 -0500
committerDave Jones <davej@redhat.com>2006-01-16 23:53:46 -0500
commit168678233ca45af3f74fef60c4265fa5dd217e29 (patch)
tree55c8c3bc9ac8bdc7b1a64c6a855b666b3fdad5e7
parent5dda4986752b531d89d49c218682e42c63ef1d61 (diff)
[AGPGART] Semaphore to Mutex conversion.
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Dave Jones <davej@redhat.com>
-rw-r--r--drivers/char/agp/frontend.c28
-rw-r--r--include/linux/agpgart.h3
2 files changed, 16 insertions, 15 deletions
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c
index 17f520c9d471..97eeb2345b18 100644
--- a/drivers/char/agp/frontend.c
+++ b/drivers/char/agp/frontend.c
@@ -592,7 +592,7 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
592 struct agp_file_private *priv = file->private_data; 592 struct agp_file_private *priv = file->private_data;
593 struct agp_kern_info kerninfo; 593 struct agp_kern_info kerninfo;
594 594
595 down(&(agp_fe.agp_mutex)); 595 mutex_lock(&(agp_fe.agp_mutex));
596 596
597 if (agp_fe.backend_acquired != TRUE) 597 if (agp_fe.backend_acquired != TRUE)
598 goto out_eperm; 598 goto out_eperm;
@@ -627,7 +627,7 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
627 size, vma->vm_page_prot)) { 627 size, vma->vm_page_prot)) {
628 goto out_again; 628 goto out_again;
629 } 629 }
630 up(&(agp_fe.agp_mutex)); 630 mutex_unlock(&(agp_fe.agp_mutex));
631 return 0; 631 return 0;
632 } 632 }
633 633
@@ -643,20 +643,20 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
643 size, vma->vm_page_prot)) { 643 size, vma->vm_page_prot)) {
644 goto out_again; 644 goto out_again;
645 } 645 }
646 up(&(agp_fe.agp_mutex)); 646 mutex_unlock(&(agp_fe.agp_mutex));
647 return 0; 647 return 0;
648 } 648 }
649 649
650out_eperm: 650out_eperm:
651 up(&(agp_fe.agp_mutex)); 651 mutex_unlock(&(agp_fe.agp_mutex));
652 return -EPERM; 652 return -EPERM;
653 653
654out_inval: 654out_inval:
655 up(&(agp_fe.agp_mutex)); 655 mutex_unlock(&(agp_fe.agp_mutex));
656 return -EINVAL; 656 return -EINVAL;
657 657
658out_again: 658out_again:
659 up(&(agp_fe.agp_mutex)); 659 mutex_unlock(&(agp_fe.agp_mutex));
660 return -EAGAIN; 660 return -EAGAIN;
661} 661}
662 662
@@ -664,7 +664,7 @@ static int agp_release(struct inode *inode, struct file *file)
664{ 664{
665 struct agp_file_private *priv = file->private_data; 665 struct agp_file_private *priv = file->private_data;
666 666
667 down(&(agp_fe.agp_mutex)); 667 mutex_lock(&(agp_fe.agp_mutex));
668 668
669 DBG("priv=%p", priv); 669 DBG("priv=%p", priv);
670 670
@@ -687,7 +687,7 @@ static int agp_release(struct inode *inode, struct file *file)
687 agp_remove_file_private(priv); 687 agp_remove_file_private(priv);
688 kfree(priv); 688 kfree(priv);
689 file->private_data = NULL; 689 file->private_data = NULL;
690 up(&(agp_fe.agp_mutex)); 690 mutex_unlock(&(agp_fe.agp_mutex));
691 return 0; 691 return 0;
692} 692}
693 693
@@ -698,7 +698,7 @@ static int agp_open(struct inode *inode, struct file *file)
698 struct agp_client *client; 698 struct agp_client *client;
699 int rc = -ENXIO; 699 int rc = -ENXIO;
700 700
701 down(&(agp_fe.agp_mutex)); 701 mutex_lock(&(agp_fe.agp_mutex));
702 702
703 if (minor != AGPGART_MINOR) 703 if (minor != AGPGART_MINOR)
704 goto err_out; 704 goto err_out;
@@ -723,13 +723,13 @@ static int agp_open(struct inode *inode, struct file *file)
723 file->private_data = (void *) priv; 723 file->private_data = (void *) priv;
724 agp_insert_file_private(priv); 724 agp_insert_file_private(priv);
725 DBG("private=%p, client=%p", priv, client); 725 DBG("private=%p, client=%p", priv, client);
726 up(&(agp_fe.agp_mutex)); 726 mutex_unlock(&(agp_fe.agp_mutex));
727 return 0; 727 return 0;
728 728
729err_out_nomem: 729err_out_nomem:
730 rc = -ENOMEM; 730 rc = -ENOMEM;
731err_out: 731err_out:
732 up(&(agp_fe.agp_mutex)); 732 mutex_unlock(&(agp_fe.agp_mutex));
733 return rc; 733 return rc;
734} 734}
735 735
@@ -985,7 +985,7 @@ static int agp_ioctl(struct inode *inode, struct file *file,
985 int ret_val = -ENOTTY; 985 int ret_val = -ENOTTY;
986 986
987 DBG("priv=%p, cmd=%x", curr_priv, cmd); 987 DBG("priv=%p, cmd=%x", curr_priv, cmd);
988 down(&(agp_fe.agp_mutex)); 988 mutex_lock(&(agp_fe.agp_mutex));
989 989
990 if ((agp_fe.current_controller == NULL) && 990 if ((agp_fe.current_controller == NULL) &&
991 (cmd != AGPIOC_ACQUIRE)) { 991 (cmd != AGPIOC_ACQUIRE)) {
@@ -1055,7 +1055,7 @@ static int agp_ioctl(struct inode *inode, struct file *file,
1055 1055
1056ioctl_out: 1056ioctl_out:
1057 DBG("ioctl returns %d\n", ret_val); 1057 DBG("ioctl returns %d\n", ret_val);
1058 up(&(agp_fe.agp_mutex)); 1058 mutex_unlock(&(agp_fe.agp_mutex));
1059 return ret_val; 1059 return ret_val;
1060} 1060}
1061 1061
@@ -1081,7 +1081,7 @@ static struct miscdevice agp_miscdev =
1081int agp_frontend_initialize(void) 1081int agp_frontend_initialize(void)
1082{ 1082{
1083 memset(&agp_fe, 0, sizeof(struct agp_front_data)); 1083 memset(&agp_fe, 0, sizeof(struct agp_front_data));
1084 sema_init(&(agp_fe.agp_mutex), 1); 1084 mutex_init(&(agp_fe.agp_mutex));
1085 1085
1086 if (misc_register(&agp_miscdev)) { 1086 if (misc_register(&agp_miscdev)) {
1087 printk(KERN_ERR PFX "unable to get minor: %d\n", AGPGART_MINOR); 1087 printk(KERN_ERR PFX "unable to get minor: %d\n", AGPGART_MINOR);
diff --git a/include/linux/agpgart.h b/include/linux/agpgart.h
index 17a17c55a17f..6d59c8efe3be 100644
--- a/include/linux/agpgart.h
+++ b/include/linux/agpgart.h
@@ -111,6 +111,7 @@ typedef struct _agp_unbind {
111} agp_unbind; 111} agp_unbind;
112 112
113#else /* __KERNEL__ */ 113#else /* __KERNEL__ */
114#include <linux/mutex.h>
114 115
115#define AGPGART_MINOR 175 116#define AGPGART_MINOR 175
116 117
@@ -201,7 +202,7 @@ struct agp_file_private {
201}; 202};
202 203
203struct agp_front_data { 204struct agp_front_data {
204 struct semaphore agp_mutex; 205 struct mutex agp_mutex;
205 struct agp_controller *current_controller; 206 struct agp_controller *current_controller;
206 struct agp_controller *controllers; 207 struct agp_controller *controllers;
207 struct agp_file_private *file_priv_list; 208 struct agp_file_private *file_priv_list;