Skip to content

Commit 8a39c52

Browse files
Daniel Walkerralfbaechle
authored andcommitted
[MIPS] Lasat: Convert pvc_sem semaphore to mutex
I also changed the name to pvc_mutex, and moved the define to the file it's used in which allows it to be static. Signed-off-by: Daniel Walker <dwalker@mvista.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent f6ed10a commit 8a39c52

3 files changed

Lines changed: 10 additions & 13 deletions

File tree

‎arch/mips/lasat/picvue.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
struct pvc_defs *picvue;
2424

25-
DECLARE_MUTEX(pvc_sem);
26-
2725
static void pvc_reg_write(u32 val)
2826
{
2927
*picvue->reg = val;

‎arch/mips/lasat/picvue.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* Brian Murphy <brian.murphy@eicon.com>
55
*
66
*/
7-
#include <asm/semaphore.h>
8-
97
struct pvc_defs {
108
volatile u32 *reg;
119
u32 data_shift;
@@ -45,4 +43,3 @@ void pvc_move(u8 cmd);
4543
void pvc_clear(void);
4644
void pvc_home(void);
4745

48-
extern struct semaphore pvc_sem;

‎arch/mips/lasat/picvue_proc.c‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
#include <linux/interrupt.h>
1414

1515
#include <linux/timer.h>
16+
#include <linux/mutex.h>
1617

1718
#include "picvue.h"
1819

20+
static DEFINE_MUTEX(pvc_mutex);
1921
static char pvc_lines[PVC_NLINES][PVC_LINELEN+1];
2022
static int pvc_linedata[PVC_NLINES];
2123
static struct proc_dir_entry *pvc_display_dir;
@@ -48,9 +50,9 @@ static int pvc_proc_read_line(char *page, char **start,
4850
return 0;
4951
}
5052

51-
down(&pvc_sem);
53+
mutex_lock(&pvc_mutex);
5254
page += sprintf(page, "%s\n", pvc_lines[lineno]);
53-
up(&pvc_sem);
55+
mutex_unlock(&pvc_mutex);
5456

5557
return page - origpage;
5658
}
@@ -73,10 +75,10 @@ static int pvc_proc_write_line(struct file *file, const char *buffer,
7375
if (buffer[count-1] == '\n')
7476
count--;
7577

76-
down(&pvc_sem);
78+
mutex_lock(&pvc_mutex);
7779
strncpy(pvc_lines[lineno], buffer, count);
7880
pvc_lines[lineno][count] = '\0';
79-
up(&pvc_sem);
81+
mutex_unlock(&pvc_mutex);
8082

8183
tasklet_schedule(&pvc_display_tasklet);
8284

@@ -89,7 +91,7 @@ static int pvc_proc_write_scroll(struct file *file, const char *buffer,
8991
int origcount = count;
9092
int cmd = simple_strtol(buffer, NULL, 10);
9193

92-
down(&pvc_sem);
94+
mutex_lock(&pvc_mutex);
9395
if (scroll_interval != 0)
9496
del_timer(&timer);
9597

@@ -106,7 +108,7 @@ static int pvc_proc_write_scroll(struct file *file, const char *buffer,
106108
}
107109
add_timer(&timer);
108110
}
109-
up(&pvc_sem);
111+
mutex_unlock(&pvc_mutex);
110112

111113
return origcount;
112114
}
@@ -117,9 +119,9 @@ static int pvc_proc_read_scroll(char *page, char **start,
117119
{
118120
char *origpage = page;
119121

120-
down(&pvc_sem);
122+
mutex_lock(&pvc_mutex);
121123
page += sprintf(page, "%d\n", scroll_dir * scroll_interval);
122-
up(&pvc_sem);
124+
mutex_unlock(&pvc_mutex);
123125

124126
return page - origpage;
125127
}

0 commit comments

Comments
 (0)