lkml.org 
[lkml]   [2007]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH for review] [12/48] x86_64: use the global PIT lock
On 7/20/07, Andi Kleen <ak@suse.de> wrote:
>
> > +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.

That spinlock _is_ platform data. We could define

struct pcspkr_platform_data {
spinlock_t *lock;
};

and pass around this as the rest of platform code does but then we'd
need a header file and it would add a level of indirection but if you
like this better I can change it. Otherwise spinlock is another data
structure and we pass them around all teh time.

> Also
> out of general memory bloat reasons i don't like allocating big data structures
> just for this.
>

I am not sure where you see new data structure allocation... If you
look at your box you should see that /sys/bus/platform/devices/pcspkr
device is already there. We already create it so that pcspkr driver
can bind to it.

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

Yes, it probably is btetter.

>
> > 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 ?!?
>

By bad, sorry.

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

\
 
 \ /
  Last update: 2007-07-20 14:55    [W:0.083 / U:0.536 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site