Re: [PATCH] memory: Use device_get_match_data()
From: Krzysztof Kozlowski
Date: Sun Oct 08 2023 - 07:33:42 EST
On 07/10/2023 00:44, Rob Herring wrote:
> 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@xxxxxxxxxx>
> ---
...
> enum ccf_version {
> CCF1,
> @@ -172,14 +170,9 @@ static irqreturn_t ccf_irq(int irq, void *dev_id)
> static int ccf_probe(struct platform_device *pdev)
> {
> struct ccf_private *ccf;
> - const struct of_device_id *match;
> u32 errinten;
> int ret, irq;
>
> - match = of_match_device(ccf_matches, &pdev->dev);
> - if (WARN_ON(!match))
> - return -ENODEV;
> -
> ccf = devm_kzalloc(&pdev->dev, sizeof(*ccf), GFP_KERNEL);
> if (!ccf)
> return -ENOMEM;
> @@ -189,7 +182,7 @@ static int ccf_probe(struct platform_device *pdev)
> return PTR_ERR(ccf->regs);
>
> ccf->dev = &pdev->dev;
> - ccf->info = match->data;
> + ccf->info = device_get_match_data(&pdev->dev);
This part is no equivalent. You miss here if (WARN_ON(!ccf->info)).
> ccf->err_regs = ccf->regs + ccf->info->err_reg_offs;
>
> if (ccf->info->has_brr) {
Best regards,
Krzysztof