Commit graph

20 commits

Author SHA1 Message Date
Krzysztof Kozlowski
894a6e1586 nfc: mei_phy: constify buffer passed to mei_nfc_send()
The buffer passed to mei_nfc_send() can be const for correctness and
safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-07-29 12:28:02 +01:00
Krzysztof Kozlowski
7a5e98daf6 nfc: constify nfc_phy_ops
Neither the core nor the drivers modify the passed pointer to struct
nfc_phy_ops (consisting of function pointers), so make it a pointer
to const for correctness and safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-07-25 09:21:21 +01:00
Krzysztof Kozlowski
6a7fdad702 nfc: mei_phy: drop ftrace-like debugging messages
Now that the kernel has ftrace, any debugging calls that just do "made
it to this function!" and "leaving this function!" can be removed.
Better to use standard debugging tools.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20210531073522.6720-2-krzysztof.kozlowski@canonical.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-05-31 21:31:08 -07:00
Tomas Winkler
191b070072 nfc/mei: convert to SPDX license tags
Replace boiler plate licenses texts with the SPDX license
identifiers in the mei nfc files header.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-28 02:07:54 +09:00
Alexander Usyskin
7c7a6077f5 mei: bus: split RX and async notification callbacks
Split callbacks for RX and async notification events on mei bus to
eliminate synchronization problems and to open way for RX optimizations.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-17 16:37:49 +01:00
Greg Kroah-Hartman
b7d91c9152 Merge 4.9-rc5 into char-misc-next
We want those fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-14 16:39:47 +01:00
Alexander Usyskin
582ab27a06 mei: bus: fix received data size check in NFC fixup
NFC version reply size checked against only header size, not against
full message size. That may lead potentially to uninitialized memory access
in version data.

That leads to warnings when version data is accessed:
drivers/misc/mei/bus-fixup.c: warning: '*((void *)&ver+11)' may be used uninitialized in this function [-Wuninitialized]:  => 212:2

Reported in
Build regressions/improvements in v4.9-rc3
https://lkml.org/lkml/2016/10/30/57

Fixes: 59fcd7c63a (mei: nfc: Initial nfc implementation)
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-31 10:25:22 -06:00
Tomas Winkler
1e4edb3fe9 mei: bus: remove rx callback context
The callback context is redunant as all the information can be
retrived from the device struture of its private data.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-28 08:21:22 -04:00
Tomas Winkler
972cedf6e3 nfc: mei_phy: get phy from the driver data
In order to remove rather redundant context from the callback
signature we the get nfc mei_phy from the driver's data.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-28 08:21:22 -04:00
Tomas Winkler
d49dc5e76f mei: bus: use mei_cldev_ prefix for the API functions
Use mei_cldev_ prefix for all mei client bus api functions
in order to resolve prefix conflict with functions that handle
client function and are defined in client.c

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-20 19:31:10 -07:00
Tomas Winkler
893913822e mei: bus: complete variable rename of type struct mei_cl_device
In the
commit 5c079ae11921 ("mei: bus: fix drivers and devices names confusion")
we set the variables of type struct mei_cl_device to 'cldev'
but few places were left out, namely mei_cl_bus.h header
and the mei nfc drivers.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-20 19:31:09 -07:00
Alexander Usyskin
bb2ef9c39d mei: bus: add and call callback on notify event
Enable drivers on mei client bus to subscribe
to asynchronous event notifications.
Introduce events_mask to the existing callback infrastructure
so it is possible to handle both RX and event notification.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-03 17:30:00 -07:00
Tomas Winkler
1d3ff76721 NFC: mei_phy: adjust mei nfc header according the spec
1. mei_nfc_hci_hdr and mei_nfc_hdr are just the same thing so drop one
2. use mei_nfc_hdr structure as the member of the command and the reply
instead of replicating all header fields.
3. dump the header for easier debugging

Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-24 11:15:54 -07:00
Tomas Winkler
be9b720a0c NFC: mei_phy: move all nfc logic from mei driver to nfc
move nfc logic to mei_phy module, we prefer as much as
possible not to deal with a particualr client protocol
in the mei generic infrasutcutre

Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-24 11:15:54 -07:00
Salil Kapur
fe0219cc50 NFC: mei_phy: Using kfree_skb() instead of kfree()
Using kfree_skb() instead of kfree() for struct sk_buff

Signed-off-by: Salil Kapur <salilkapur93@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2014-01-04 03:32:26 +01:00
Jeff Kirsher
98b32decc8 nfc: Fix FSF address in file headers
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 <http://www.gnu.org/licenses/> 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 <lauro.venancio@openbossa.org>
CC: Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
CC: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-12-11 10:56:21 -05:00
Joe Perches
17936b43f0 NFC: Standardize logging style
Use standardized styles to minimize coding defects.

Always use nfc_<level> where feasible.
Add \n to formats where appropriate.
Typo "it it" correction.
Add #define pr_fmt where appropriate.
Remove function tracing logging messages.
Remove OOM messages.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-09-25 01:35:39 +02:00
Valentin Ilie
bda7eb2763 NFC: mei_phy: Clean up file
Fix checkpatch warnings.
Replace __attribute__((__packed__)) with __packed.
Replace spaces with tabs.

Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-06-14 13:45:11 +02:00
Samuel Ortiz
73f3adb9b9 NFC: mei_phy: Register event callback when enabling the device
The callback registration starts a waiting read, so it needs to be fired
everytime the device is enabled. Otherwise following writes will never get
an answer back.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-05-21 10:48:40 +02:00
Eric Lapuyade
4912e2fe74 NFC: mei: Add a common mei bus API for NFC drivers
This isolates the common code that is required to use an mei bus nfc
device from an NFC HCI drivers. This prepares for future drivers for
NFC chips connected behind an Intel Management Engine controller.
The microread_mei HCI driver is also modified to use that common code.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-04-16 00:39:31 +02:00