Commit 2eb1dc10 authored by Ilan Elias's avatar Ilan Elias Committed by John W. Linville

NFC: improve readability of an 'if' in nci core.c

Signed-off-by: default avatarIlan Elias <ilane@ti.com>
Acked-by: default avatarLauro Ramos Venancio <lauro.venancio@openbossa.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 5cf80993
...@@ -135,8 +135,10 @@ static void nci_init_req(struct nci_dev *ndev, unsigned long opt) ...@@ -135,8 +135,10 @@ static void nci_init_req(struct nci_dev *ndev, unsigned long opt)
static void nci_init_complete_req(struct nci_dev *ndev, unsigned long opt) static void nci_init_complete_req(struct nci_dev *ndev, unsigned long opt)
{ {
struct nci_rf_disc_map_cmd cmd;
struct nci_core_conn_create_cmd conn_cmd; struct nci_core_conn_create_cmd conn_cmd;
struct nci_rf_disc_map_cmd cmd;
struct disc_map_config *cfg = cmd.mapping_configs;
__u8 *num = &cmd.num_mapping_configs;
int i; int i;
/* create static rf connection */ /* create static rf connection */
...@@ -145,36 +147,30 @@ static void nci_init_complete_req(struct nci_dev *ndev, unsigned long opt) ...@@ -145,36 +147,30 @@ static void nci_init_complete_req(struct nci_dev *ndev, unsigned long opt)
nci_send_cmd(ndev, NCI_OP_CORE_CONN_CREATE_CMD, 2, &conn_cmd); nci_send_cmd(ndev, NCI_OP_CORE_CONN_CREATE_CMD, 2, &conn_cmd);
/* set rf mapping configurations */ /* set rf mapping configurations */
cmd.num_mapping_configs = 0; *num = 0;
/* by default mapping is set to NCI_RF_INTERFACE_FRAME */ /* by default mapping is set to NCI_RF_INTERFACE_FRAME */
for (i = 0; i < ndev->num_supported_rf_interfaces; i++) { for (i = 0; i < ndev->num_supported_rf_interfaces; i++) {
if (ndev->supported_rf_interfaces[i] == if (ndev->supported_rf_interfaces[i] ==
NCI_RF_INTERFACE_ISO_DEP) { NCI_RF_INTERFACE_ISO_DEP) {
cmd.mapping_configs[cmd.num_mapping_configs] cfg[*num].rf_protocol = NCI_RF_PROTOCOL_ISO_DEP;
.rf_protocol = NCI_RF_PROTOCOL_ISO_DEP; cfg[*num].mode = NCI_DISC_MAP_MODE_BOTH;
cmd.mapping_configs[cmd.num_mapping_configs] cfg[*num].rf_interface_type = NCI_RF_INTERFACE_ISO_DEP;
.mode = NCI_DISC_MAP_MODE_BOTH; (*num)++;
cmd.mapping_configs[cmd.num_mapping_configs]
.rf_interface_type = NCI_RF_INTERFACE_ISO_DEP;
cmd.num_mapping_configs++;
} else if (ndev->supported_rf_interfaces[i] == } else if (ndev->supported_rf_interfaces[i] ==
NCI_RF_INTERFACE_NFC_DEP) { NCI_RF_INTERFACE_NFC_DEP) {
cmd.mapping_configs[cmd.num_mapping_configs] cfg[*num].rf_protocol = NCI_RF_PROTOCOL_NFC_DEP;
.rf_protocol = NCI_RF_PROTOCOL_NFC_DEP; cfg[*num].mode = NCI_DISC_MAP_MODE_BOTH;
cmd.mapping_configs[cmd.num_mapping_configs] cfg[*num].rf_interface_type = NCI_RF_INTERFACE_NFC_DEP;
.mode = NCI_DISC_MAP_MODE_BOTH; (*num)++;
cmd.mapping_configs[cmd.num_mapping_configs]
.rf_interface_type = NCI_RF_INTERFACE_NFC_DEP;
cmd.num_mapping_configs++;
} }
if (cmd.num_mapping_configs == NCI_MAX_NUM_MAPPING_CONFIGS) if (*num == NCI_MAX_NUM_MAPPING_CONFIGS)
break; break;
} }
nci_send_cmd(ndev, NCI_OP_RF_DISCOVER_MAP_CMD, nci_send_cmd(ndev, NCI_OP_RF_DISCOVER_MAP_CMD,
(1 + (cmd.num_mapping_configs*sizeof(struct disc_map_config))), (1 + ((*num)*sizeof(struct disc_map_config))),
&cmd); &cmd);
} }
......
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