2023-10-09 21:14:23

by Rob Herring (Arm)

[permalink] [raw]
Subject: [PATCH] media: stm32-dcmi: Drop unnecessary of_match_device() call

If probe is reached, we've already matched the device and in the case of
DT matching, the struct device_node pointer will be set. Therefore, there
is no need to call of_match_device() in probe.

Signed-off-by: Rob Herring <[email protected]>
---
drivers/media/platform/st/stm32/stm32-dcmi.c | 8 --------
1 file changed, 8 deletions(-)

diff --git a/drivers/media/platform/st/stm32/stm32-dcmi.c b/drivers/media/platform/st/stm32/stm32-dcmi.c
index 8cb4fdcae137..48140fdf40bb 100644
--- a/drivers/media/platform/st/stm32/stm32-dcmi.c
+++ b/drivers/media/platform/st/stm32/stm32-dcmi.c
@@ -20,7 +20,6 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
-#include <linux/of_device.h>
#include <linux/of_graph.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
@@ -1890,7 +1889,6 @@ static int dcmi_graph_init(struct stm32_dcmi *dcmi)
static int dcmi_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
- const struct of_device_id *match = NULL;
struct v4l2_fwnode_endpoint ep = { .bus_type = 0 };
struct stm32_dcmi *dcmi;
struct vb2_queue *q;
@@ -1899,12 +1897,6 @@ static int dcmi_probe(struct platform_device *pdev)
struct clk *mclk;
int ret = 0;

- match = of_match_device(of_match_ptr(stm32_dcmi_of_match), &pdev->dev);
- if (!match) {
- dev_err(&pdev->dev, "Could not find a match in devicetree\n");
- return -ENODEV;
- }
-
dcmi = devm_kzalloc(&pdev->dev, sizeof(struct stm32_dcmi), GFP_KERNEL);
if (!dcmi)
return -ENOMEM;
--
2.42.0


2023-10-10 07:59:58

by Alain Volmat

[permalink] [raw]
Subject: Re: [Linux-stm32] [PATCH] media: stm32-dcmi: Drop unnecessary of_match_device() call

Hi Rob,

thanks for the patch.

Acked-by: Alain Volmat <[email protected]>

Regards,
Alain

On Mon, Oct 09, 2023 at 04:13:32PM -0500, Rob Herring wrote:
> If probe is reached, we've already matched the device and in the case of
> DT matching, the struct device_node pointer will be set. Therefore, there
> is no need to call of_match_device() in probe.
>
> Signed-off-by: Rob Herring <[email protected]>
> ---
> drivers/media/platform/st/stm32/stm32-dcmi.c | 8 --------
> 1 file changed, 8 deletions(-)
>
> diff --git a/drivers/media/platform/st/stm32/stm32-dcmi.c b/drivers/media/platform/st/stm32/stm32-dcmi.c
> index 8cb4fdcae137..48140fdf40bb 100644
> --- a/drivers/media/platform/st/stm32/stm32-dcmi.c
> +++ b/drivers/media/platform/st/stm32/stm32-dcmi.c
> @@ -20,7 +20,6 @@
> #include <linux/kernel.h>
> #include <linux/module.h>
> #include <linux/of.h>
> -#include <linux/of_device.h>
> #include <linux/of_graph.h>
> #include <linux/pinctrl/consumer.h>
> #include <linux/platform_device.h>
> @@ -1890,7 +1889,6 @@ static int dcmi_graph_init(struct stm32_dcmi *dcmi)
> static int dcmi_probe(struct platform_device *pdev)
> {
> struct device_node *np = pdev->dev.of_node;
> - const struct of_device_id *match = NULL;
> struct v4l2_fwnode_endpoint ep = { .bus_type = 0 };
> struct stm32_dcmi *dcmi;
> struct vb2_queue *q;
> @@ -1899,12 +1897,6 @@ static int dcmi_probe(struct platform_device *pdev)
> struct clk *mclk;
> int ret = 0;
>
> - match = of_match_device(of_match_ptr(stm32_dcmi_of_match), &pdev->dev);
> - if (!match) {
> - dev_err(&pdev->dev, "Could not find a match in devicetree\n");
> - return -ENODEV;
> - }
> -
> dcmi = devm_kzalloc(&pdev->dev, sizeof(struct stm32_dcmi), GFP_KERNEL);
> if (!dcmi)
> return -ENOMEM;
> --
> 2.42.0
>
> _______________________________________________
> Linux-stm32 mailing list
> [email protected]
> https://st-md-mailman.stormreply.com/mailman/listinfo/linux-stm32