equal
deleted
inserted
replaced
150 list_for_each_entry(mapped_pdo, &pl->list, list) { |
150 list_for_each_entry(mapped_pdo, &pl->list, list) { |
151 if (mapped_pdo->index != pdo->index) continue; |
151 if (mapped_pdo->index != pdo->index) continue; |
152 EC_ERR("PDO 0x%04X is already mapped!\n", pdo->index); |
152 EC_ERR("PDO 0x%04X is already mapped!\n", pdo->index); |
153 return -EEXIST; |
153 return -EEXIST; |
154 } |
154 } |
155 |
155 |
156 if (!(mapped_pdo = kmalloc(sizeof(ec_pdo_t), GFP_KERNEL))) { |
156 if (!(mapped_pdo = kmalloc(sizeof(ec_pdo_t), GFP_KERNEL))) { |
157 EC_ERR("Failed to allocate PDO memory.\n"); |
157 EC_ERR("Failed to allocate PDO memory.\n"); |
158 return -ENOMEM; |
158 return -ENOMEM; |
159 } |
159 } |
160 |
160 |
188 list_for_each_entry(other_pdo, &other->list, list) { |
188 list_for_each_entry(other_pdo, &other->list, list) { |
189 ret = ec_pdo_list_add_pdo_copy(pl, other_pdo); |
189 ret = ec_pdo_list_add_pdo_copy(pl, other_pdo); |
190 if (ret) |
190 if (ret) |
191 return ret; |
191 return ret; |
192 } |
192 } |
193 |
193 |
194 return 0; |
194 return 0; |
195 } |
195 } |
196 |
196 |
197 /*****************************************************************************/ |
197 /*****************************************************************************/ |
198 |
198 |
235 } |
235 } |
236 |
236 |
237 /*****************************************************************************/ |
237 /*****************************************************************************/ |
238 |
238 |
239 /** Finds a PDO with the given index. |
239 /** Finds a PDO with the given index. |
|
240 * |
|
241 * \return Search result, or NULL. |
240 */ |
242 */ |
241 ec_pdo_t *ec_pdo_list_find_pdo( |
243 ec_pdo_t *ec_pdo_list_find_pdo( |
242 const ec_pdo_list_t *pl, /**< PDO list. */ |
244 const ec_pdo_list_t *pl, /**< PDO list. */ |
243 uint16_t index /**< PDO index. */ |
245 uint16_t index /**< PDO index. */ |
244 ) |
246 ) |
255 } |
257 } |
256 |
258 |
257 /*****************************************************************************/ |
259 /*****************************************************************************/ |
258 |
260 |
259 /** Finds a PDO with the given index and returns a const pointer. |
261 /** Finds a PDO with the given index and returns a const pointer. |
|
262 * |
|
263 * \return Search result, or NULL. |
260 */ |
264 */ |
261 const ec_pdo_t *ec_pdo_list_find_pdo_const( |
265 const ec_pdo_t *ec_pdo_list_find_pdo_const( |
262 const ec_pdo_list_t *pl, /**< PDO list. */ |
266 const ec_pdo_list_t *pl, /**< PDO list. */ |
263 uint16_t index /**< PDO index. */ |
267 uint16_t index /**< PDO index. */ |
264 ) |
268 ) |
277 /*****************************************************************************/ |
281 /*****************************************************************************/ |
278 |
282 |
279 /** Finds a PDO via its position in the list. |
283 /** Finds a PDO via its position in the list. |
280 * |
284 * |
281 * Const version. |
285 * Const version. |
|
286 * |
|
287 * \return Zero on success, otherwise a negative error code. |
282 */ |
288 */ |
283 const ec_pdo_t *ec_pdo_list_find_pdo_by_pos_const( |
289 const ec_pdo_t *ec_pdo_list_find_pdo_by_pos_const( |
284 const ec_pdo_list_t *pl, /**< PDO list. */ |
290 const ec_pdo_list_t *pl, /**< PDO list. */ |
285 unsigned int pos /**< Position in the list. */ |
291 unsigned int pos /**< Position in the list. */ |
286 ) |
292 ) |