All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Peng Fan <peng.fan@nxp.com>
Cc: Aisheng Dong <aisheng.dong@nxp.com>,
	Horia Geanta <horia.geanta@nxp.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	dl-linux-imx <linux-imx@nxp.com>,
	Sascha Hauer <kernel@pengutronix.de>,
	Leonard Crestez <leonard.crestez@nxp.com>,
	Shawn Guo <shawnguo@kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] soc: imx: check ls1021a
Date: Mon, 20 Jul 2020 14:33:34 +0200	[thread overview]
Message-ID: <CAK8P3a0kbLtW8K-YgTzdJsaYSUbQP2Q9oa+smgQg828_FBKBhg@mail.gmail.com> (raw)
In-Reply-To: <DB6PR0402MB276014CC3E4B024776799F85887B0@DB6PR0402MB2760.eurprd04.prod.outlook.com>

On Mon, Jul 20, 2020 at 11:01 AM Peng Fan <peng.fan@nxp.com> wrote:
> > Subject: Re: [PATCH] soc: imx: check ls1021a
> > On Mon, Jul 20, 2020 at 8:30 AM Peng Fan <peng.fan@nxp.com> wrote:
> > > > Subject: Re: [PATCH] soc: imx: check ls1021a

> > If you cannot do that here (e.g. because you need the soc_device to be
> > present very early), then you have to manually check for some DT node and
> > property to determine whether you run on an i.MX machine and do the silent
> > 'return 0' if not.
> > This is roughly what you did when you checked for one specific non-i.MX
> > machine, but since you cannot provide an exhaustive list of all non-i.MX
> > machines (a denylist) you have to provide some for of allowlist.
>
> Is the following diff ok for you?
> Actually all i.MX SoCs will set __mxc_cpu_type. If it is not a valid
> one, just return.
>
> diff --git a/drivers/soc/imx/soc-imx.c b/drivers/soc/imx/soc-imx.c
> index 01bfea1cb64a..e55225a85592 100644
> --- a/drivers/soc/imx/soc-imx.c
> +++ b/drivers/soc/imx/soc-imx.c
> @@ -33,9 +33,6 @@ static int __init imx_soc_device_init(void)
>         u32 val;
>         int ret;
>
> -       if (of_machine_is_compatible("fsl,ls1021a"))
> -               return 0;
> -
>         soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
>         if (!soc_dev_attr)
>                 return -ENOMEM;

This means the driver still has to allocate and then free the structure,
as well as lookup some DT properties.

> @@ -131,6 +128,8 @@ static int __init imx_soc_device_init(void)
>                 break;
>         default:
>                 soc_id = "Unknown";
> +               ret = 0;
> +               goto free_soc;
>         }
>         soc_dev_attr->soc_id = soc_id;

I took a closer look at where this information comes from. As the
__mxc_cpu_type variable seems to just be initialized to zero until
set explicitly, I guess the easiest way would be to change the
of_machine_is_compatible() check to 'if (!__mxc_cpu_type)'.

       Arnd

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2020-07-20 12:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09  8:25 [PATCH] soc: imx: check ls1021a peng.fan
2020-07-10 10:32 ` Horia Geantă
2020-07-10 14:05 ` Fabio Estevam
2020-07-13  8:28 ` Shawn Guo
2020-07-17 16:19 ` Arnd Bergmann
2020-07-20  6:30   ` Peng Fan
2020-07-20  7:01     ` Arnd Bergmann
2020-07-20  7:05       ` Peng Fan
2020-07-20  7:19         ` Arnd Bergmann
2020-07-20  9:01       ` Peng Fan
2020-07-20 12:33         ` Arnd Bergmann [this message]

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=CAK8P3a0kbLtW8K-YgTzdJsaYSUbQP2Q9oa+smgQg828_FBKBhg@mail.gmail.com \
    --to=arnd@arndb.de \
    --cc=aisheng.dong@nxp.com \
    --cc=horia.geanta@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=leonard.crestez@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=peng.fan@nxp.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.