* opae_adapter_data_alloc - alloc opae_adapter_data data structure * @type: opae_adapter_type. * * Return: opae_adapter_data on success, otherwise NULL. */
| 269 | * Return: opae_adapter_data on success, otherwise NULL. |
| 270 | */ |
| 271 | void *opae_adapter_data_alloc(enum opae_adapter_type type) |
| 272 | { |
| 273 | struct opae_adapter_data *data; |
| 274 | int size; |
| 275 | |
| 276 | switch (type) { |
| 277 | case OPAE_FPGA_PCI: |
| 278 | size = sizeof(struct opae_adapter_data_pci); |
| 279 | break; |
| 280 | case OPAE_FPGA_NET: |
| 281 | size = sizeof(struct opae_adapter_data_net); |
| 282 | break; |
| 283 | default: |
| 284 | size = sizeof(struct opae_adapter_data); |
| 285 | break; |
| 286 | } |
| 287 | |
| 288 | data = opae_zmalloc(size); |
| 289 | if (!data) |
| 290 | return NULL; |
| 291 | |
| 292 | data->type = type; |
| 293 | |
| 294 | return data; |
| 295 | } |
| 296 | |
| 297 | static struct opae_adapter_ops *match_ops(struct opae_adapter *adapter) |
| 298 | { |
no outgoing calls
no test coverage detected