Re: [PATCH v9 06/17] h8300: CPU depend helpers

From: Arnd Bergmann
Date: Mon Apr 27 2015 - 04:54:45 EST


On Monday 27 April 2015 14:35:13 Yoshinori Sato wrote:
> +static struct platform_device sci0_device = {
> + .name = "sh-sci",
> + .id = 0,
> + .resource = sci0_resources,
> + .num_resources = ARRAY_SIZE(sci0_resources),
> + .dev = {
> + .platform_data = &sci0_platform_data,
> + },
> +};
> +
> +static struct platform_device sci1_device = {
> + .name = "sh-sci",
> + .id = 1,
> + .resource = sci1_resources,
> + .num_resources = ARRAY_SIZE(sci1_resources),
> + .dev = {
> + .platform_data = &sci1_platform_data,
> + },
> +};

You should generally not define 'platform_device' structure statically.
Generally, all new architectures should pass a dtb blob from the
boot loader that contains the device definitions outside of the
kernel binary.

If you don't expect to use h8300 with a lot of external peripherals,
you can also use platform_device_register_simple() and related functions
to register the platform device here, which lets you remove the
static definition.

> +void __init early_device_init(void)
> +{
> + early_platform_add_devices(early_devices,
> + ARRAY_SIZE(early_devices));
> +}

I would like to eventually remove the early_platform_add_devices()
interface, and use some other mechanism here. Can you try either using
devicetree to probe those devices like ARM does, or just calling into
the drivers manually?

In case of the sci, using the new 'earlycon' framework is probably the
best idea, and for the timer, just call the probe() function directly
instead of going through the whole early_platform_add_devices
and early_platform_driver_probe() dance.

Arnd

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/