Re: [PATCH 2/2] ARM: i.MX8M: convert the machine init to the soc driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24-01-11, Sascha Hauer wrote:
> On Thu, Jan 11, 2024 at 12:51:20PM +0100, Marco Felsch wrote:
> > Convert the i.MX8M machine init code to the previously introduced soc
> > framework. The soc driver was mostly copied from Linux with slightly
> > adaptions for barebox. To the soc driver is called during the
> > postcore_initcall to keep the level aligned with the previous imx_init().
> > 
> > +static int __init imx8_soc_init(void)
> > +{
> > +	struct device_node *of_root = of_get_root_node();
> > +	struct soc_device_attribute *soc_dev_attr;
> > +	struct soc_device *soc_dev;
> > +	const struct of_device_id *id;
> > +	u32 soc_rev = 0;
> > +	const struct imx8_soc_data *data;
> > +	int ret;
> > +
> > +	soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
> > +	if (!soc_dev_attr)
> > +		return -ENOMEM;
> > +
> > +	soc_dev_attr->family = "Freescale i.MX";
> > +
> > +	ret = of_property_read_string(of_root, "model", &soc_dev_attr->machine);
> > +	if (ret)
> > +		goto free_soc;
> > +
> > +	id = of_match_node(imx8_soc_match, of_root);
> > +	if (!id) {
> > +		ret = -ENODEV;
> > +		goto free_soc;
> > +	}
> 
> This is executed as an initcall and as such shouldn't assume it's
> running on an i.MX8. Please check for foreign SoCs early and return
> without an error in that case.

You're right, I will do that.

> > +	soc_dev_attr->serial_number = basprintf("%016llX", soc_uid);
> 
> xasprintf should be fine here.

Okay.

Regards,
  Marco

> 
> Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux