Skip to content

Commit

Permalink
Samuel Ortiz <sameo@linux.intel.com> says:
Browse files Browse the repository at this point in the history
"Merge tag 'nfc-fixes-3.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-fixes

This is the first batch of NFC fixes for 3.10, and it contains:

- 3 fixes for the NFC MEI support:
	* We now depend on the correct Kconfig symbol.
	* We register an MEI event callback whenever we enable an NFC device,
	  otherwise we fail to read anything after an enable/disable cycle.
	* We only disable an MEI device from its disable mey_phy_ops,
	  preventing useless consecutive disable calls.

- An NFC Makefile cleanup, as I forgot to remove a commented out line when
  moving the LLCP code to the NFC top level directory."

Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
John W. Linville committed May 22, 2013
2 parents 6bb4880 + e3a6b14 commit 323a98d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 32 deletions.
2 changes: 1 addition & 1 deletion drivers/nfc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ config NFC_WILINK

config NFC_MEI_PHY
tristate "MEI bus NFC device support"
depends on INTEL_MEI_BUS_NFC && NFC_HCI
depends on INTEL_MEI && NFC_HCI
help
This adds support to use an mei bus nfc device. Select this if you
will use an HCI NFC driver for an NFC chip connected behind an
Expand Down
9 changes: 9 additions & 0 deletions drivers/nfc/mei_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ int nfc_mei_phy_enable(void *phy_id)
return r;
}

r = mei_cl_register_event_cb(phy->device, nfc_mei_event_cb, phy);
if (r) {
pr_err("MEY_PHY: Event cb registration failed\n");
mei_cl_disable_device(phy->device);
phy->powered = 0;

return r;
}

phy->powered = 1;

return 0;
Expand Down
20 changes: 5 additions & 15 deletions drivers/nfc/microread/mei.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,16 @@ static int microread_mei_probe(struct mei_cl_device *device,
return -ENOMEM;
}

r = mei_cl_register_event_cb(device, nfc_mei_event_cb, phy);
if (r) {
pr_err(MICROREAD_DRIVER_NAME ": event cb registration failed\n");
goto err_out;
}

r = microread_probe(phy, &mei_phy_ops, LLC_NOP_NAME,
MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD,
&phy->hdev);
if (r < 0)
goto err_out;

return 0;
if (r < 0) {
nfc_mei_phy_free(phy);

err_out:
nfc_mei_phy_free(phy);
return r;
}

return r;
return 0;
}

static int microread_mei_remove(struct mei_cl_device *device)
Expand All @@ -71,8 +63,6 @@ static int microread_mei_remove(struct mei_cl_device *device)

microread_remove(phy->hdev);

nfc_mei_phy_disable(phy);

nfc_mei_phy_free(phy);

return 0;
Expand Down
20 changes: 5 additions & 15 deletions drivers/nfc/pn544/mei.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,16 @@ static int pn544_mei_probe(struct mei_cl_device *device,
return -ENOMEM;
}

r = mei_cl_register_event_cb(device, nfc_mei_event_cb, phy);
if (r) {
pr_err(PN544_DRIVER_NAME ": event cb registration failed\n");
goto err_out;
}

r = pn544_hci_probe(phy, &mei_phy_ops, LLC_NOP_NAME,
MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD,
&phy->hdev);
if (r < 0)
goto err_out;

return 0;
if (r < 0) {
nfc_mei_phy_free(phy);

err_out:
nfc_mei_phy_free(phy);
return r;
}

return r;
return 0;
}

static int pn544_mei_remove(struct mei_cl_device *device)
Expand All @@ -71,8 +63,6 @@ static int pn544_mei_remove(struct mei_cl_device *device)

pn544_hci_remove(phy->hdev);

nfc_mei_phy_disable(phy);

nfc_mei_phy_free(phy);

return 0;
Expand Down
1 change: 0 additions & 1 deletion net/nfc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
obj-$(CONFIG_NFC) += nfc.o
obj-$(CONFIG_NFC_NCI) += nci/
obj-$(CONFIG_NFC_HCI) += hci/
#obj-$(CONFIG_NFC_LLCP) += llcp/

nfc-objs := core.o netlink.o af_nfc.o rawsock.o llcp_core.o llcp_commands.o \
llcp_sock.o
Expand Down

0 comments on commit 323a98d

Please sign in to comment.