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.

coresight: Refactor driver data allocation

The driver data no longer needs to be allocated separately in the static
and dynamic probes. Moved the allocation into the low-level functions to
avoid code duplication.

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Tested-by: James Clark <james.clark@linaro.org>
Signed-off-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20250731-arm_cs_fix_clock_v4-v6-8-1dfe10bb3f6f@arm.com

authored by

Leo Yan and committed by
Suzuki K Poulose
ba6b61fa fbe7514a

+21 -40
+7 -13
drivers/hwtracing/coresight/coresight-catu.c
··· 515 515 { 516 516 int ret = 0; 517 517 u32 dma_mask; 518 - struct catu_drvdata *drvdata = dev_get_drvdata(dev); 518 + struct catu_drvdata *drvdata; 519 519 struct coresight_desc catu_desc; 520 520 struct coresight_platform_data *pdata = NULL; 521 521 void __iomem *base; 522 + 523 + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); 524 + if (!drvdata) 525 + return -ENOMEM; 526 + 527 + dev_set_drvdata(dev, drvdata); 522 528 523 529 ret = coresight_get_enable_clocks(dev, &drvdata->pclk, &drvdata->atclk); 524 530 if (ret) ··· 586 580 587 581 static int catu_probe(struct amba_device *adev, const struct amba_id *id) 588 582 { 589 - struct catu_drvdata *drvdata; 590 583 int ret; 591 584 592 - drvdata = devm_kzalloc(&adev->dev, sizeof(*drvdata), GFP_KERNEL); 593 - if (!drvdata) 594 - return -ENOMEM; 595 - 596 - amba_set_drvdata(adev, drvdata); 597 585 ret = __catu_probe(&adev->dev, &adev->res); 598 586 if (!ret) 599 587 pm_runtime_put(&adev->dev); ··· 627 627 static int catu_platform_probe(struct platform_device *pdev) 628 628 { 629 629 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 630 - struct catu_drvdata *drvdata; 631 630 int ret = 0; 632 - 633 - drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); 634 - if (!drvdata) 635 - return -ENOMEM; 636 631 637 632 pm_runtime_get_noresume(&pdev->dev); 638 633 pm_runtime_set_active(&pdev->dev); 639 634 pm_runtime_enable(&pdev->dev); 640 635 641 - dev_set_drvdata(&pdev->dev, drvdata); 642 636 ret = __catu_probe(&pdev->dev, res); 643 637 pm_runtime_put(&pdev->dev); 644 638 if (ret)
+7 -14
drivers/hwtracing/coresight/coresight-cpu-debug.c
··· 562 562 563 563 static int __debug_probe(struct device *dev, struct resource *res) 564 564 { 565 - struct debug_drvdata *drvdata = dev_get_drvdata(dev); 565 + struct debug_drvdata *drvdata; 566 566 void __iomem *base; 567 567 int ret; 568 + 569 + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); 570 + if (!drvdata) 571 + return -ENOMEM; 572 + 573 + dev_set_drvdata(dev, drvdata); 568 574 569 575 ret = coresight_get_enable_clocks(dev, &drvdata->pclk, NULL); 570 576 if (ret) ··· 635 629 636 630 static int debug_probe(struct amba_device *adev, const struct amba_id *id) 637 631 { 638 - struct debug_drvdata *drvdata; 639 - 640 - drvdata = devm_kzalloc(&adev->dev, sizeof(*drvdata), GFP_KERNEL); 641 - if (!drvdata) 642 - return -ENOMEM; 643 - 644 - amba_set_drvdata(adev, drvdata); 645 632 return __debug_probe(&adev->dev, &adev->res); 646 633 } 647 634 ··· 693 694 static int debug_platform_probe(struct platform_device *pdev) 694 695 { 695 696 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 696 - struct debug_drvdata *drvdata; 697 697 int ret = 0; 698 698 699 - drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); 700 - if (!drvdata) 701 - return -ENOMEM; 702 - 703 - dev_set_drvdata(&pdev->dev, drvdata); 704 699 pm_runtime_get_noresume(&pdev->dev); 705 700 pm_runtime_set_active(&pdev->dev); 706 701 pm_runtime_enable(&pdev->dev);
+7 -13
drivers/hwtracing/coresight/coresight-tmc-core.c
··· 775 775 u32 devid; 776 776 void __iomem *base; 777 777 struct coresight_platform_data *pdata = NULL; 778 - struct tmc_drvdata *drvdata = dev_get_drvdata(dev); 778 + struct tmc_drvdata *drvdata; 779 779 struct coresight_desc desc = { 0 }; 780 780 struct coresight_dev_list *dev_list = NULL; 781 + 782 + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); 783 + if (!drvdata) 784 + return -ENOMEM; 785 + 786 + dev_set_drvdata(dev, drvdata); 781 787 782 788 ret = coresight_get_enable_clocks(dev, &drvdata->pclk, &drvdata->atclk); 783 789 if (ret) ··· 894 888 895 889 static int tmc_probe(struct amba_device *adev, const struct amba_id *id) 896 890 { 897 - struct tmc_drvdata *drvdata; 898 891 int ret; 899 892 900 - drvdata = devm_kzalloc(&adev->dev, sizeof(*drvdata), GFP_KERNEL); 901 - if (!drvdata) 902 - return -ENOMEM; 903 - 904 - amba_set_drvdata(adev, drvdata); 905 893 ret = __tmc_probe(&adev->dev, &adev->res); 906 894 if (!ret) 907 895 pm_runtime_put(&adev->dev); ··· 972 972 static int tmc_platform_probe(struct platform_device *pdev) 973 973 { 974 974 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 975 - struct tmc_drvdata *drvdata; 976 975 int ret = 0; 977 976 978 - drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); 979 - if (!drvdata) 980 - return -ENOMEM; 981 - 982 - dev_set_drvdata(&pdev->dev, drvdata); 983 977 pm_runtime_get_noresume(&pdev->dev); 984 978 pm_runtime_set_active(&pdev->dev); 985 979 pm_runtime_enable(&pdev->dev);