Skip to content

Commit d100ffe

Browse files
robherringvinodkoul
authored andcommitted
dmaengine: qcom: Drop hidma DT support
The DT support in hidma has been broken since commit 37fa490 ("dmaengine: qcom_hidma: simplify DT resource parsing") in 2018. The issue is the of_address_to_resource() calls bail out on success rather than failure. This driver is for a defunct QCom server platform where DT use was limited to start with. As it seems no one has noticed the breakage, just remove the DT support altogether. Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Rob Herring (Arm) <[email protected]> Reviewed-by: Konrad Dybcio <[email protected]> Reviewed-by: Jeffrey Hugo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 98f2233 commit d100ffe

File tree

2 files changed

+1
-119
lines changed

2 files changed

+1
-119
lines changed

drivers/dma/qcom/hidma.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
#include <linux/platform_device.h>
5151
#include <linux/slab.h>
5252
#include <linux/spinlock.h>
53-
#include <linux/of_dma.h>
5453
#include <linux/property.h>
5554
#include <linux/delay.h>
5655
#include <linux/acpi.h>
@@ -947,22 +946,12 @@ static const struct acpi_device_id hidma_acpi_ids[] = {
947946
MODULE_DEVICE_TABLE(acpi, hidma_acpi_ids);
948947
#endif
949948

950-
static const struct of_device_id hidma_match[] = {
951-
{.compatible = "qcom,hidma-1.0",},
952-
{.compatible = "qcom,hidma-1.1", .data = (void *)(HIDMA_MSI_CAP),},
953-
{.compatible = "qcom,hidma-1.2",
954-
.data = (void *)(HIDMA_MSI_CAP | HIDMA_IDENTITY_CAP),},
955-
{},
956-
};
957-
MODULE_DEVICE_TABLE(of, hidma_match);
958-
959949
static struct platform_driver hidma_driver = {
960950
.probe = hidma_probe,
961951
.remove_new = hidma_remove,
962952
.shutdown = hidma_shutdown,
963953
.driver = {
964954
.name = "hidma",
965-
.of_match_table = hidma_match,
966955
.acpi_match_table = ACPI_PTR(hidma_acpi_ids),
967956
},
968957
};

drivers/dma/qcom/hidma_mgmt.c

Lines changed: 1 addition & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@
77

88
#include <linux/dmaengine.h>
99
#include <linux/acpi.h>
10-
#include <linux/of.h>
1110
#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>
1611
#include <linux/platform_device.h>
1712
#include <linux/module.h>
1813
#include <linux/uaccess.h>
@@ -327,115 +322,13 @@ static const struct acpi_device_id hidma_mgmt_acpi_ids[] = {
327322
MODULE_DEVICE_TABLE(acpi, hidma_mgmt_acpi_ids);
328323
#endif
329324

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-
336325
static struct platform_driver hidma_mgmt_driver = {
337326
.probe = hidma_mgmt_probe,
338327
.driver = {
339328
.name = "hidma-mgmt",
340-
.of_match_table = hidma_mgmt_match,
341329
.acpi_match_table = ACPI_PTR(hidma_mgmt_acpi_ids),
342330
},
343331
};
344332

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);
441334
MODULE_LICENSE("GPL v2");

0 commit comments

Comments
 (0)