1
0
Fork 0
Commit Graph

12 Commits (d58ff35122847a83ba55394e2ae3a1527b6febf5)

Author SHA1 Message Date
Johannes Berg d58ff35122 networking: make skb_push & __skb_push return void pointers
It seems like a historic accident that these return unsigned char *,
and in many places that means casts are required, more often than not.

Make these functions return void * and remove all the casts across
the tree, adding a (u8 *) cast only where the unsigned char pointer
was used directly, all done with the following spatch:

    @@
    expression SKB, LEN;
    typedef u8;
    identifier fn = { skb_push, __skb_push, skb_push_rcsum };
    @@
    - *(fn(SKB, LEN))
    + *(u8 *)fn(SKB, LEN)

    @@
    expression E, SKB, LEN;
    identifier fn = { skb_push, __skb_push, skb_push_rcsum };
    type T;
    @@
    - E = ((T *)(fn(SKB, LEN)))
    + E = fn(SKB, LEN)

    @@
    expression SKB, LEN;
    identifier fn = { skb_push, __skb_push, skb_push_rcsum };
    @@
    - fn(SKB, LEN)[0]
    + *(u8 *)fn(SKB, LEN)

Note that the last part there converts from push(...)[0] to the
more idiomatic *(u8 *)push(...).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-16 11:48:40 -04:00
Christophe JAILLET 8f79ded959 NFC: st21nfca: Fix potential memory leak
If all bits of 'dev_mask' are already set, there is a memory leak because
'info' should be freed before returning.

While fixing it, 'return -ENOMEM' directly if the first kzalloc fails.
This makes the code more readable.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-04-02 00:18:35 +02:00
Christophe Ricard 7cb6ab590d nfc: st21nfca: A APDU_READER_GATE pipe is unexpected on a UICC
An APDU_READER_GATE pipe is not expected on a UICC. Be more
explicit so that an other secure element form factor (SD card)
does not prompt this message.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-05-04 01:33:52 +02:00
Christophe Ricard d35cb20b41 nfc: st21nfca: Simplify white list building
Simplify white list Building

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-05-04 01:31:56 +02:00
Christophe Ricard 15d17170b4 NFC: st21nfca: Add support for proprietary commands
Add support for proprietary commands useful mainly
for factory testings.

Here is a list:

- FACTORY_MODE: Allow to set the driver into a mode where no
  secure element are activated. It does not consider any
  NFC_ATTR_VENDOR_DATA.
- HCI_CLEAR_ALL_PIPES: Allow to execute a HCI clear all pipes
  command. It does not consider any NFC_ATTR_VENDOR_DATA.
- HCI_DM_PUT_DATA: Allow to configure specific CLF registry as
  for example RF trimmings or low level drivers configurations
  (I2C, SPI, SWP).
- HCI_DM_UPDATE_AID: Allow to configure an AID routing into the
  CLF routing table following RF technology, CLF mode or protocol.
- HCI_DM_GET_INFO: Allow to retrieve CLF information.
- HCI_DM_GET_DATA: Allow to retrieve CLF configurable data such as
  low level drivers configurations or RF trimmings.
- HCI_DM_LOAD: Allow to load a firmware into the CLF. A complete
  packet can be more than 8KB.
- HCI_DM_RESET: Allow to run a CLF reset in order to "commit" CLF
  configuration changes without CLF power off.
- HCI_GET_PARAM: Allow to retrieve an HCI CLF parameter (for example
  the white list).
- HCI_DM_FIELD_GENERATOR: Allow to generate different kind of RF
  technology. When using this command to anti-collision is done.
- HCI_LOOPBACK: Allow to echo a command and test the Dh to CLF
  connectivity.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2015-10-27 04:00:24 +01:00
Christophe Ricard a9e062d059 NFC: st21nfca: Add error messages for unexpected HCI events
Potentially an unexpected HCI event may occur because of a
firmware bug. It could be transparent for the user but we should
at least log it.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2015-10-27 03:55:13 +01:00
Christophe Ricard 57dc828a77 NFC: st21nfca: Add few code style fixes
Add a minor code style fixes

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2015-10-27 03:55:13 +01:00
Christophe Ricard ba723199d1 NFC: st21nfca: Fix st21nfca_gates offset
It is useless to start from index 0 when looking for a gate
because only dynamic pipes are retrieved with
ST21NFCA_DM_GETINFO(ST21NFCA_DM_GETINFO_PIPE_LIST).

The first dynamic pipe is present at index 3.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2015-10-26 06:53:17 +01:00
Christophe Ricard 92d108b6f4 NFC: st21nfca: Keep st21nfca_gates unchanged in load_session
We need to keep initial st_nci_gates values in order for
nfc_hci_dev_connect_gates to create and open pipe when necessary.

For example after a firmware update CLF pipes are cleared. Changing
pipe values in st21nfca_gates was causing nfc_hci_dev_connect_gates
not using accurate pipes value.

Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2015-10-26 06:53:16 +01:00
Christophe Ricard 6443ce97d2 NFC: st21nfca: Open NFC_HCI_LINK_MGMT_PIPE
NFC_HCI_LINK_MGMT_PIPE was never opened in nfc_hci_load_session.

Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2015-10-26 06:53:15 +01:00
Christophe Ricard 4d37a772b7 NFC: st21nfca: Remove HCI gates initialization in load_session
hdev->init_data.gates is already initialized in st21nfca_hci_probe.

Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2015-10-26 06:53:14 +01:00
Christophe Ricard 1c54795da0 NFC: st21nfca: Align st21nfca driver with other nfc driver
Align st21nfca driver with or nfc driver:
- Remove st21nfca_ prefix
- Merge st21nfca_se.h, st21nfca_dep.h in st21nfca.h

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2015-10-26 06:53:00 +01:00