NFC: st-nci: Keep st_nci_gates unchanged in load_session
authorChristophe Ricard <christophe.ricard@gmail.com>
Sun, 25 Oct 2015 21:54:30 +0000 (22:54 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 26 Oct 2015 05:53:15 +0000 (06:53 +0100)
We need to keep initial st_nci_gates values in order for
nci_hci_dev_connect_gates to create and open pipe when necessary.

For example after a firmware update CLF pipes are cleared. Changing
pipe values in st_nci_gates was causing nci_hci_dev_connect_gates
not using accurate pipes value.

Cc: stable@vger.kernel.org
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/nfc/st-nci/se.c

index 35221654951bdb26b3e6cebec0e9548c6bf47705..df2dc544b73a01bb0354b059c06ac2aa43fbf5fb 100644 (file)
@@ -232,13 +232,13 @@ int st_nci_hci_load_session(struct nci_dev *ndev)
                if (j < ARRAY_SIZE(st_nci_gates) &&
                    st_nci_gates[j].gate == dm_pipe_info->dst_gate_id &&
                    ST_NCI_DM_IS_PIPE_OPEN(dm_pipe_info->pipe_state)) {
-                       st_nci_gates[j].pipe = pipe_info[2];
+                       ndev->hci_dev->init_data.gates[j].pipe = pipe_info[2];
 
                        ndev->hci_dev->gate2pipe[st_nci_gates[j].gate] =
-                                               st_nci_gates[j].pipe;
-                       ndev->hci_dev->pipes[st_nci_gates[j].pipe].gate =
+                                               pipe_info[2];
+                       ndev->hci_dev->pipes[pipe_info[2]].gate =
                                                st_nci_gates[j].gate;
-                       ndev->hci_dev->pipes[st_nci_gates[j].pipe].host =
+                       ndev->hci_dev->pipes[pipe_info[2]].host =
                                                dm_pipe_info->src_host_id;
                }
                kfree_skb(skb_pipe_info);