1. 19 Jul, 2016 2 commits
    • Thierry Escande's avatar
      NFC: nfcsim: Simulate lost frames through debugfs entry · 2a0fe4fe
      Thierry Escande authored
      This patch allows to simulate the lost of frames exchanged between the 2
      nfcsim devices through a control entry in the debugfs and is used as
      follow:
      
       echo n > /sys/kernel/debug/nfcsim/nfcX/dropframe
      
      Where n specifies the number of frames to be dropped between 0 and 255
      and nfcX is either nfc0 or nfc1, one of the two nfcsim devices.
      
      In the following example, the next frame that should be sent by the nfc0
      device will be dropped and thus not received by the nfc1 device:
      
       echo 1 > /sys/kernel/debug/nfcsim/nfc0/dropframe
      
      The value of 0 can be used to reset the dropframe counter.
      Signed-off-by: 's avatarThierry Escande <thierry.escande@collabora.com>
      Signed-off-by: 's avatarSamuel Ortiz <sameo@linux.intel.com>
      2a0fe4fe
    • Thierry Escande's avatar
      NFC: nfcsim: Add support for sysfs control entry · f9ac6273
      Thierry Escande authored
      The idea is to have a way to control and/or modify the behavior of the
      nfcsim virtual devices.
      
      This patch creates a folder tree in the debug filesystem. The debugfs is
      usually mounted into /sys/kernel/debug and the nfcsim entries are
      located in DEBUGFS/nfcsim/nfcX/ where X is either 0 or 1 depending on
      the device you want to address.
      
      These folders are empty for now and control entries will be added by
      upcoming commits.
      Signed-off-by: 's avatarThierry Escande <thierry.escande@collabora.com>
      Signed-off-by: 's avatarSamuel Ortiz <sameo@linux.intel.com>
      f9ac6273
  2. 17 Jul, 2016 1 commit
  3. 06 Jul, 2016 5 commits
  4. 04 Jul, 2016 6 commits
  5. 09 May, 2016 5 commits
  6. 03 May, 2016 17 commits
  7. 01 May, 2016 1 commit
  8. 09 Apr, 2016 3 commits
    • Michael Thalmeier's avatar
      NFC: pn533: add I2C phy driver · dd7bedcd
      Michael Thalmeier authored
      This adds the I2C phy interface for the pn533 driver.
      This way the driver can be used to interact with I2C
      connected pn532 devices.
      Signed-off-by: 's avatarMichael Thalmeier <michael.thalmeier@hale.at>
      Signed-off-by: 's avatarSamuel Ortiz <sameo@linux.intel.com>
      dd7bedcd
    • Michael Thalmeier's avatar
      NFC: pn533: Separate physical layer from the core implementation · 9815c7cf
      Michael Thalmeier authored
      The driver now has all core stuff isolated in one file, and all
      the hardware link specifics in another. Writing a pn533 driver
      on top of another hardware link is now just a matter of adding a
      new file for that new hardware specifics.
      
      The first user of this separation will be the i2c based pn532
      driver that reuses pn533 core implementation on top of an i2c
      layer.
      Signed-off-by: 's avatarMichael Thalmeier <michael.thalmeier@hale.at>
      Signed-off-by: 's avatarSamuel Ortiz <sameo@linux.intel.com>
      9815c7cf
    • Michael Thalmeier's avatar
      NFC: pn533: Fix socket deadlock · 37f895d7
      Michael Thalmeier authored
      A deadlock can occur when the NFC raw socket is closed while
      the driver is processing a command.
      
      Following is the call graph of the affected situation:
      
      send data via raw_sock:
      -------------
      rawsock_tx_work
        sock_hold => socket refcnt++
        nfc_data_exchange => cb = rawsock_data_exchange_complete
      
          ops->im_transceive = pn533_transceive => arg->cb = db
                                     = rawsock_data_exchange_complete
      
            pn533_send_data_async => cb = pn533_data_exchange_complete
      
              __pn533_send_async => cmd->complete_cb = cb
                                    = pn533_data_exchange_complete
      
                if_ops->send_frame_async
      
      response:
      --------
      pn533_recv_response
        queue_work(priv->wq, &priv->cmd_complete_work)
      
      pn533_wq_cmd_complete
      
        pn533_send_async_complete
      
          cmd->complete_cb() = pn533_data_exchange_complete()
      
            arg->cb() = rawsock_data_exchange_complete()
      
              sock_put => socket refcnt-- => If the corresponding
                          socket gets closed in the meantime socket
                          will be destructed
      
                sk_free
      
                  __sk_free
      
                    sk->sk_destruct = rawsock_destruct
      
                      nfc_deactivate_target
      
                        ops->deactivate_target = pn533_deactivate_target
      
                          pn533_send_cmd_sync
      
                            pn533_send_cmd_async
      
                              __pn533_send_async
      
                                list_add_tail(&cmd->queue,&dev->cmd_queue)
                                        => add to command list because
                                           a command is currently
                                           processed
      
                              wait_for_completion
                                         => the workqueue thread waits
                                            here because it is the one
                                            processing the commands
                                               => deadlock
      
      To fix the deadlock pn533_deactivate_target is changed to
      issue the PN533_CMD_IN_RELEASE command in async mode. This
      way nothing blocks and the release command is executed after
      the current command.
      Signed-off-by: 's avatarMichael Thalmeier <michael.thalmeier@hale.at>
      Signed-off-by: 's avatarSamuel Ortiz <sameo@linux.intel.com>
      37f895d7