Commit 2eb1dc101e6ed62fda64a426ffd864c03e550bc2
Committed by
John W. Linville
1 parent
5cf80993ad
Exists in
master
and in
38 other branches
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>
Showing 1 changed file with 14 additions and 18 deletions Side-by-side Diff
net/nfc/nci/core.c
... | ... | @@ -135,8 +135,10 @@ |
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 */ |
143 | 145 | |
144 | 146 | |
145 | 147 | |
146 | 148 | |
... | ... | @@ -145,36 +147,30 @@ |
145 | 147 | nci_send_cmd(ndev, NCI_OP_CORE_CONN_CREATE_CMD, 2, &conn_cmd); |
146 | 148 | |
147 | 149 | /* set rf mapping configurations */ |
148 | - cmd.num_mapping_configs = 0; | |
150 | + *num = 0; | |
149 | 151 | |
150 | 152 | /* by default mapping is set to NCI_RF_INTERFACE_FRAME */ |
151 | 153 | for (i = 0; i < ndev->num_supported_rf_interfaces; i++) { |
152 | 154 | if (ndev->supported_rf_interfaces[i] == |
153 | 155 | NCI_RF_INTERFACE_ISO_DEP) { |
154 | - cmd.mapping_configs[cmd.num_mapping_configs] | |
155 | - .rf_protocol = NCI_RF_PROTOCOL_ISO_DEP; | |
156 | - cmd.mapping_configs[cmd.num_mapping_configs] | |
157 | - .mode = NCI_DISC_MAP_MODE_BOTH; | |
158 | - cmd.mapping_configs[cmd.num_mapping_configs] | |
159 | - .rf_interface_type = NCI_RF_INTERFACE_ISO_DEP; | |
160 | - cmd.num_mapping_configs++; | |
156 | + cfg[*num].rf_protocol = NCI_RF_PROTOCOL_ISO_DEP; | |
157 | + cfg[*num].mode = NCI_DISC_MAP_MODE_BOTH; | |
158 | + cfg[*num].rf_interface_type = NCI_RF_INTERFACE_ISO_DEP; | |
159 | + (*num)++; | |
161 | 160 | } else if (ndev->supported_rf_interfaces[i] == |
162 | 161 | NCI_RF_INTERFACE_NFC_DEP) { |
163 | - cmd.mapping_configs[cmd.num_mapping_configs] | |
164 | - .rf_protocol = NCI_RF_PROTOCOL_NFC_DEP; | |
165 | - cmd.mapping_configs[cmd.num_mapping_configs] | |
166 | - .mode = NCI_DISC_MAP_MODE_BOTH; | |
167 | - cmd.mapping_configs[cmd.num_mapping_configs] | |
168 | - .rf_interface_type = NCI_RF_INTERFACE_NFC_DEP; | |
169 | - cmd.num_mapping_configs++; | |
162 | + cfg[*num].rf_protocol = NCI_RF_PROTOCOL_NFC_DEP; | |
163 | + cfg[*num].mode = NCI_DISC_MAP_MODE_BOTH; | |
164 | + cfg[*num].rf_interface_type = NCI_RF_INTERFACE_NFC_DEP; | |
165 | + (*num)++; | |
170 | 166 | } |
171 | 167 | |
172 | - if (cmd.num_mapping_configs == NCI_MAX_NUM_MAPPING_CONFIGS) | |
168 | + if (*num == NCI_MAX_NUM_MAPPING_CONFIGS) | |
173 | 169 | break; |
174 | 170 | } |
175 | 171 | |
176 | 172 | nci_send_cmd(ndev, NCI_OP_RF_DISCOVER_MAP_CMD, |
177 | - (1 + (cmd.num_mapping_configs*sizeof(struct disc_map_config))), | |
173 | + (1 + ((*num)*sizeof(struct disc_map_config))), | |
178 | 174 | &cmd); |
179 | 175 | } |
180 | 176 |