Commit 73f3adb9 authored by Samuel Ortiz's avatar Samuel Ortiz

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: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent d999e4db
...@@ -64,6 +64,15 @@ int nfc_mei_phy_enable(void *phy_id) ...@@ -64,6 +64,15 @@ int nfc_mei_phy_enable(void *phy_id)
return r; 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; phy->powered = 1;
return 0; return 0;
......
...@@ -43,24 +43,16 @@ static int microread_mei_probe(struct mei_cl_device *device, ...@@ -43,24 +43,16 @@ static int microread_mei_probe(struct mei_cl_device *device,
return -ENOMEM; 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, r = microread_probe(phy, &mei_phy_ops, LLC_NOP_NAME,
MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD, MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD,
&phy->hdev); &phy->hdev);
if (r < 0) if (r < 0) {
goto err_out;
return 0;
err_out:
nfc_mei_phy_free(phy); nfc_mei_phy_free(phy);
return r; return r;
}
return 0;
} }
static int microread_mei_remove(struct mei_cl_device *device) static int microread_mei_remove(struct mei_cl_device *device)
......
...@@ -43,24 +43,16 @@ static int pn544_mei_probe(struct mei_cl_device *device, ...@@ -43,24 +43,16 @@ static int pn544_mei_probe(struct mei_cl_device *device,
return -ENOMEM; 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, r = pn544_hci_probe(phy, &mei_phy_ops, LLC_NOP_NAME,
MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD, MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD,
&phy->hdev); &phy->hdev);
if (r < 0) if (r < 0) {
goto err_out;
return 0;
err_out:
nfc_mei_phy_free(phy); nfc_mei_phy_free(phy);
return r; return r;
}
return 0;
} }
static int pn544_mei_remove(struct mei_cl_device *device) static int pn544_mei_remove(struct mei_cl_device *device)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment