openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Joel Stanley <joel@jms.id.au>
To: Jammy Huang <jammy_huang@aspeedtech.com>
Cc: linux-aspeed <linux-aspeed@lists.ozlabs.org>,
	Andrew Jeffery <andrew@aj.id.au>,
	OpenBMC Maillist <openbmc@lists.ozlabs.org>,
	Eddie James <eajames@linux.ibm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH] media: aspeed: Use of_device_get_match_data() helper
Date: Mon, 14 Feb 2022 06:34:54 +0000	[thread overview]
Message-ID: <CACPK8XcLJuWitefi8LTAxDrhzAVe3b88haQYAJRLX5M=ceDg5g@mail.gmail.com> (raw)
In-Reply-To: <20220214032708.854-1-jammy_huang@aspeedtech.com>

On Mon, 14 Feb 2022 at 03:27, Jammy Huang <jammy_huang@aspeedtech.com> wrote:
>
> Use of_device_get_match_data() to simplify the code.
>
> Signed-off-by: Jammy Huang <jammy_huang@aspeedtech.com>
> ---
>  drivers/media/platform/aspeed-video.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c
> index 3904ded2052a..d4acf84cda9b 100644
> --- a/drivers/media/platform/aspeed-video.c
> +++ b/drivers/media/platform/aspeed-video.c
> @@ -13,6 +13,7 @@
>  #include <linux/module.h>
>  #include <linux/mutex.h>
>  #include <linux/of.h>
> +#include <linux/of_device.h>
>  #include <linux/of_irq.h>
>  #include <linux/of_reserved_mem.h>
>  #include <linux/platform_device.h>
> @@ -2451,7 +2452,6 @@ MODULE_DEVICE_TABLE(of, aspeed_video_of_match);
>  static int aspeed_video_probe(struct platform_device *pdev)
>  {
>         const struct aspeed_video_config *config;
> -       const struct of_device_id *match;
>         struct aspeed_video *video;
>         int rc;
>
> @@ -2463,11 +2463,7 @@ static int aspeed_video_probe(struct platform_device *pdev)
>         if (IS_ERR(video->base))
>                 return PTR_ERR(video->base);
>
> -       match = of_match_node(aspeed_video_of_match, pdev->dev.of_node);
> -       if (!match)
> -               return -EINVAL;
> -
> -       config = match->data;
> +       config = of_device_get_match_data(&pdev->dev);

While normally this driver won't have probed without matching on some
data, it would be sensible to add a check for a null pointer here.

>         video->version = config->version;
>         video->jpeg_mode = config->jpeg_mode;
>         video->comp_size_read = config->comp_size_read;
> --
> 2.25.1
>

  reply	other threads:[~2022-02-14  6:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14  3:27 [PATCH] media: aspeed: Use of_device_get_match_data() helper Jammy Huang
2022-02-14  6:34 ` Joel Stanley [this message]
2022-02-14  8:05   ` Jammy Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACPK8XcLJuWitefi8LTAxDrhzAVe3b88haQYAJRLX5M=ceDg5g@mail.gmail.com' \
    --to=joel@jms.id.au \
    --cc=andrew@aj.id.au \
    --cc=eajames@linux.ibm.com \
    --cc=jammy_huang@aspeedtech.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).