<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/nfc/pn533.c, branch master</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>NFC: pn533: Separate physical layer from the core implementation</title>
<updated>2016-04-09T21:53:15+00:00</updated>
<author>
<name>Michael Thalmeier</name>
<email>michael.thalmeier@hale.at</email>
</author>
<published>2016-03-25T14:46:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=9815c7cf22daceabfb919ddcd6f2c80e049c1fbc'/>
<id>9815c7cf22daceabfb919ddcd6f2c80e049c1fbc</id>
<content type='text'>
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: Michael Thalmeier &lt;michael.thalmeier@hale.at&gt;
Signed-off-by: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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: Michael Thalmeier &lt;michael.thalmeier@hale.at&gt;
Signed-off-by: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>NFC: pn533: Fix socket deadlock</title>
<updated>2016-04-09T21:53:11+00:00</updated>
<author>
<name>Michael Thalmeier</name>
<email>michael.thalmeier@hale.at</email>
</author>
<published>2016-03-25T14:46:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=37f895d7e85e7d7e23e2395e666ea43001862e5f'/>
<id>37f895d7e85e7d7e23e2395e666ea43001862e5f</id>
<content type='text'>
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 =&gt; socket refcnt++
  nfc_data_exchange =&gt; cb = rawsock_data_exchange_complete

    ops-&gt;im_transceive = pn533_transceive =&gt; arg-&gt;cb = db
                               = rawsock_data_exchange_complete

      pn533_send_data_async =&gt; cb = pn533_data_exchange_complete

        __pn533_send_async =&gt; cmd-&gt;complete_cb = cb
                              = pn533_data_exchange_complete

          if_ops-&gt;send_frame_async

response:
--------
pn533_recv_response
  queue_work(priv-&gt;wq, &amp;priv-&gt;cmd_complete_work)

pn533_wq_cmd_complete

  pn533_send_async_complete

    cmd-&gt;complete_cb() = pn533_data_exchange_complete()

      arg-&gt;cb() = rawsock_data_exchange_complete()

        sock_put =&gt; socket refcnt-- =&gt; If the corresponding
                    socket gets closed in the meantime socket
                    will be destructed

          sk_free

            __sk_free

              sk-&gt;sk_destruct = rawsock_destruct

                nfc_deactivate_target

                  ops-&gt;deactivate_target = pn533_deactivate_target

                    pn533_send_cmd_sync

                      pn533_send_cmd_async

                        __pn533_send_async

                          list_add_tail(&amp;cmd-&gt;queue,&amp;dev-&gt;cmd_queue)
                                  =&gt; add to command list because
                                     a command is currently
                                     processed

                        wait_for_completion
                                   =&gt; the workqueue thread waits
                                      here because it is the one
                                      processing the commands
                                         =&gt; 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: Michael Thalmeier &lt;michael.thalmeier@hale.at&gt;
Signed-off-by: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 =&gt; socket refcnt++
  nfc_data_exchange =&gt; cb = rawsock_data_exchange_complete

    ops-&gt;im_transceive = pn533_transceive =&gt; arg-&gt;cb = db
                               = rawsock_data_exchange_complete

      pn533_send_data_async =&gt; cb = pn533_data_exchange_complete

        __pn533_send_async =&gt; cmd-&gt;complete_cb = cb
                              = pn533_data_exchange_complete

          if_ops-&gt;send_frame_async

response:
--------
pn533_recv_response
  queue_work(priv-&gt;wq, &amp;priv-&gt;cmd_complete_work)

pn533_wq_cmd_complete

  pn533_send_async_complete

    cmd-&gt;complete_cb() = pn533_data_exchange_complete()

      arg-&gt;cb() = rawsock_data_exchange_complete()

        sock_put =&gt; socket refcnt-- =&gt; If the corresponding
                    socket gets closed in the meantime socket
                    will be destructed

          sk_free

            __sk_free

              sk-&gt;sk_destruct = rawsock_destruct

                nfc_deactivate_target

                  ops-&gt;deactivate_target = pn533_deactivate_target

                    pn533_send_cmd_sync

                      pn533_send_cmd_async

                        __pn533_send_async

                          list_add_tail(&amp;cmd-&gt;queue,&amp;dev-&gt;cmd_queue)
                                  =&gt; add to command list because
                                     a command is currently
                                     processed

                        wait_for_completion
                                   =&gt; the workqueue thread waits
                                      here because it is the one
                                      processing the commands
                                         =&gt; 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: Michael Thalmeier &lt;michael.thalmeier@hale.at&gt;
