diff options
author | Ilan Elias <ilane@ti.com> | 2011-09-22 03:47:52 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-09-27 14:34:04 -0400 |
commit | 2eb1dc101e6ed62fda64a426ffd864c03e550bc2 (patch) | |
tree | cb9f10c7c87d55474a3e9a37300d4c4d18c0c4cb /net/nfc | |
parent | 5cf80993add2d01dcfe3283cb290998b9d3d72cd (diff) |
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>
Diffstat (limited to 'net/nfc')
-rw-r--r-- | net/nfc/nci/core.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index 895e5fdf464a..c3dfd4e13bd5 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c | |||
@@ -135,8 +135,10 @@ static void nci_init_req(struct nci_dev *ndev, unsigned long opt) | |||
135 | 135 | ||
136 | static void nci_init_complete_req(struct nci_dev *ndev, unsigned long opt) | 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 | struct nci_core_conn_create_cmd conn_cmd; | 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 | int i; | 142 | int i; |
141 | 143 | ||
142 | /* create static rf connection */ | 144 | /* create static rf connection */ |
@@ -145,36 +147,30 @@ static void nci_init_complete_req(struct nci_dev *ndev, unsigned long opt) | |||
145 | nci_send_cmd(ndev, NCI_OP_CORE_CONN_CREATE_CMD, 2, &conn_cmd); | 147 | nci_send_cmd(ndev, NCI_OP_CORE_CONN_CREATE_CMD, 2, &conn_cmd); |
146 | 148 | ||
147 | /* set rf mapping configurations */ | 149 | /* set rf mapping configurations */ |
148 | cmd.num_mapping_configs = 0; | 150 | *num = 0; |
149 | 151 | ||
150 | /* by default mapping is set to NCI_RF_INTERFACE_FRAME */ | 152 | /* by default mapping is set to NCI_RF_INTERFACE_FRAME */ |
151 | for (i = 0; i < ndev->num_supported_rf_interfaces; i++) { | 153 | for (i = 0; i < ndev->num_supported_rf_interfaces; i++) { |
152 | if (ndev->supported_rf_interfaces[i] == | 154 | if (ndev->supported_rf_interfaces[i] == |
153 | NCI_RF_INTERFACE_ISO_DEP) { | 155 | NCI_RF_INTERFACE_ISO_DEP) { |
154 | cmd.mapping_configs[cmd.num_mapping_configs] | 156 | cfg[*num].rf_protocol = NCI_RF_PROTOCOL_ISO_DEP; |
155 | .rf_protocol = NCI_RF_PROTOCOL_ISO_DEP; | 157 | cfg[*num].mode = NCI_DISC_MAP_MODE_BOTH; |
156 | cmd.mapping_configs[cmd.num_mapping_configs] | 158 | cfg[*num].rf_interface_type = NCI_RF_INTERFACE_ISO_DEP; |
157 | .mode = NCI_DISC_MAP_MODE_BOTH; | 159 | (*num)++; |
158 | cmd.mapping_configs[cmd.num_mapping_configs] | ||
159 | .rf_interface_type = NCI_RF_INTERFACE_ISO_DEP; | ||
160 | cmd.num_mapping_configs++; | ||
161 | } else if (ndev->supported_rf_interfaces[i] == | 160 | } else if (ndev->supported_rf_interfaces[i] == |
162 | NCI_RF_INTERFACE_NFC_DEP) { | 161 | NCI_RF_INTERFACE_NFC_DEP) { |
163 | cmd.mapping_configs[cmd.num_mapping_configs] | 162 | cfg[*num].rf_protocol = NCI_RF_PROTOCOL_NFC_DEP; |
164 | .rf_protocol = NCI_RF_PROTOCOL_NFC_DEP; | 163 | cfg[*num].mode = NCI_DISC_MAP_MODE_BOTH; |
165 | cmd.mapping_configs[cmd.num_mapping_configs] | 164 | cfg[*num].rf_interface_type = NCI_RF_INTERFACE_NFC_DEP; |
166 | .mode = NCI_DISC_MAP_MODE_BOTH; | 165 | (*num)++; |
167 | cmd.mapping_configs[cmd.num_mapping_configs] | ||
168 | .rf_interface_type = NCI_RF_INTERFACE_NFC_DEP; | ||
169 | cmd.num_mapping_configs++; | ||
170 | } | 166 | } |
171 | 167 | ||
172 | if (cmd.num_mapping_configs == NCI_MAX_NUM_MAPPING_CONFIGS) | 168 | if (*num == NCI_MAX_NUM_MAPPING_CONFIGS) |
173 | break; | 169 | break; |
174 | } | 170 | } |
175 | 171 | ||
176 | nci_send_cmd(ndev, NCI_OP_RF_DISCOVER_MAP_CMD, | 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 | &cmd); | 174 | &cmd); |
179 | } | 175 | } |
180 | 176 | ||