mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-20 07:09:58 +00:00
dmaengine: Use device_get_match_data()
Use preferred device_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20231006213844.333027-1-robh@kernel.org Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
0481291f0c
commit
a67ba97dfb
@ -13,13 +13,11 @@
|
|||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_device.h>
|
|
||||||
#include <linux/of_address.h>
|
|
||||||
#include <linux/of_irq.h>
|
|
||||||
#include <linux/of_dma.h>
|
#include <linux/of_dma.h>
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-mapping.h>
|
||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
#include <linux/pm_domain.h>
|
#include <linux/pm_domain.h>
|
||||||
|
#include <linux/property.h>
|
||||||
|
|
||||||
#include "fsl-edma-common.h"
|
#include "fsl-edma-common.h"
|
||||||
|
|
||||||
@ -414,8 +412,6 @@ static int fsl_edma3_attach_pd(struct platform_device *pdev, struct fsl_edma_eng
|
|||||||
|
|
||||||
static int fsl_edma_probe(struct platform_device *pdev)
|
static int fsl_edma_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
const struct of_device_id *of_id =
|
|
||||||
of_match_device(fsl_edma_dt_ids, &pdev->dev);
|
|
||||||
struct device_node *np = pdev->dev.of_node;
|
struct device_node *np = pdev->dev.of_node;
|
||||||
struct fsl_edma_engine *fsl_edma;
|
struct fsl_edma_engine *fsl_edma;
|
||||||
const struct fsl_edma_drvdata *drvdata = NULL;
|
const struct fsl_edma_drvdata *drvdata = NULL;
|
||||||
@ -424,8 +420,7 @@ static int fsl_edma_probe(struct platform_device *pdev)
|
|||||||
int chans;
|
int chans;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
|
|
||||||
if (of_id)
|
drvdata = device_get_match_data(&pdev->dev);
|
||||||
drvdata = of_id->data;
|
|
||||||
if (!drvdata) {
|
if (!drvdata) {
|
||||||
dev_err(&pdev->dev, "unable to find driver data\n");
|
dev_err(&pdev->dev, "unable to find driver data\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/dmaengine.h>
|
#include <linux/dmaengine.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
|
#include <linux/property.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/genalloc.h>
|
#include <linux/genalloc.h>
|
||||||
#include <linux/of_device.h>
|
|
||||||
#include <linux/of_dma.h>
|
#include <linux/of_dma.h>
|
||||||
|
|
||||||
#include "dmaengine.h"
|
#include "dmaengine.h"
|
||||||
@ -642,11 +642,7 @@ static int mmp_tdma_probe(struct platform_device *pdev)
|
|||||||
int chan_num = TDMA_CHANNEL_NUM;
|
int chan_num = TDMA_CHANNEL_NUM;
|
||||||
struct gen_pool *pool = NULL;
|
struct gen_pool *pool = NULL;
|
||||||
|
|
||||||
of_id = of_match_device(mmp_tdma_dt_ids, &pdev->dev);
|
type = (enum mmp_tdma_type)device_get_match_data(&pdev->dev);
|
||||||
if (of_id)
|
|
||||||
type = (uintptr_t) of_id->data;
|
|
||||||
else
|
|
||||||
type = platform_get_device_id(pdev)->driver_data;
|
|
||||||
|
|
||||||
/* always have couple channels */
|
/* always have couple channels */
|
||||||
tdev = devm_kzalloc(&pdev->dev, sizeof(*tdev), GFP_KERNEL);
|
tdev = devm_kzalloc(&pdev->dev, sizeof(*tdev), GFP_KERNEL);
|
||||||
@ -724,32 +720,22 @@ static int mmp_tdma_probe(struct platform_device *pdev)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pdev->dev.of_node) {
|
|
||||||
ret = of_dma_controller_register(pdev->dev.of_node,
|
ret = of_dma_controller_register(pdev->dev.of_node,
|
||||||
mmp_tdma_xlate, tdev);
|
mmp_tdma_xlate, tdev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(tdev->device.dev,
|
dev_err(tdev->device.dev, "failed to register controller\n");
|
||||||
"failed to register controller\n");
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
dev_info(tdev->device.dev, "initialized\n");
|
dev_info(tdev->device.dev, "initialized\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct platform_device_id mmp_tdma_id_table[] = {
|
|
||||||
{ "mmp-adma", MMP_AUD_TDMA },
|
|
||||||
{ "pxa910-squ", PXA910_SQU },
|
|
||||||
{ },
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct platform_driver mmp_tdma_driver = {
|
static struct platform_driver mmp_tdma_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "mmp-tdma",
|
.name = "mmp-tdma",
|
||||||
.of_match_table = mmp_tdma_dt_ids,
|
.of_match_table = mmp_tdma_dt_ids,
|
||||||
},
|
},
|
||||||
.id_table = mmp_tdma_id_table,
|
|
||||||
.probe = mmp_tdma_probe,
|
.probe = mmp_tdma_probe,
|
||||||
.remove_new = mmp_tdma_remove,
|
.remove_new = mmp_tdma_remove,
|
||||||
};
|
};
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-mapping.h>
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/of_device.h>
|
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
|
#include <linux/property.h>
|
||||||
#include <linux/memory.h>
|
#include <linux/memory.h>
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
@ -1328,13 +1328,8 @@ static int mv_xor_probe(struct platform_device *pdev)
|
|||||||
* setting up. In non-dt case it can only be the legacy one.
|
* setting up. In non-dt case it can only be the legacy one.
|
||||||
*/
|
*/
|
||||||
xordev->xor_type = XOR_ORION;
|
xordev->xor_type = XOR_ORION;
|
||||||
if (pdev->dev.of_node) {
|
if (pdev->dev.of_node)
|
||||||
const struct of_device_id *of_id =
|
xordev->xor_type = (uintptr_t)device_get_match_data(&pdev->dev);
|
||||||
of_match_device(mv_xor_dt_ids,
|
|
||||||
&pdev->dev);
|
|
||||||
|
|
||||||
xordev->xor_type = (uintptr_t)of_id->data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (Re-)program MBUS remapping windows if we are asked to.
|
* (Re-)program MBUS remapping windows if we are asked to.
|
||||||
|
@ -10,9 +10,10 @@
|
|||||||
|
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_dma.h>
|
#include <linux/of_dma.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
|
#include <linux/property.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/remoteproc.h>
|
#include <linux/remoteproc.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
@ -739,18 +740,11 @@ static void st_fdma_free(struct st_fdma_dev *fdev)
|
|||||||
static int st_fdma_probe(struct platform_device *pdev)
|
static int st_fdma_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct st_fdma_dev *fdev;
|
struct st_fdma_dev *fdev;
|
||||||
const struct of_device_id *match;
|
|
||||||
struct device_node *np = pdev->dev.of_node;
|
struct device_node *np = pdev->dev.of_node;
|
||||||
const struct st_fdma_driverdata *drvdata;
|
const struct st_fdma_driverdata *drvdata;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
|
|
||||||
match = of_match_device((st_fdma_match), &pdev->dev);
|
drvdata = device_get_match_data(&pdev->dev);
|
||||||
if (!match || !match->data) {
|
|
||||||
dev_err(&pdev->dev, "No device match found\n");
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
drvdata = match->data;
|
|
||||||
|
|
||||||
fdev = devm_kzalloc(&pdev->dev, sizeof(*fdev), GFP_KERNEL);
|
fdev = devm_kzalloc(&pdev->dev, sizeof(*fdev), GFP_KERNEL);
|
||||||
if (!fdev)
|
if (!fdev)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user