platform.c (a23e1966932464e1c5226cb9ac4ce1d5fc10ba22) | platform.c (2ebc36b9581df31eed271e5de61fc8a8b66dbc56) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Platform driver for the Synopsys DesignWare DMA Controller 4 * 5 * Copyright (C) 2007-2008 Atmel Corporation 6 * Copyright (C) 2010-2011 ST Microelectronics 7 * Copyright (C) 2013 Intel Corporation 8 * --- 15 unchanged lines hidden (view full) --- 24#define DRV_NAME "dw_dmac" 25 26static int dw_probe(struct platform_device *pdev) 27{ 28 const struct dw_dma_chip_pdata *match; 29 struct dw_dma_chip_pdata *data; 30 struct dw_dma_chip *chip; 31 struct device *dev = &pdev->dev; | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Platform driver for the Synopsys DesignWare DMA Controller 4 * 5 * Copyright (C) 2007-2008 Atmel Corporation 6 * Copyright (C) 2010-2011 ST Microelectronics 7 * Copyright (C) 2013 Intel Corporation 8 * --- 15 unchanged lines hidden (view full) --- 24#define DRV_NAME "dw_dmac" 25 26static int dw_probe(struct platform_device *pdev) 27{ 28 const struct dw_dma_chip_pdata *match; 29 struct dw_dma_chip_pdata *data; 30 struct dw_dma_chip *chip; 31 struct device *dev = &pdev->dev; |
32 int err; | 32 int ret; |
33 34 match = device_get_match_data(dev); 35 if (!match) 36 return -ENODEV; 37 38 data = devm_kmemdup(&pdev->dev, match, sizeof(*match), GFP_KERNEL); 39 if (!data) 40 return -ENOMEM; --- 5 unchanged lines hidden (view full) --- 46 chip->irq = platform_get_irq(pdev, 0); 47 if (chip->irq < 0) 48 return chip->irq; 49 50 chip->regs = devm_platform_ioremap_resource(pdev, 0); 51 if (IS_ERR(chip->regs)) 52 return PTR_ERR(chip->regs); 53 | 33 34 match = device_get_match_data(dev); 35 if (!match) 36 return -ENODEV; 37 38 data = devm_kmemdup(&pdev->dev, match, sizeof(*match), GFP_KERNEL); 39 if (!data) 40 return -ENOMEM; --- 5 unchanged lines hidden (view full) --- 46 chip->irq = platform_get_irq(pdev, 0); 47 if (chip->irq < 0) 48 return chip->irq; 49 50 chip->regs = devm_platform_ioremap_resource(pdev, 0); 51 if (IS_ERR(chip->regs)) 52 return PTR_ERR(chip->regs); 53 |
54 err = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 55 if (err) 56 return err; | 54 ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 55 if (ret) 56 return ret; |
57 58 if (!data->pdata) 59 data->pdata = dev_get_platdata(dev); 60 if (!data->pdata) 61 data->pdata = dw_dma_parse_dt(pdev); 62 63 chip->dev = dev; 64 chip->id = pdev->id; 65 chip->pdata = data->pdata; 66 67 data->chip = chip; 68 69 chip->clk = devm_clk_get_optional(chip->dev, "hclk"); 70 if (IS_ERR(chip->clk)) 71 return PTR_ERR(chip->clk); | 57 58 if (!data->pdata) 59 data->pdata = dev_get_platdata(dev); 60 if (!data->pdata) 61 data->pdata = dw_dma_parse_dt(pdev); 62 63 chip->dev = dev; 64 chip->id = pdev->id; 65 chip->pdata = data->pdata; 66 67 data->chip = chip; 68 69 chip->clk = devm_clk_get_optional(chip->dev, "hclk"); 70 if (IS_ERR(chip->clk)) 71 return PTR_ERR(chip->clk); |
72 err = clk_prepare_enable(chip->clk); 73 if (err) 74 return err; | 72 ret = clk_prepare_enable(chip->clk); 73 if (ret) 74 return ret; |
75 76 pm_runtime_enable(&pdev->dev); 77 | 75 76 pm_runtime_enable(&pdev->dev); 77 |
78 err = data->probe(chip); 79 if (err) | 78 ret = data->probe(chip); 79 if (ret) |
80 goto err_dw_dma_probe; 81 82 platform_set_drvdata(pdev, data); 83 84 dw_dma_of_controller_register(chip->dw); 85 86 dw_dma_acpi_controller_register(chip->dw); 87 88 return 0; 89 90err_dw_dma_probe: 91 pm_runtime_disable(&pdev->dev); 92 clk_disable_unprepare(chip->clk); | 80 goto err_dw_dma_probe; 81 82 platform_set_drvdata(pdev, data); 83 84 dw_dma_of_controller_register(chip->dw); 85 86 dw_dma_acpi_controller_register(chip->dw); 87 88 return 0; 89 90err_dw_dma_probe: 91 pm_runtime_disable(&pdev->dev); 92 clk_disable_unprepare(chip->clk); |
93 return err; | 93 return ret; |
94} 95 96static void dw_remove(struct platform_device *pdev) 97{ 98 struct dw_dma_chip_pdata *data = platform_get_drvdata(pdev); 99 struct dw_dma_chip *chip = data->chip; 100 int ret; 101 --- 117 unchanged lines hidden --- | 94} 95 96static void dw_remove(struct platform_device *pdev) 97{ 98 struct dw_dma_chip_pdata *data = platform_get_drvdata(pdev); 99 struct dw_dma_chip *chip = data->chip; 100 int ret; 101 --- 117 unchanged lines hidden --- |