Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

Signed-off-by: Ilan Elias <ilane@ti.com>
Acked-by: Lauro Ramos Venancio <lauro.venancio@openbossa.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Ilan Elias and committed by
John W. Linville
2eb1dc10 5cf80993

+14 -18
+14 -18
net/nfc/nci/core.c
··· 135 135 136 136 static void nci_init_complete_req(struct nci_dev *ndev, unsigned long opt) 137 137 { 138 - struct nci_rf_disc_map_cmd cmd; 139 138 struct nci_core_conn_create_cmd conn_cmd; 139 + struct nci_rf_disc_map_cmd cmd; 140 + struct disc_map_config *cfg = cmd.mapping_configs; 141 + __u8 *num = &cmd.num_mapping_configs; 140 142 int i; 141 143 142 144 /* create static rf connection */ ··· 147 145 nci_send_cmd(ndev, NCI_OP_CORE_CONN_CREATE_CMD, 2, &conn_cmd); 148 146 149 147 /* set rf mapping configurations */ 150 - cmd.num_mapping_configs = 0; 148 + *num = 0; 151 149 152 150 /* by default mapping is set to NCI_RF_INTERFACE_FRAME */ 153 151 for (i = 0; i < ndev->num_supported_rf_interfaces; i++) { 154 152 if (ndev->supported_rf_interfaces[i] == 155 153 NCI_RF_INTERFACE_ISO_DEP) { 156 - cmd.mapping_configs[cmd.num_mapping_configs] 157 - .rf_protocol = NCI_RF_PROTOCOL_ISO_DEP; 158 - cmd.mapping_configs[cmd.num_mapping_configs] 159 - .mode = NCI_DISC_MAP_MODE_BOTH; 160 - cmd.mapping_configs[cmd.num_mapping_configs] 161 - .rf_interface_type = NCI_RF_INTERFACE_ISO_DEP; 162 - cmd.num_mapping_configs++; 154 + cfg[*num].rf_protocol = NCI_RF_PROTOCOL_ISO_DEP; 155 + cfg[*num].mode = NCI_DISC_MAP_MODE_BOTH; 156 + cfg[*num].rf_interface_type = NCI_RF_INTERFACE_ISO_DEP; 157 + (*num)++; 163 158 } else if (ndev->supported_rf_interfaces[i] == 164 159 NCI_RF_INTERFACE_NFC_DEP) { 165 - cmd.mapping_configs[cmd.num_mapping_configs] 166 - .rf_protocol = NCI_RF_PROTOCOL_NFC_DEP; 167 - cmd.mapping_configs[cmd.num_mapping_configs] 168 - .mode = NCI_DISC_MAP_MODE_BOTH; 169 - cmd.mapping_configs[cmd.num_mapping_configs] 170 - .rf_interface_type = NCI_RF_INTERFACE_NFC_DEP; 171 - cmd.num_mapping_configs++; 160 + cfg[*num].rf_protocol = NCI_RF_PROTOCOL_NFC_DEP; 161 + cfg[*num].mode = NCI_DISC_MAP_MODE_BOTH; 162 + cfg[*num].rf_interface_type = NCI_RF_INTERFACE_NFC_DEP; 163 + (*num)++; 172 164 } 173 165 174 - if (cmd.num_mapping_configs == NCI_MAX_NUM_MAPPING_CONFIGS) 166 + if (*num == NCI_MAX_NUM_MAPPING_CONFIGS) 175 167 break; 176 168 } 177 169 178 170 nci_send_cmd(ndev, NCI_OP_RF_DISCOVER_MAP_CMD, 179 - (1 + (cmd.num_mapping_configs*sizeof(struct disc_map_config))), 171 + (1 + ((*num)*sizeof(struct disc_map_config))), 180 172 &cmd); 181 173 } 182 174