#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
+#include <linux/mutex.h>
#include <asm/arch/irqs.h>
#include <asm/arch/gpio.h>
#include <asm/arch/hardware.h>
static void omap_kp_timer(unsigned long);
static unsigned char keypad_state[8];
-static DECLARE_MUTEX(kp_enable_mutex);
+static DEFINE_MUTEX(kp_enable_mutex);
static int kp_enable = 1;
static int kp_cur_group = -1;
struct omap_kp {
struct input_dev *input;
struct timer_list timer;
- unsigned int irq;
+ int irq;
unsigned int rows;
unsigned int cols;
};
int row;
u8 value = 0;
- for (row = 0; row < omap_kp->cols; row++) {
+ for (row = 0; row < omap_kp->rows; row++) {
if (omap_get_gpio_datain(row_gpios[row]))
value |= (1 << row);
}
if ((state != 1) && (state != 0))
return -EINVAL;
- down(&kp_enable_mutex);
+ mutex_lock(&kp_enable_mutex);
if (state != kp_enable) {
if (state)
enable_irq(INT_KEYBOARD);
disable_irq(INT_KEYBOARD);
kp_enable = state;
}
- up(&kp_enable_mutex);
+ mutex_unlock(&kp_enable_mutex);
return strnlen(buf, count);
}
kp_tasklet.data = (unsigned long) omap_kp;
omap_kp->irq = platform_get_irq(pdev, 0);
- if (omap_kp->irq) {
+ if (omap_kp->irq >= 0) {
if (request_irq(omap_kp->irq, omap_kp_interrupt, 0,
"omap-keypad", omap_kp) < 0)
return -EINVAL;