Re: [patch][resend] provide rtc_cmos platform device, take 2

From: David Brownell
Date: Thu May 29 2008 - 02:27:21 EST


On Tuesday 27 May 2008, Stas Sergeev wrote:
> --- a/arch/x86/kernel/rtc.c
> +++ b/arch/x86/kernel/rtc.c
> @@ -4,9 +4,12 @@
>  #include <linux/acpi.h>
>  #include <linux/bcd.h>
>  #include <linux/mc146818rtc.h>
> +#include <linux/platform_device.h>
> +#include <linux/pnp.h>
>  
>  #include <asm/time.h>
>  #include <asm/vsyscall.h>
> +#include <asm/mc146818rtc.h>

The <asm/mc146818rtc.h> isn't needed, since it's automatically
included via <linux/mc146818rtc.h> ... see right at the top.

And for good fun, notice how the asm file includes the linux
version ... seems like a cleanup would be nice someday. :)


> --- a/drivers/rtc/rtc-cmos.c
> +++ b/drivers/rtc/rtc-cmos.c

> @@ -958,20 +946,33 @@ static struct platform_driver cmos_platform_driver = {
>  
>  static int __init cmos_init(void)
>  {
> +#ifdef CONFIG_PNP
> +       if (pnp_platform_devices)
> +               return pnp_register_driver(&cmos_pnp_driver);
> +       else
> +               return platform_driver_probe(&cmos_platform_driver,
> +                       cmos_platform_probe);
> +#else
>         return platform_driver_probe(&cmos_platform_driver,
>                         cmos_platform_probe);
> +#endif /* CONFIG_PNP */
>  }
>  module_init(cmos_init);

That's kind of ugly, but not wrong.

My only question is whether that resolves the problem Russell was
reporting. I think his situation needed to register *both* types
of bus glue (but I never saw his patch). If we're going to fix this,
best merge just one patch...

- Dave


--
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/