NFC: port100: Don't send a new command if one is still pending
authorThierry Escande <thierry.escande@collabora.com>
Thu, 16 Jun 2016 18:25:20 +0000 (20:25 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 6 Jul 2016 08:02:07 +0000 (10:02 +0200)
This patch ensures that a command is not still in process before sending
a new one to the device. This can happen when neard is in constant
polling mode: the configure_hw command can be sent when neard restarts
polling after a LLCP SYMM timeout but before the device has returned in
timeout from the last DEP frame sent.

Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/nfc/port100.c

index 2d4bbe3fad57d38432a1df4c76bd56d07bd632cf..14a3cc2d0fd6cb2e27382abc4fd780b72052fb21 100644 (file)
@@ -809,6 +809,12 @@ static int port100_send_cmd_async(struct port100 *dev, u8 cmd_code,
                        PORT100_FRAME_MAX_PAYLOAD_LEN +
                        PORT100_FRAME_TAIL_LEN;
 
+       if (dev->cmd) {
+               nfc_err(&dev->interface->dev,
+                       "A command is still in process\n");
+               return -EBUSY;
+       }
+
        resp = alloc_skb(resp_len, GFP_KERNEL);
        if (!resp)
                return -ENOMEM;
This page took 0.026135 seconds and 5 git commands to generate.