NFC: hci: Add load_session HCI operand
load_session allows a CLF to restore the gate <-> pipe table from some proprietary location. The main advantage to add this function is to reduce the memory wear by running pipe creation (and storing) only once. Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
d330905db6
commit
e240bc3612
|
@ -27,6 +27,7 @@ struct nfc_hci_dev;
|
||||||
struct nfc_hci_ops {
|
struct nfc_hci_ops {
|
||||||
int (*open) (struct nfc_hci_dev *hdev);
|
int (*open) (struct nfc_hci_dev *hdev);
|
||||||
void (*close) (struct nfc_hci_dev *hdev);
|
void (*close) (struct nfc_hci_dev *hdev);
|
||||||
|
int (*load_session) (struct nfc_hci_dev *hdev);
|
||||||
int (*hci_ready) (struct nfc_hci_dev *hdev);
|
int (*hci_ready) (struct nfc_hci_dev *hdev);
|
||||||
/*
|
/*
|
||||||
* xmit must always send the complete buffer before
|
* xmit must always send the complete buffer before
|
||||||
|
|
|
@ -380,20 +380,16 @@ static int hci_dev_session_init(struct nfc_hci_dev *hdev)
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto disconnect_all;
|
goto disconnect_all;
|
||||||
|
|
||||||
if (skb->len && skb->len == strlen(hdev->init_data.session_id))
|
if (skb->len && skb->len == strlen(hdev->init_data.session_id) &&
|
||||||
if (memcmp(hdev->init_data.session_id, skb->data,
|
(memcmp(hdev->init_data.session_id, skb->data,
|
||||||
skb->len) == 0) {
|
skb->len) == 0) && hdev->ops->load_session) {
|
||||||
/* TODO ELa: restore gate<->pipe table from
|
/* Restore gate<->pipe table from some proprietary location. */
|
||||||
* some TBD location.
|
|
||||||
* note: it doesn't seem possible to get the chip
|
|
||||||
* currently open gate/pipe table.
|
|
||||||
* It is only possible to obtain the supported
|
|
||||||
* gate list.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* goto exit
|
r = hdev->ops->load_session(hdev);
|
||||||
* For now, always do a full initialization */
|
|
||||||
}
|
if (r < 0)
|
||||||
|
goto disconnect_all;
|
||||||
|
} else {
|
||||||
|
|
||||||
r = nfc_hci_disconnect_all_gates(hdev);
|
r = nfc_hci_disconnect_all_gates(hdev);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
@ -408,6 +404,7 @@ static int hci_dev_session_init(struct nfc_hci_dev *hdev)
|
||||||
NFC_HCI_ADMIN_SESSION_IDENTITY,
|
NFC_HCI_ADMIN_SESSION_IDENTITY,
|
||||||
hdev->init_data.session_id,
|
hdev->init_data.session_id,
|
||||||
strlen(hdev->init_data.session_id));
|
strlen(hdev->init_data.session_id));
|
||||||
|
}
|
||||||
if (r == 0)
|
if (r == 0)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue