Re: [PATCH for review] [12/48] x86_64: use the global PIT lock

From: Andi Kleen
Date: Fri Jul 20 2007 - 04:30:58 EST



> +static DEFINE_SPINLOCK(i8253_lock);
> +
>  static __init int add_pcspkr(void)
>  {
>         struct platform_device *pd;
> @@ -1501,9 +1503,14 @@ static __init int add_pcspkr(void)
>         if (!pd)
>                 return -ENOMEM;
>  
> +       pd->dev.platform_data = &i8253_lock;

That seems pretty ugly to pass spinlocks around in void * pointers. Also
out of general memory bloat reasons i don't like allocating big data structures
just for this.

Wouldn't it be better to just define i8253_lock weakly in the pcspkr code and let
the architecture override it?

> Index: work/arch/x86_64/kernel/time.c
> ===================================================================
> --- work.orig/arch/x86_64/kernel/time.c
> +++ work/arch/x86_64/kernel/time.c
> @@ -23,6 +23,7 @@
>  #include <linux/module.h>
>  #include <linux/device.h>
>  #include <linux/sysdev.h>
> +#include <linux/platform_device.h>
>  #include <linux/bcd.h>
>  #include <linux/notifier.h>
>  #include <linux/cpu.h>
> @@ -185,7 +186,7 @@ void main_timer_handler(void)
>                 set_rtc_mmss(xtime.tv_sec);
>                 rtc_update = xtime.tv_sec + 660;
>         }
> -
> +
>         write_sequnlock(&xtime_lock);
>  }

No random white space changes in patches, multiple occurrences ?!?

-Andi

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