Skip to content

Commit

Permalink
NFC: pn544: Separate the core code and the i2c one into different mod…
Browse files Browse the repository at this point in the history
…ules

As we may need to support other physical layers, we can avoid linking the
core part into each and every pn544 module.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
  • Loading branch information
Samuel Ortiz committed Jan 9, 2013
1 parent bf71ab8 commit aa74103
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 16 deletions.
15 changes: 2 additions & 13 deletions drivers/nfc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,6 @@
menu "Near Field Communication (NFC) devices"
depends on NFC

config PN544_HCI_NFC
tristate "HCI PN544 NFC driver"
depends on I2C && NFC_HCI && NFC_SHDLC
select CRC_CCITT
default n
---help---
NXP PN544 i2c driver.
This is a driver based on the SHDLC and HCI NFC kernel layers and
will thus not work with NXP libnfc library.

To compile this driver as a module, choose m here. The module will
be called pn544_hci.

config NFC_PN533
tristate "NXP PN533 USB driver"
depends on USB
Expand All @@ -39,4 +26,6 @@ config NFC_WILINK
Say Y here to compile support for Texas Instrument's NFC WiLink driver
into the kernel or say M to compile it as module.

source "drivers/nfc/pn544/Kconfig"

endmenu
2 changes: 1 addition & 1 deletion drivers/nfc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Makefile for nfc devices
#

obj-$(CONFIG_PN544_HCI_NFC) += pn544/
obj-$(CONFIG_NFC_PN544) += pn544/
obj-$(CONFIG_NFC_PN533) += pn533.o
obj-$(CONFIG_NFC_WILINK) += nfcwilink.o

Expand Down
23 changes: 23 additions & 0 deletions drivers/nfc/pn544/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
config NFC_PN544
tristate "NXP PN544 NFC driver"
depends on NFC_HCI
select CRC_CCITT
default n
---help---
NXP PN544 core driver.
This is a driver based on the HCI NFC kernel layers and
will thus not work with NXP libnfc library.

To compile this driver as a module, choose m here. The module will
be called pn544.
Say N if unsure.

config NFC_PN544_I2C
tristate "NFC PN544 i2c support"
depends on NFC_PN544 && I2C && NFC_SHDLC
---help---
This module adds support for the NXP pn544 i2c interface.
Select this if your platform is using the i2c bus.

If you choose to build a module, it'll be called pn544_i2c.
Say N if unsure.
5 changes: 3 additions & 2 deletions drivers/nfc/pn544/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Makefile for PN544 HCI based NFC driver
#

obj-$(CONFIG_PN544_HCI_NFC) += pn544_i2c.o
pn544_i2c-objs = i2c.o

pn544_i2c-y := pn544.o i2c.o
obj-$(CONFIG_NFC_PN544) += pn544.o
obj-$(CONFIG_NFC_PN544_I2C) += pn544_i2c.o
6 changes: 6 additions & 0 deletions drivers/nfc/pn544/pn544.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/module.h>

#include <linux/nfc.h>
#include <net/nfc/hci.h>
Expand Down Expand Up @@ -862,6 +863,7 @@ int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name,
err_info_alloc:
return r;
}
EXPORT_SYMBOL(pn544_hci_probe);

void pn544_hci_remove(struct nfc_hci_dev *hdev)
{
Expand All @@ -871,3 +873,7 @@ void pn544_hci_remove(struct nfc_hci_dev *hdev)
nfc_hci_free_device(hdev);
kfree(info);
}
EXPORT_SYMBOL(pn544_hci_remove);

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION(DRIVER_DESC);

0 comments on commit aa74103

Please sign in to comment.