Signed-off-by: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>NFC: pn533: Send ATR_REQ only if NFC_PROTO_NFC_DEP bit is set</title>
<updated>2016-04-09T21:53:05+00:00</updated>
<author>
<name>Michael Thalmeier</name>
<email>michael.thalmeier@hale.at</email>
</author>
<published>2016-03-25T14:46:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=e997ebbe46fe46bd4e8d476adca1f9b76779f270'/>
<id>e997ebbe46fe46bd4e8d476adca1f9b76779f270</id>
<content type='text'>
Currently it is not possible to only poll for passive targets
with the pn533 driver. To change this ATR_REQ is only sent when
NFC_PROTO_NFC_DEP is explicitly requested in poll_protocols.
As most implementations (e.g. neard) poll for all protocols
that are reported to be supported by the adapter, this should
not have much of an effect on current implementations.

Signed-off-by: Michael Thalmeier &lt;michael.thalmeier@hale.at&gt;
Signed-off-by: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently it is not possible to only poll for passive targets
with the pn533 driver. To change this ATR_REQ is only sent when
NFC_PROTO_NFC_DEP is explicitly requested in poll_protocols.
As most implementations (e.g. neard) poll for all protocols
that are reported to be supported by the adapter, this should
not have much of an effect on current implementations.

Signed-off-by: Michael Thalmeier &lt;michael.thalmeier@hale.at&gt;
Signed-off-by: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>NFC: netlink: Add mode parameter to deactivate_target functions</title>
<updated>2015-10-27T02:55:12+00:00</updated>
<author>
<name>Christophe Ricard</name>
<email>christophe.ricard@gmail.com</email>
</author>
<published>2015-10-25T21:54:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=96d4581f0b3712221d6ed4a765bb6b4ea40f2b2f'/>
<id>96d4581f0b3712221d6ed4a765bb6b4ea40f2b2f</id>
<content type='text'>
In order to manage in a better way the nci poll mode state machine,
add mode parameter to deactivate_target functions.
This way we can manage different target state.
mode parameter make sense only in nci core.

Signed-off-by: Christophe Ricard &lt;christophe-h.ricard@st.com&gt;
Signed-off-by: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In order to manage in a better way the nci poll mode state machine,
add mode parameter to deactivate_target functions.
This way we can manage different target state.
mode parameter make sense only in nci core.

Signed-off-by: Christophe Ricard &lt;christophe-h.ricard@st.com&gt;
Signed-off-by: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>NFC: logging neatening</title>
<updated>2015-04-07T10:05:12+00:00</updated>
<author>
<name>Joe Perches</name>
<email>joe@perches.com</email>
</author>
<published>2015-04-07T07:17:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=3590ebc040c9ee5d06754ce926f0e7c3a595e46d'/>
<id>3590ebc040c9ee5d06754ce926f0e7c3a595e46d</id>
<content type='text'>
Add missing terminating newlines to nfc_info and nfc_err
to avoid possible interleaving from other messages.

Miscellanea:

o typo fix of "unknonwn" in message
o remove unnecessary OOM messages as there's a generic dump_stack()
o realign arguments

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Signed-off-by: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add missing terminating newlines to nfc_info and nfc_err
to avoid possible interleaving from other messages.

Miscellanea:

o typo fix of "unknonwn" in message
o remove unnecessary OOM messages as there's a generic dump_stack()
o realign arguments

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Signed-off-by: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>NFC: pn533: fix error return code</title>
<updated>2015-04-05T23:22:17+00:00</updated>
<author>
<name>Julia Lawall</name>
<email>Julia.Lawall@lip6.fr</email>
</author>
<published>2015-04-05T12:06:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=5df848f37b1d20e5dd64bea16ba9f69ed321e11b'/>
<id>5df848f37b1d20e5dd64bea16ba9f69ed321e11b</id>
<content type='text'>
Return a negative error code on failure.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// &lt;smpl&gt;
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret &lt; 0\|ret != 0\))
 { ... return ret; }
|
ret = 0
)
... when != ret = e1
    when != &amp;ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}
// &lt;/smpl&gt;

Signed-off-by: Julia Lawall &lt;Julia.Lawall@lip6.fr&gt;
Signed-off-by: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Return a negative error code on failure.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// &lt;smpl&gt;
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret &lt; 0\|ret != 0\))
 { ... return ret; }
|
ret = 0
)
... when != ret = e1
    when != &amp;ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}
// &lt;/smpl&gt;

