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>
This commit is contained in:
Samuel Ortiz 2013-04-30 23:48:50 +02:00
parent d999e4db0a
commit 73f3adb9b9
3 changed files with 19 additions and 26 deletions

View file

@ -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;

View file

@ -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;
if (r < 0) {
nfc_mei_phy_free(phy);
return r;
}
return 0;
err_out:
nfc_mei_phy_free(phy);
return r;
}
static int microread_mei_remove(struct mei_cl_device *device)

View file

@ -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;
if (r < 0) {
nfc_mei_phy_free(phy);
return r;
}
return 0;
err_out:
nfc_mei_phy_free(phy);
return r;
}
static int pn544_mei_remove(struct mei_cl_device *device)