summaryrefslogtreecommitdiff
path: root/drivers/staging/nvec
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/nvec')
-rw-r--r--drivers/staging/nvec/TODO1
-rw-r--r--drivers/staging/nvec/nvec.c11
-rw-r--r--drivers/staging/nvec/nvec_kbd.c9
-rw-r--r--drivers/staging/nvec/nvec_ps2.c31
4 files changed, 34 insertions, 18 deletions
diff --git a/drivers/staging/nvec/TODO b/drivers/staging/nvec/TODO
index 8afde3ccc960..33f9ebe6d59b 100644
--- a/drivers/staging/nvec/TODO
+++ b/drivers/staging/nvec/TODO
@@ -1,5 +1,4 @@
ToDo list (incomplete, unordered)
- move the driver to the new i2c slave framework
- finish suspend/resume support
- - fix udelay in the isr
- add atomic ops in order to fix shutoff/reboot problems
diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 282a664c9176..e5ca78e57384 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -300,7 +300,9 @@ int nvec_write_sync(struct nvec_chip *nvec,
{
mutex_lock(&nvec->sync_write_mutex);
- *msg = NULL;
+ if (msg != NULL)
+ *msg = NULL;
+
nvec->sync_write_pending = (data[1] << 8) + data[0];
if (nvec_write_async(nvec, data, size) < 0) {
@@ -320,7 +322,10 @@ int nvec_write_sync(struct nvec_chip *nvec,
dev_dbg(nvec->dev, "nvec_sync_write: pong!\n");
- *msg = nvec->last_sync_msg;
+ if (msg != NULL)
+ *msg = nvec->last_sync_msg;
+ else
+ nvec_msg_free(nvec, nvec->last_sync_msg);
mutex_unlock(&nvec->sync_write_mutex);
@@ -712,7 +717,7 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
* TODO: replace the udelay with a read back after each writel above
* in order to work around a hardware issue, see i2c-tegra.c
*
- * Unfortunately, this change causes an intialisation issue with the
+ * Unfortunately, this change causes an initialisation issue with the
* touchpad, which needs to be fixed first.
*/
udelay(100);
diff --git a/drivers/staging/nvec/nvec_kbd.c b/drivers/staging/nvec/nvec_kbd.c
index f9a1da952c0a..d0259c80f810 100644
--- a/drivers/staging/nvec/nvec_kbd.c
+++ b/drivers/staging/nvec/nvec_kbd.c
@@ -148,15 +148,16 @@ static int nvec_kbd_probe(struct platform_device *pdev)
nvec_register_notifier(nvec, &keys_dev.notifier, 0);
/* Enable keyboard */
- nvec_write_async(nvec, enable_kbd, 2);
+ nvec_write_sync(nvec, enable_kbd, 2, NULL);
/* configures wake on special keys */
- nvec_write_async(nvec, cnfg_wake, 4);
+ nvec_write_sync(nvec, cnfg_wake, 4, NULL);
+
/* enable wake key reporting */
- nvec_write_async(nvec, cnfg_wake_key_reporting, 3);
+ nvec_write_sync(nvec, cnfg_wake_key_reporting, 3, NULL);
/* Disable caps lock LED */
- nvec_write_async(nvec, clear_leds, sizeof(clear_leds));
+ nvec_write_sync(nvec, clear_leds, sizeof(clear_leds), NULL);
return 0;
}
diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c
index cb6d71b8dc83..f34016c4a26b 100644
--- a/drivers/staging/nvec/nvec_ps2.c
+++ b/drivers/staging/nvec/nvec_ps2.c
@@ -60,16 +60,6 @@ static void ps2_stopstreaming(struct serio *ser_dev)
nvec_write_async(ps2_dev.nvec, buf, sizeof(buf));
}
-static int ps2_sendcommand(struct serio *ser_dev, unsigned char cmd)
-{
- unsigned char buf[] = { NVEC_PS2, SEND_COMMAND, ENABLE_MOUSE, 1 };
-
- buf[2] = cmd & 0xff;
-
- dev_dbg(&ser_dev->dev, "Sending ps2 cmd %02x\n", cmd);
- return nvec_write_async(ps2_dev.nvec, buf, sizeof(buf));
-}
-
static int nvec_ps2_notifier(struct notifier_block *nb,
unsigned long event_type, void *data)
{
@@ -98,6 +88,27 @@ static int nvec_ps2_notifier(struct notifier_block *nb,
return NOTIFY_DONE;
}
+static int ps2_sendcommand(struct serio *ser_dev, unsigned char cmd)
+{
+ unsigned char buf[] = { NVEC_PS2, SEND_COMMAND, ENABLE_MOUSE, 1 };
+ struct nvec_msg *msg;
+ int ret;
+
+ buf[2] = cmd & 0xff;
+
+ dev_dbg(&ser_dev->dev, "Sending ps2 cmd %02x\n", cmd);
+
+ ret = nvec_write_sync(ps2_dev.nvec, buf, sizeof(buf), &msg);
+ if (ret < 0)
+ return ret;
+
+ nvec_ps2_notifier(NULL, NVEC_PS2, msg->data);
+
+ nvec_msg_free(ps2_dev.nvec, msg);
+
+ return 0;
+}
+
static int nvec_mouse_probe(struct platform_device *pdev)
{
struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);