|
7 | 7 |
|
8 | 8 | #include <linux/dmaengine.h>
|
9 | 9 | #include <linux/acpi.h>
|
10 |
| -#include <linux/of.h> |
11 | 10 | #include <linux/property.h>
|
12 |
| -#include <linux/of_address.h> |
13 |
| -#include <linux/of_irq.h> |
14 |
| -#include <linux/of_platform.h> |
15 |
| -#include <linux/of_device.h> |
16 | 11 | #include <linux/platform_device.h>
|
17 | 12 | #include <linux/module.h>
|
18 | 13 | #include <linux/uaccess.h>
|
@@ -327,115 +322,13 @@ static const struct acpi_device_id hidma_mgmt_acpi_ids[] = {
|
327 | 322 | MODULE_DEVICE_TABLE(acpi, hidma_mgmt_acpi_ids);
|
328 | 323 | #endif
|
329 | 324 |
|
330 |
| -static const struct of_device_id hidma_mgmt_match[] = { |
331 |
| - {.compatible = "qcom,hidma-mgmt-1.0",}, |
332 |
| - {}, |
333 |
| -}; |
334 |
| -MODULE_DEVICE_TABLE(of, hidma_mgmt_match); |
335 |
| - |
336 | 325 | static struct platform_driver hidma_mgmt_driver = {
|
337 | 326 | .probe = hidma_mgmt_probe,
|
338 | 327 | .driver = {
|
339 | 328 | .name = "hidma-mgmt",
|
340 |
| - .of_match_table = hidma_mgmt_match, |
341 | 329 | .acpi_match_table = ACPI_PTR(hidma_mgmt_acpi_ids),
|
342 | 330 | },
|
343 | 331 | };
|
344 | 332 |
|
345 |
| -#if defined(CONFIG_OF) && defined(CONFIG_OF_IRQ) |
346 |
| -static int object_counter; |
347 |
| - |
348 |
| -static int __init hidma_mgmt_of_populate_channels(struct device_node *np) |
349 |
| -{ |
350 |
| - struct platform_device *pdev_parent = of_find_device_by_node(np); |
351 |
| - struct platform_device_info pdevinfo; |
352 |
| - struct device_node *child; |
353 |
| - struct resource *res; |
354 |
| - int ret = 0; |
355 |
| - |
356 |
| - /* allocate a resource array */ |
357 |
| - res = kcalloc(3, sizeof(*res), GFP_KERNEL); |
358 |
| - if (!res) |
359 |
| - return -ENOMEM; |
360 |
| - |
361 |
| - for_each_available_child_of_node(np, child) { |
362 |
| - struct platform_device *new_pdev; |
363 |
| - |
364 |
| - ret = of_address_to_resource(child, 0, &res[0]); |
365 |
| - if (!ret) |
366 |
| - goto out; |
367 |
| - |
368 |
| - ret = of_address_to_resource(child, 1, &res[1]); |
369 |
| - if (!ret) |
370 |
| - goto out; |
371 |
| - |
372 |
| - ret = of_irq_to_resource(child, 0, &res[2]); |
373 |
| - if (ret <= 0) |
374 |
| - goto out; |
375 |
| - |
376 |
| - memset(&pdevinfo, 0, sizeof(pdevinfo)); |
377 |
| - pdevinfo.fwnode = &child->fwnode; |
378 |
| - pdevinfo.parent = pdev_parent ? &pdev_parent->dev : NULL; |
379 |
| - pdevinfo.name = child->name; |
380 |
| - pdevinfo.id = object_counter++; |
381 |
| - pdevinfo.res = res; |
382 |
| - pdevinfo.num_res = 3; |
383 |
| - pdevinfo.data = NULL; |
384 |
| - pdevinfo.size_data = 0; |
385 |
| - pdevinfo.dma_mask = DMA_BIT_MASK(64); |
386 |
| - new_pdev = platform_device_register_full(&pdevinfo); |
387 |
| - if (IS_ERR(new_pdev)) { |
388 |
| - ret = PTR_ERR(new_pdev); |
389 |
| - goto out; |
390 |
| - } |
391 |
| - new_pdev->dev.of_node = child; |
392 |
| - of_dma_configure(&new_pdev->dev, child, true); |
393 |
| - /* |
394 |
| - * It is assumed that calling of_msi_configure is safe on |
395 |
| - * platforms with or without MSI support. |
396 |
| - */ |
397 |
| - of_msi_configure(&new_pdev->dev, child); |
398 |
| - } |
399 |
| - |
400 |
| - kfree(res); |
401 |
| - |
402 |
| - return ret; |
403 |
| - |
404 |
| -out: |
405 |
| - of_node_put(child); |
406 |
| - kfree(res); |
407 |
| - |
408 |
| - return ret; |
409 |
| -} |
410 |
| -#endif |
411 |
| - |
412 |
| -static int __init hidma_mgmt_init(void) |
413 |
| -{ |
414 |
| -#if defined(CONFIG_OF) && defined(CONFIG_OF_IRQ) |
415 |
| - struct device_node *child; |
416 |
| - |
417 |
| - for_each_matching_node(child, hidma_mgmt_match) { |
418 |
| - /* device tree based firmware here */ |
419 |
| - hidma_mgmt_of_populate_channels(child); |
420 |
| - } |
421 |
| -#endif |
422 |
| - /* |
423 |
| - * We do not check for return value here, as it is assumed that |
424 |
| - * platform_driver_register must not fail. The reason for this is that |
425 |
| - * the (potential) hidma_mgmt_of_populate_channels calls above are not |
426 |
| - * cleaned up if it does fail, and to do this work is quite |
427 |
| - * complicated. In particular, various calls of of_address_to_resource, |
428 |
| - * of_irq_to_resource, platform_device_register_full, of_dma_configure, |
429 |
| - * and of_msi_configure which then call other functions and so on, must |
430 |
| - * be cleaned up - this is not a trivial exercise. |
431 |
| - * |
432 |
| - * Currently, this module is not intended to be unloaded, and there is |
433 |
| - * no module_exit function defined which does the needed cleanup. For |
434 |
| - * this reason, we have to assume success here. |
435 |
| - */ |
436 |
| - platform_driver_register(&hidma_mgmt_driver); |
437 |
| - |
438 |
| - return 0; |
439 |
| -} |
440 |
| -module_init(hidma_mgmt_init); |
| 333 | +module_platform_driver(hidma_mgmt_driver); |
441 | 334 | MODULE_LICENSE("GPL v2");
|
0 commit comments