diff options
author | Rob Herring <robh@kernel.org> | 2023-09-01 14:36:49 -0500 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2024-01-19 08:08:53 -0600 |
commit | 5e6c3454b40594c6f1d398254e7b4005494f9638 (patch) | |
tree | 109e2fd97bd35d171bfb98a262b1e0b645d81752 /drivers/net/can/c_can | |
parent | 61c2ef4b6cb019946479baf0aeded648081bfb5c (diff) | |
download | linux-5e6c3454b40594c6f1d398254e7b4005494f9638.tar.gz linux-5e6c3454b40594c6f1d398254e7b4005494f9638.tar.bz2 linux-5e6c3454b40594c6f1d398254e7b4005494f9638.zip |
net: can: 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.
Error checking for matching and match data was not necessary as matching
is always successful if we're already in probe and the match tables always
have data pointers.
Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/net/can/c_can')
-rw-r--r-- | drivers/net/can/c_can/c_can_platform.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c index f44ba2600415..e2ec69aa46e5 100644 --- a/drivers/net/can/c_can/c_can_platform.c +++ b/drivers/net/can/c_can/c_can_platform.c @@ -30,9 +30,9 @@ #include <linux/io.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <linux/property.h> #include <linux/clk.h> #include <linux/of.h> -#include <linux/of_device.h> #include <linux/mfd/syscon.h> #include <linux/regmap.h> @@ -259,22 +259,13 @@ static int c_can_plat_probe(struct platform_device *pdev) void __iomem *addr; struct net_device *dev; struct c_can_priv *priv; - const struct of_device_id *match; struct resource *mem; int irq; struct clk *clk; const struct c_can_driver_data *drvdata; struct device_node *np = pdev->dev.of_node; - match = of_match_device(c_can_of_table, &pdev->dev); - if (match) { - drvdata = match->data; - } else if (pdev->id_entry->driver_data) { - drvdata = (struct c_can_driver_data *) - platform_get_device_id(pdev)->driver_data; - } else { - return -ENODEV; - } + drvdata = device_get_match_data(&pdev->dev); /* get the appropriate clk */ clk = devm_clk_get(&pdev->dev, NULL); |