aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/nfc/nci_core.h
diff options
context:
space:
mode:
authorEric Lapuyade <eric.lapuyade@linux.intel.com>2013-09-05 11:02:21 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2013-09-25 01:35:41 +0200
commitfa544fff62aeeb0cf8008c61077aae10fb1407a9 (patch)
tree42e24efbcaca24ad48bde91259696649388483d3 /include/net/nfc/nci_core.h
parentNFC: Move struct nfc_phy_ops out of HCI up to nfc core level (diff)
downloadlinux-dev-fa544fff62aeeb0cf8008c61077aae10fb1407a9.tar.xz
linux-dev-fa544fff62aeeb0cf8008c61077aae10fb1407a9.zip
NFC: NCI: Simplify NCI SPI to become a simple framing/checking layer
NCI SPI layer should not manage the nci dev, this is the job of the nci chipset driver. This layer should be limited to frame/deframe nci packets, and optionnaly check integrity (crc) and manage the ack/nak protocol. The NCI SPI must not be mixed up with an NCI dev. spi_[dev|device] are therefore renamed to a simple spi for more clarity. The header and crc sizes are moved to nci.h so that drivers can use them to reserve space in outgoing skbs. nci_spi_send() is exported to be accessible by drivers. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include/net/nfc/nci_core.h')
-rw-r--r--include/net/nfc/nci_core.h41
1 files changed, 11 insertions, 30 deletions
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index c08399621c8b..37ba06f2dfa9 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -207,16 +207,14 @@ int nci_to_errno(__u8 code);
#define NCI_SPI_CRC_ENABLED 0x01
/* ----- NCI SPI structures ----- */
-struct nci_spi_dev;
+struct nci_spi;
struct nci_spi_ops {
- int (*open)(struct nci_spi_dev *nsdev);
- int (*close)(struct nci_spi_dev *nsdev);
- void (*assert_int)(struct nci_spi_dev *nsdev);
- void (*deassert_int)(struct nci_spi_dev *nsdev);
+ void (*assert_int)(struct nci_spi *nspi);
+ void (*deassert_int)(struct nci_spi *nspi);
};
-struct nci_spi_dev {
+struct nci_spi {
struct nci_dev *ndev;
struct spi_device *spi;
struct nci_spi_ops *ops;
@@ -227,31 +225,14 @@ struct nci_spi_dev {
struct completion req_completion;
u8 req_result;
-
- void *driver_data;
};
-/* ----- NCI SPI Devices ----- */
-struct nci_spi_dev *nci_spi_allocate_device(struct spi_device *spi,
- struct nci_spi_ops *ops,
- u32 supported_protocols,
- u32 supported_se,
- u8 acknowledge_mode,
- unsigned int delay);
-void nci_spi_free_device(struct nci_spi_dev *nsdev);
-int nci_spi_register_device(struct nci_spi_dev *nsdev);
-void nci_spi_unregister_device(struct nci_spi_dev *nsdev);
-int nci_spi_recv_frame(struct nci_spi_dev *nsdev);
-
-static inline void nci_spi_set_drvdata(struct nci_spi_dev *nsdev,
- void *data)
-{
- nsdev->driver_data = data;
-}
-
-static inline void *nci_spi_get_drvdata(struct nci_spi_dev *nsdev)
-{
- return nsdev->driver_data;
-}
+/* ----- NCI SPI ----- */
+struct nci_spi *nci_spi_allocate_spi(struct spi_device *spi,
+ struct nci_spi_ops *ops,
+ u8 acknowledge_mode, unsigned int delay,
+ struct nci_dev *ndev);
+int nci_spi_send(struct nci_spi *nspi, struct sk_buff *skb);
+int nci_spi_recv_frame(struct nci_spi *nspi);
#endif /* __NCI_CORE_H */