Signed-off-by: Julia Lawall &lt;Julia.Lawall@lip6.fr&gt;
Signed-off-by: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>NFC: pn533: Convert to use USB_DEVICE macro</title>
<updated>2014-02-23T22:32:18+00:00</updated>
<author>
<name>Axel Lin</name>
<email>axel.lin@ingics.com</email>
</author>
<published>2014-02-14T09:40:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=99968e0616b802173ef83a94d3bdefa12c33eba8'/>
<id>99968e0616b802173ef83a94d3bdefa12c33eba8</id>
<content type='text'>
Signed-off-by: Axel Lin &lt;axel.lin@ingics.com&gt;
Signed-off-by: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Axel Lin &lt;axel.lin@ingics.com&gt;
Signed-off-by: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>NFC: pn533: Frame is invalid if ccid.datalen is 0</title>
<updated>2014-01-04T02:32:27+00:00</updated>
<author>
<name>Samuel Ortiz</name>
<email>sameo@linux.intel.com</email>
</author>
<published>2014-01-04T02:23:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ea87a5efa9efa84cd48fbf7a969d951b32c9e5e4'/>
<id>ea87a5efa9efa84cd48fbf7a969d951b32c9e5e4</id>
<content type='text'>
Some ACR122 firmwares seem to send 0 length data frames. Before using
that length as a data index, we check that it's not 0. If it is we
report the frame as being invalid.

Reported-by: Arthur Taylor &lt;arthur@advancedtelematic.com&gt;
Signed-off-by: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some ACR122 firmwares seem to send 0 length data frames. Before using
that length as a data index, we check that it's not 0. If it is we
report the frame as being invalid.

Reported-by: Arthur Taylor &lt;arthur@advancedtelematic.com&gt;
Signed-off-by: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nfc: Fix FSF address in file headers</title>
<updated>2013-12-11T15:56:21+00:00</updated>
<author>
<name>Jeff Kirsher</name>
<email>jeffrey.t.kirsher@intel.com</email>
</author>
<published>2013-12-06T16:56:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=98b32decc83ed3137e3ddbc918b102f8fc406b6d'/>
<id>98b32decc83ed3137e3ddbc918b102f8fc406b6d</id>
<content type='text'>
Several files refer to an old address for the Free Software Foundation
in the file header comment.  Resolve by replacing the address with
the URL &lt;http://www.gnu.org/licenses/&gt; so that we do not have to keep
updating the header comments anytime the address changes.

CC: linux-wireless@vger.kernel.org
CC: Lauro Ramos Venancio &lt;lauro.venancio@openbossa.org&gt;
CC: Aloisio Almeida Jr &lt;aloisio.almeida@openbossa.org&gt;
CC: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
Signed-off-by: Jeff Kirsher &lt;jeffrey.t.kirsher@intel.com&gt;
Signed-off-by: John W. Linville &lt;linville@tuxdriver.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Several files refer to an old address for the Free Software Foundation
in the file header comment.  Resolve by replacing the address with
the URL &lt;http://www.gnu.org/licenses/&gt; so that we do not have to keep
updating the header comments anytime the address changes.

CC: linux-wireless@vger.kernel.org
CC: Lauro Ramos Venancio &lt;lauro.venancio@openbossa.org&gt;
CC: Aloisio Almeida Jr &lt;aloisio.almeida@openbossa.org&gt;
CC: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
Signed-off-by: Jeff Kirsher &lt;jeffrey.t.kirsher@intel.com&gt;
Signed-off-by: John W. Linville &lt;linville@tuxdriver.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>NFC: pn533: Target mode Tx fragmentation support</title>
<updated>2013-09-25T14:02:24+00:00</updated>
<author>
<name>Olivier Guiter</name>
<email>olivier.guiter@linux.intel.com</email>
</author>
<published>2013-09-23T10:24:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=93ad42020c2d3fb4a277cc04c014e1ea0d8b0850'/>
<id>93ad42020c2d3fb4a277cc04c014e1ea0d8b0850</id>
<content type='text'>
In target mode, when we want to send frames larger than the max length
(PN533_CMD_DATAEXCH_DATA_MAXLEN), we have to split the frame in smaller
chunks and send them, using a specific working queue, with the TgSetMetaData
command. TgSetMetaData sets his own MI bit in the PFB.
The last chunk is sent using the TgSetData command.

Signed-off-by: Olivier Guiter &lt;olivier.guiter@linux.intel.com&gt;
Signed-off-by: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In target mode, when we want to send frames larger than the max length
(PN533_CMD_DATAEXCH_DATA_MAXLEN), we have to split the frame in smaller
chunks and send them, using a specific working queue, with the TgSetMetaData
command. TgSetMetaData sets his own MI bit in the PFB.
The last chunk is sent using the TgSetData command.

Signed-off-by: Olivier Guiter &lt;olivier.guiter@linux.intel.com&gt;
Signed-off-by: Samuel Ortiz &lt;sameo@linux.intel.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
