Skip to content

Commit 73f3adb

Browse files
author
Samuel Ortiz
committed
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>
1 parent d999e4d commit 73f3adb

3 files changed

Lines changed: 19 additions & 26 deletions

File tree

‎drivers/nfc/mei_phy.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ int nfc_mei_phy_enable(void *phy_id)
6464
return r;
6565
}
6666

67+
r = mei_cl_register_event_cb(phy->device, nfc_mei_event_cb, phy);
68+
if (r) {
69+
pr_err("MEY_PHY: Event cb registration failed\n");
70+
mei_cl_disable_device(phy->device);
71+
phy->powered = 0;
72+
73+
return r;
74+
}
75+
6776
phy->powered = 1;
6877

6978
return 0;

‎drivers/nfc/microread/mei.c‎

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,16 @@ static int microread_mei_probe(struct mei_cl_device *device,
4343
return -ENOMEM;
4444
}
4545

46-
r = mei_cl_register_event_cb(device, nfc_mei_event_cb, phy);
47-
if (r) {
48-
pr_err(MICROREAD_DRIVER_NAME ": event cb registration failed\n");
49-
goto err_out;
50-
}
51-
5246
r = microread_probe(phy, &mei_phy_ops, LLC_NOP_NAME,
5347
MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD,
5448
&phy->hdev);
55-
if (r < 0)
56-
goto err_out;
57-
58-
return 0;
49+
if (r < 0) {
50+
nfc_mei_phy_free(phy);
5951

60-
err_out:
61-
nfc_mei_phy_free(phy);
52+
return r;
53+
}
6254

63-
return r;
55+
return 0;
6456
}
6557

6658
static int microread_mei_remove(struct mei_cl_device *device)

‎drivers/nfc/pn544/mei.c‎

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,16 @@ static int pn544_mei_probe(struct mei_cl_device *device,
4343
return -ENOMEM;
4444
}
4545

46-
r = mei_cl_register_event_cb(device, nfc_mei_event_cb, phy);
47-
if (r) {
48-
pr_err(PN544_DRIVER_NAME ": event cb registration failed\n");
49-
goto err_out;
50-
}
51-
5246
r = pn544_hci_probe(phy, &mei_phy_ops, LLC_NOP_NAME,
5347
MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD,
5448
&phy->hdev);
55-
if (r < 0)
56-
goto err_out;
57-
58-
return 0;
49+
if (r < 0) {
50+
nfc_mei_phy_free(phy);
5951

60-
err_out:
61-
nfc_mei_phy_free(phy);
52+
return r;
53+
}
6254

63-
return r;
55+
return 0;
6456
}
6557

6658
static int pn544_mei_remove(struct mei_cl_device *device)

0 commit comments

Comments
 (0)