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: ste_dma40: Add dev helper variable

The &pdev->dev device pointer is used so many times in the
probe() and d40_hw_detect_init() functions that a local *dev
variable makes the code way easier to read.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230417-ux500-dma40-cleanup-v3-3-60bfa6785968@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Linus Walleij and committed by
Vinod Koul
fb85a8c5 5a1a3b9c

+26 -24
+26 -24
drivers/dma/ste_dma40.c
··· 3104 3104 static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) 3105 3105 { 3106 3106 struct stedma40_platform_data *plat_data = dev_get_platdata(&pdev->dev); 3107 + struct device *dev = &pdev->dev; 3107 3108 struct clk *clk; 3108 3109 void __iomem *virtbase; 3109 3110 struct resource *res; ··· 3118 3117 u32 cid; 3119 3118 u8 rev; 3120 3119 3121 - clk = clk_get(&pdev->dev, NULL); 3120 + clk = clk_get(dev, NULL); 3122 3121 if (IS_ERR(clk)) { 3123 - d40_err(&pdev->dev, "No matching clock found\n"); 3122 + d40_err(dev, "No matching clock found\n"); 3124 3123 goto check_prepare_enabled; 3125 3124 } 3126 3125 3127 3126 clk_ret = clk_prepare_enable(clk); 3128 3127 if (clk_ret) { 3129 - d40_err(&pdev->dev, "Failed to prepare/enable clock\n"); 3128 + d40_err(dev, "Failed to prepare/enable clock\n"); 3130 3129 goto disable_unprepare; 3131 3130 } 3132 3131 ··· 3152 3151 & 255) << (i * 8); 3153 3152 3154 3153 if (cid != AMBA_CID) { 3155 - d40_err(&pdev->dev, "Unknown hardware! No PrimeCell ID\n"); 3154 + d40_err(dev, "Unknown hardware! No PrimeCell ID\n"); 3156 3155 goto unmap_io; 3157 3156 } 3158 3157 if (AMBA_MANF_BITS(pid) != AMBA_VENDOR_ST) { 3159 - d40_err(&pdev->dev, "Unknown designer! Got %x wanted %x\n", 3158 + d40_err(dev, "Unknown designer! Got %x wanted %x\n", 3160 3159 AMBA_MANF_BITS(pid), 3161 3160 AMBA_VENDOR_ST); 3162 3161 goto unmap_io; ··· 3172 3171 */ 3173 3172 rev = AMBA_REV_BITS(pid); 3174 3173 if (rev < 2) { 3175 - d40_err(&pdev->dev, "hardware revision: %d is not supported", rev); 3174 + d40_err(dev, "hardware revision: %d is not supported", rev); 3176 3175 goto unmap_io; 3177 3176 } 3178 3177 ··· 3190 3189 3191 3190 num_log_chans = num_phy_chans * D40_MAX_LOG_CHAN_PER_PHY; 3192 3191 3193 - dev_info(&pdev->dev, 3192 + dev_info(dev, 3194 3193 "hardware rev: %d @ %pa with %d physical and %d logical channels\n", 3195 3194 rev, &res->start, num_phy_chans, num_log_chans); 3196 3195 ··· 3210 3209 base->phy_size = resource_size(res); 3211 3210 base->virtbase = virtbase; 3212 3211 base->plat_data = plat_data; 3213 - base->dev = &pdev->dev; 3212 + base->dev = dev; 3214 3213 base->phy_chans = ((void *)base) + ALIGN(sizeof(struct d40_base), 4); 3215 3214 base->log_chans = &base->phy_chans[num_phy_chans]; 3216 3215 ··· 3506 3505 3507 3506 static int __init d40_probe(struct platform_device *pdev) 3508 3507 { 3509 - struct stedma40_platform_data *plat_data = dev_get_platdata(&pdev->dev); 3508 + struct device *dev = &pdev->dev; 3509 + struct stedma40_platform_data *plat_data = dev_get_platdata(dev); 3510 3510 struct device_node *np = pdev->dev.of_node; 3511 3511 struct device_node *np_lcpa; 3512 3512 int ret = -ENOENT; ··· 3524 3522 goto report_failure; 3525 3523 } 3526 3524 } else { 3527 - d40_err(&pdev->dev, "No pdata or Device Tree provided\n"); 3525 + d40_err(dev, "No pdata or Device Tree provided\n"); 3528 3526 goto report_failure; 3529 3527 } 3530 3528 } ··· 3543 3541 /* Get IO for logical channel parameter address (LCPA) */ 3544 3542 np_lcpa = of_parse_phandle(np, "sram", 0); 3545 3543 if (!np_lcpa) { 3546 - dev_err(&pdev->dev, "no LCPA SRAM node\n"); 3544 + dev_err(dev, "no LCPA SRAM node\n"); 3547 3545 goto report_failure; 3548 3546 } 3549 3547 /* This is no device so read the address directly from the node */ 3550 3548 ret = of_address_to_resource(np_lcpa, 0, &res_lcpa); 3551 3549 if (ret) { 3552 - dev_err(&pdev->dev, "no LCPA SRAM resource\n"); 3550 + dev_err(dev, "no LCPA SRAM resource\n"); 3553 3551 goto report_failure; 3554 3552 } 3555 3553 base->lcpa_size = resource_size(&res_lcpa); 3556 3554 base->phy_lcpa = res_lcpa.start; 3557 - dev_info(&pdev->dev, "found LCPA SRAM at 0x%08x, size 0x%08x\n", 3555 + dev_info(dev, "found LCPA SRAM at 0x%08x, size 0x%08x\n", 3558 3556 (u32)base->phy_lcpa, base->lcpa_size); 3559 3557 3560 3558 /* We make use of ESRAM memory for this. */ 3561 3559 val = readl(base->virtbase + D40_DREG_LCPA); 3562 3560 if (base->phy_lcpa != val && val != 0) { 3563 - dev_warn(&pdev->dev, 3561 + dev_warn(dev, 3564 3562 "[%s] Mismatch LCPA dma 0x%x, def %08x\n", 3565 3563 __func__, val, (u32)base->phy_lcpa); 3566 3564 } else ··· 3569 3567 base->lcpa_base = ioremap(base->phy_lcpa, base->lcpa_size); 3570 3568 if (!base->lcpa_base) { 3571 3569 ret = -ENOMEM; 3572 - d40_err(&pdev->dev, "Failed to ioremap LCPA region\n"); 3570 + d40_err(dev, "Failed to ioremap LCPA region\n"); 3573 3571 goto release_base; 3574 3572 } 3575 3573 /* If lcla has to be located in ESRAM we don't need to allocate */ ··· 3578 3576 "lcla_esram"); 3579 3577 if (!res) { 3580 3578 ret = -ENOENT; 3581 - d40_err(&pdev->dev, 3579 + d40_err(dev, 3582 3580 "No \"lcla_esram\" memory resource\n"); 3583 3581 goto destroy_cache; 3584 3582 } ··· 3586 3584 resource_size(res)); 3587 3585 if (!base->lcla_pool.base) { 3588 3586 ret = -ENOMEM; 3589 - d40_err(&pdev->dev, "Failed to ioremap LCLA region\n"); 3587 + d40_err(dev, "Failed to ioremap LCLA region\n"); 3590 3588 goto destroy_cache; 3591 3589 } 3592 3590 writel(res->start, base->virtbase + D40_DREG_LCLA); ··· 3594 3592 } else { 3595 3593 ret = d40_lcla_allocate(base); 3596 3594 if (ret) { 3597 - d40_err(&pdev->dev, "Failed to allocate LCLA area\n"); 3595 + d40_err(dev, "Failed to allocate LCLA area\n"); 3598 3596 goto destroy_cache; 3599 3597 } 3600 3598 } ··· 3605 3603 3606 3604 ret = request_irq(base->irq, d40_handle_interrupt, 0, D40_NAME, base); 3607 3605 if (ret) { 3608 - d40_err(&pdev->dev, "No IRQ defined\n"); 3606 + d40_err(dev, "No IRQ defined\n"); 3609 3607 goto destroy_cache; 3610 3608 } 3611 3609 ··· 3613 3611 3614 3612 base->lcpa_regulator = regulator_get(base->dev, "lcla_esram"); 3615 3613 if (IS_ERR(base->lcpa_regulator)) { 3616 - d40_err(&pdev->dev, "Failed to get lcpa_regulator\n"); 3614 + d40_err(dev, "Failed to get lcpa_regulator\n"); 3617 3615 ret = PTR_ERR(base->lcpa_regulator); 3618 3616 base->lcpa_regulator = NULL; 3619 3617 goto destroy_cache; ··· 3621 3619 3622 3620 ret = regulator_enable(base->lcpa_regulator); 3623 3621 if (ret) { 3624 - d40_err(&pdev->dev, 3622 + d40_err(dev, 3625 3623 "Failed to enable lcpa_regulator\n"); 3626 3624 regulator_put(base->lcpa_regulator); 3627 3625 base->lcpa_regulator = NULL; ··· 3644 3642 3645 3643 ret = dma_set_max_seg_size(base->dev, STEDMA40_MAX_SEG_SIZE); 3646 3644 if (ret) { 3647 - d40_err(&pdev->dev, "Failed to set dma max seg size\n"); 3645 + d40_err(dev, "Failed to set dma max seg size\n"); 3648 3646 goto destroy_cache; 3649 3647 } 3650 3648 ··· 3653 3651 if (np) { 3654 3652 ret = of_dma_controller_register(np, d40_xlate, NULL); 3655 3653 if (ret) 3656 - dev_err(&pdev->dev, 3654 + dev_err(dev, 3657 3655 "could not register of_dma_controller\n"); 3658 3656 } 3659 3657 ··· 3703 3701 kfree(base->phy_res); 3704 3702 kfree(base); 3705 3703 report_failure: 3706 - d40_err(&pdev->dev, "probe failed\n"); 3704 + d40_err(dev, "probe failed\n"); 3707 3705 return ret; 3708 3706 } 3709 3707