Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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;
+5 −13
Original line number Diff line number Diff line
@@ -43,26 +43,18 @@ 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;

err_out:
	if (r < 0) {
		nfc_mei_phy_free(phy);

		return r;
	}

	return 0;
}

static int microread_mei_remove(struct mei_cl_device *device)
{
	struct nfc_mei_phy *phy = mei_cl_get_drvdata(device);
+5 −13
Original line number Diff line number Diff line
@@ -43,26 +43,18 @@ 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;

err_out:
	if (r < 0) {
		nfc_mei_phy_free(phy);

		return r;
	}

	return 0;
}

static int pn544_mei_remove(struct mei_cl_device *device)
{
	struct nfc_mei_phy *phy = mei_cl_get_drvdata(device);