Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dmaengine: qcom: Drop hidma DT support

The DT support in hidma has been broken since commit 37fa4905d22a
("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 <dan.carpenter@linaro.org>
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Link: https://lore.kernel.org/r/20240423161413.481670-1-robh@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Rob Herring (Arm) and committed by
Vinod Koul
d100ffe5 98f2233a

+1 -119
-11
drivers/dma/qcom/hidma.c
··· 50 50 #include <linux/platform_device.h> 51 51 #include <linux/slab.h> 52 52 #include <linux/spinlock.h> 53 - #include <linux/of_dma.h> 54 53 #include <linux/property.h> 55 54 #include <linux/delay.h> 56 55 #include <linux/acpi.h> ··· 946 947 MODULE_DEVICE_TABLE(acpi, hidma_acpi_ids); 947 948 #endif 948 949 949 - static const struct of_device_id hidma_match[] = { 950 - {.compatible = "qcom,hidma-1.0",}, 951 - {.compatible = "qcom,hidma-1.1", .data = (void *)(HIDMA_MSI_CAP),}, 952 - {.compatible = "qcom,hidma-1.2", 953 - .data = (void *)(HIDMA_MSI_CAP | HIDMA_IDENTITY_CAP),}, 954 - {}, 955 - }; 956 - MODULE_DEVICE_TABLE(of, hidma_match); 957 - 958 950 static struct platform_driver hidma_driver = { 959 951 .probe = hidma_probe, 960 952 .remove_new = hidma_remove, 961 953 .shutdown = hidma_shutdown, 962 954 .driver = { 963 955 .name = "hidma", 964 - .of_match_table = hidma_match, 965 956 .acpi_match_table = ACPI_PTR(hidma_acpi_ids), 966 957 }, 967 958 };
+1 -108
drivers/dma/qcom/hidma_mgmt.c
··· 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> ··· 322 327 MODULE_DEVICE_TABLE(acpi, hidma_mgmt_acpi_ids); 323 328 #endif 324 329 325 - static const struct of_device_id hidma_mgmt_match[] = { 326 - {.compatible = "qcom,hidma-mgmt-1.0",}, 327 - {}, 328 - }; 329 - MODULE_DEVICE_TABLE(of, hidma_mgmt_match); 330 - 331 330 static struct platform_driver hidma_mgmt_driver = { 332 331 .probe = hidma_mgmt_probe, 333 332 .driver = { 334 333 .name = "hidma-mgmt", 335 - .of_match_table = hidma_mgmt_match, 336 334 .acpi_match_table = ACPI_PTR(hidma_mgmt_acpi_ids), 337 335 }, 338 336 }; 339 337 340 - #if defined(CONFIG_OF) && defined(CONFIG_OF_IRQ) 341 - static int object_counter; 342 - 343 - static int __init hidma_mgmt_of_populate_channels(struct device_node *np) 344 - { 345 - struct platform_device *pdev_parent = of_find_device_by_node(np); 346 - struct platform_device_info pdevinfo; 347 - struct device_node *child; 348 - struct resource *res; 349 - int ret = 0; 350 - 351 - /* allocate a resource array */ 352 - res = kcalloc(3, sizeof(*res), GFP_KERNEL); 353 - if (!res) 354 - return -ENOMEM; 355 - 356 - for_each_available_child_of_node(np, child) { 357 - struct platform_device *new_pdev; 358 - 359 - ret = of_address_to_resource(child, 0, &res[0]); 360 - if (!ret) 361 - goto out; 362 - 363 - ret = of_address_to_resource(child, 1, &res[1]); 364 - if (!ret) 365 - goto out; 366 - 367 - ret = of_irq_to_resource(child, 0, &res[2]); 368 - if (ret <= 0) 369 - goto out; 370 - 371 - memset(&pdevinfo, 0, sizeof(pdevinfo)); 372 - pdevinfo.fwnode = &child->fwnode; 373 - pdevinfo.parent = pdev_parent ? &pdev_parent->dev : NULL; 374 - pdevinfo.name = child->name; 375 - pdevinfo.id = object_counter++; 376 - pdevinfo.res = res; 377 - pdevinfo.num_res = 3; 378 - pdevinfo.data = NULL; 379 - pdevinfo.size_data = 0; 380 - pdevinfo.dma_mask = DMA_BIT_MASK(64); 381 - new_pdev = platform_device_register_full(&pdevinfo); 382 - if (IS_ERR(new_pdev)) { 383 - ret = PTR_ERR(new_pdev); 384 - goto out; 385 - } 386 - new_pdev->dev.of_node = child; 387 - of_dma_configure(&new_pdev->dev, child, true); 388 - /* 389 - * It is assumed that calling of_msi_configure is safe on 390 - * platforms with or without MSI support. 391 - */ 392 - of_msi_configure(&new_pdev->dev, child); 393 - } 394 - 395 - kfree(res); 396 - 397 - return ret; 398 - 399 - out: 400 - of_node_put(child); 401 - kfree(res); 402 - 403 - return ret; 404 - } 405 - #endif 406 - 407 - static int __init hidma_mgmt_init(void) 408 - { 409 - #if defined(CONFIG_OF) && defined(CONFIG_OF_IRQ) 410 - struct device_node *child; 411 - 412 - for_each_matching_node(child, hidma_mgmt_match) { 413 - /* device tree based firmware here */ 414 - hidma_mgmt_of_populate_channels(child); 415 - } 416 - #endif 417 - /* 418 - * We do not check for return value here, as it is assumed that 419 - * platform_driver_register must not fail. The reason for this is that 420 - * the (potential) hidma_mgmt_of_populate_channels calls above are not 421 - * cleaned up if it does fail, and to do this work is quite 422 - * complicated. In particular, various calls of of_address_to_resource, 423 - * of_irq_to_resource, platform_device_register_full, of_dma_configure, 424 - * and of_msi_configure which then call other functions and so on, must 425 - * be cleaned up - this is not a trivial exercise. 426 - * 427 - * Currently, this module is not intended to be unloaded, and there is 428 - * no module_exit function defined which does the needed cleanup. For 429 - * this reason, we have to assume success here. 430 - */ 431 - platform_driver_register(&hidma_mgmt_driver); 432 - 433 - return 0; 434 - } 435 - module_init(hidma_mgmt_init); 338 + module_platform_driver(hidma_mgmt_driver); 436 339 MODULE_LICENSE("GPL v2");