Skip to content

Commit 1686782

Browse files
akpm@osdl.orgDave Jones
authored andcommitted
[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>
1 parent 5dda498 commit 1686782

2 files changed

Lines changed: 16 additions & 15 deletions

File tree

‎drivers/char/agp/frontend.c‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
592592
struct agp_file_private *priv = file->private_data;
593593
struct agp_kern_info kerninfo;
594594

595-
down(&(agp_fe.agp_mutex));
595+
mutex_lock(&(agp_fe.agp_mutex));
596596

597597
if (agp_fe.backend_acquired != TRUE)
598598
goto out_eperm;
@@ -627,7 +627,7 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
627627
size, vma->vm_page_prot)) {
628628
goto out_again;
629629
}
630-
up(&(agp_fe.agp_mutex));
630+
mutex_unlock(&(agp_fe.agp_mutex));
631631
return 0;
632632
}
633633

@@ -643,28 +643,28 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
643643
size, vma->vm_page_prot)) {
644644
goto out_again;
645645
}
646-
up(&(agp_fe.agp_mutex));
646+
mutex_unlock(&(agp_fe.agp_mutex));
647647
return 0;
648648
}
649649

650650
out_eperm:
651-
up(&(agp_fe.agp_mutex));
651+
mutex_unlock(&(agp_fe.agp_mutex));
652652
return -EPERM;
653653

654654
out_inval:
655-
up(&(agp_fe.agp_mutex));
655+
mutex_unlock(&(agp_fe.agp_mutex));
656656
return -EINVAL;
657657

658658
out_again:
659-
up(&(agp_fe.agp_mutex));
659+
mutex_unlock(&(agp_fe.agp_mutex));
660660
return -EAGAIN;
661661
}
662662

663663
static int agp_release(struct inode *inode, struct file *file)
664664
{
665665
struct agp_file_private *priv = file->private_data;
666666

667-
down(&(agp_fe.agp_mutex));
667+
mutex_lock(&(agp_fe.agp_mutex));
668668

669669
DBG("priv=%p", priv);
670670

@@ -687,7 +687,7 @@ static int agp_release(struct inode *inode, struct file *file)
687687
agp_remove_file_private(priv);
688688
kfree(priv);
689689
file->private_data = NULL;
690-
up(&(agp_fe.agp_mutex));
690+
mutex_unlock(&(agp_fe.agp_mutex));
691691
return 0;
692692
}
693693

@@ -698,7 +698,7 @@ static int agp_open(struct inode *inode, struct file *file)
698698
struct agp_client *client;
699699
int rc = -ENXIO;
700700

701-
down(&(agp_fe.agp_mutex));
701+
mutex_lock(&(agp_fe.agp_mutex));
702702

703703
if (minor != AGPGART_MINOR)
704704
goto err_out;
@@ -723,13 +723,13 @@ static int agp_open(struct inode *inode, struct file *file)
723723
file->private_data = (void *) priv;
724724
agp_insert_file_private(priv);
725725
DBG("private=%p, client=%p", priv, client);
726-
up(&(agp_fe.agp_mutex));
726+
mutex_unlock(&(agp_fe.agp_mutex));
727727
return 0;
728728

729729
err_out_nomem:
730730
rc = -ENOMEM;
731731
err_out:
732-
up(&(agp_fe.agp_mutex));
732+
mutex_unlock(&(agp_fe.agp_mutex));
733733
return rc;
734734
}
735735

@@ -985,7 +985,7 @@ static int agp_ioctl(struct inode *inode, struct file *file,
985985
int ret_val = -ENOTTY;
986986

987987
DBG("priv=%p, cmd=%x", curr_priv, cmd);
988-
down(&(agp_fe.agp_mutex));
988+
mutex_lock(&(agp_fe.agp_mutex));
989989

990990
if ((agp_fe.current_controller == NULL) &&
991991
(cmd != AGPIOC_ACQUIRE)) {
@@ -1055,7 +1055,7 @@ static int agp_ioctl(struct inode *inode, struct file *file,
10551055

10561056
ioctl_out:
10571057
DBG("ioctl returns %d\n", ret_val);
1058-
up(&(agp_fe.agp_mutex));
1058+
mutex_unlock(&(agp_fe.agp_mutex));
10591059
return ret_val;
10601060
}
10611061

@@ -1081,7 +1081,7 @@ static struct miscdevice agp_miscdev =
10811081
int agp_frontend_initialize(void)
10821082
{
10831083
memset(&agp_fe, 0, sizeof(struct agp_front_data));
1084-
sema_init(&(agp_fe.agp_mutex), 1);
1084+
mutex_init(&(agp_fe.agp_mutex));
10851085

10861086
if (misc_register(&agp_miscdev)) {
10871087
printk(KERN_ERR PFX "unable to get minor: %d\n", AGPGART_MINOR);

‎include/linux/agpgart.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ typedef struct _agp_unbind {
111111
} agp_unbind;
112112

113113
#else /* __KERNEL__ */
114+
#include <linux/mutex.h>
114115

115116
#define AGPGART_MINOR 175
116117

@@ -201,7 +202,7 @@ struct agp_file_private {
201202
};
202203

203204
struct agp_front_data {
204-
struct semaphore agp_mutex;
205+
struct mutex agp_mutex;
205206
struct agp_controller *current_controller;
206207
struct agp_controller *controllers;
207208
struct agp_file_private *file_priv_list;

0 commit comments

Comments
 (0)