[no subject]
Bcc: Subject: Re: [PATCH 1/2] atomic.h atomic64_t standardization Reply-To: In-Reply-To: <[EMAIL PROTECTED]> X-Editor: vi X-Info: http://krystal.dyndns.org:8080 X-Operating-System: Linux/2.4.32-grsec (i686) X-Uptime: 16:08:44 up 100 days, 18:16, 5 users, load average: 0.90, 0.63, 0.52 Hi, I finalized the work for atomic64_t cmpxchg and atomic64_add_unless on all architectures. asm-generic/atomic.h atomic_long_t is also streamlined. Review is welcome. Mathieu ---BEGIN--- --- a/include/asm-alpha/atomic.h +++ b/include/asm-alpha/atomic.h @@ -175,19 +175,64 @@ static __inline__ long atomic64_sub_retu return result; } -#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) +#define atomic64_cmpxchg(v, old, new) \ + ((__typeof__((v)->counter))cmpxchg(&((v)->counter), old, new)) +#define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) + +#define atomic_cmpxchg(v, old, new) \ + ((__typeof__((v)->counter))cmpxchg(&((v)->counter), old, new)) #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) +/** + * atomic_add_unless - add unless the number is a given value + * @v: pointer of type atomic_t + * @a: the amount to add to v... + * @u: ...unless v is equal to u. + * + * Atomically adds @a to @v, so long as it was not @u. + * Returns non-zero if @v was not @u, and zero otherwise. + */ #define atomic_add_unless(v, a, u) \ ({ \ - int c, old; \ + __typeof__((v)->counter) c, old;\ c = atomic_read(v); \ - while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ + for (;;) { \ + if (unlikely(c == (u))) \ + break; \ + old = atomic_cmpxchg((v), c, c + (a)); \ + if (likely(old == c)) \ + break; \ c = old;\ + } \ c != (u); \ }) #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) +/** + * atomic64_add_unless - add unless the number is a given value + * @v: pointer of type atomic64_t + * @a: the amount to add to v... + * @u: ...unless v is equal to u. + * + * Atomically adds @a to @v, so long as it was not @u. + * Returns non-zero if @v was not @u, and zero otherwise. + */ +#define atomic64_add_unless(v, a, u) \ +({ \ + __typeof__((v)->counter) c, old;\ + c = atomic64_read(v); \ + for (;;) { \ + if (unlikely(c == (u))) \ + break; \ + old = atomic64_cmpxchg((v), c, c + (a));\ + if (likely(old == c)) \ + break; \ + c = old;\ + } \ + c != (u); \ +}) +#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) + #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) #define atomic64_add_negative(a, v) (atomic64_add_return((a), (v)) < 0) --- a/include/asm-alpha/system.h +++ b/include/asm-alpha/system.h @@ -443,6 +443,111 @@ #define xchg(ptr,x) \ (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \ }) +static inline unsigned long +__xchg_u8_local(volatile char *m, unsigned long val) +{ + unsigned long ret, tmp, addr64; + + __asm__ __volatile__( + " andnot %4,7,%3\n" + " insbl %1,%4,%1\n" + "1: ldq_l %2,0(%3)\n" + " extbl %2,%4,%0\n" + " mskbl %2,%4,%2\n" + " or %1,%2,%2\n" + " stq_c %2,0(%3)\n" + " beq %2,2f\n" + ".subsection 2\n" + "2: br 1b\n" + ".previous" + : "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64) + : "r" ((long)m), "1" (val) : "memory"); + + return ret; +} + +static inline unsigned long +__xchg_u16_local(volatile short *m, unsigned long val) +{ + unsigned long ret, tmp, addr64; + + __asm__ __volatile__( + " andnot %4,7,%3\n" + " inswl %1,%4,%1\n" + "1: ldq_l %2,0(%3)\n" + " extwl
Re: [patch 4/5] [RFC] Add MMC Password Protection (lock/unlock) support V7: mmc_sysfs.diff
Anderson Briglia wrote: > Hi Pierre, > > ext Pierre Ossman wrote: >> Patch looks ok. But I never got an answer what the difference between >> "change" and "assign" is. > > You're right, the command is the same, but the difference is the > password's > length and password itself sent to the card. > According to MMC spec 4.1, when a password replacement is done, the > length value > (PWD_LEN) shall include both passwords, the old and the new one, and > the password > (PWD) shall include the old (currently) followed by the new password. So shouldn't this be something that userspace handles? -- -- Pierre Ossman Linux kernel, MMC maintainerhttp://www.kernel.org PulseAudio, core developer http://pulseaudio.org rdesktop, core developer http://www.rdesktop.org - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[no subject]
Bcc: Subject: Re: [PATCH 2/2] local.h modifications (all arch support) Reply-To: In-Reply-To: <[EMAIL PROTECTED]> X-Editor: vi X-Info: http://krystal.dyndns.org:8080 X-Operating-System: Linux/2.4.32-grsec (i686) X-Uptime: 16:11:23 up 100 days, 18:19, 5 users, load average: 0.72, 0.62, 0.53 Hi, I also completed the support for all atomic operations in local.h for all architectures. The local_t type is now identical on each architectures : it contains an atomic_long_t field, just like the asm-generic implementation. Please review. Mathieu ---BEGIN--- --- a/include/asm-alpha/local.h +++ b/include/asm-alpha/local.h @@ -4,37 +4,115 @@ #define _ALPHA_LOCAL_H #include #include -typedef atomic64_t local_t; +typedef struct +{ + atomic_long_t a; +} local_t; -#define LOCAL_INIT(i) ATOMIC64_INIT(i) -#define local_read(v) atomic64_read(v) -#define local_set(v,i) atomic64_set(v,i) +#define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) } +#define local_read(l) atomic_long_read(&(l)->a) +#define local_set(l,i) atomic_long_set(&(l)->a, (i)) +#define local_inc(l) atomic_long_inc(&(l)->a) +#define local_dec(l) atomic_long_dec(&(l)->a) +#define local_add(i,l) atomic_long_add((i),(&(l)->a)) +#define local_sub(i,l) atomic_long_sub((i),(&(l)->a)) -#define local_inc(v) atomic64_inc(v) -#define local_dec(v) atomic64_dec(v) -#define local_add(i, v)atomic64_add(i, v) -#define local_sub(i, v)atomic64_sub(i, v) +static __inline__ long local_add_return(long i, local_t * l) +{ + long temp, result; + __asm__ __volatile__( + "1: ldq_l %0,%1\n" + " addq %0,%3,%2\n" + " addq %0,%3,%0\n" + " stq_c %0,%1\n" + " beq %0,2f\n" + ".subsection 2\n" + "2: br 1b\n" + ".previous" + :"=&r" (temp), "=m" (l->a.counter), "=&r" (result) + :"Ir" (i), "m" (l->a.counter) : "memory"); + return result; +} -#define __local_inc(v) ((v)->counter++) -#define __local_dec(v) ((v)->counter++) -#define __local_add(i,v) ((v)->counter+=(i)) -#define __local_sub(i,v) ((v)->counter-=(i)) +static __inline__ long local_sub_return(long i, local_t * v) +{ + long temp, result; + __asm__ __volatile__( + "1: ldq_l %0,%1\n" + " subq %0,%3,%2\n" + " subq %0,%3,%0\n" + " stq_c %0,%1\n" + " beq %0,2f\n" + ".subsection 2\n" + "2: br 1b\n" + ".previous" + :"=&r" (temp), "=m" (l->a.counter), "=&r" (result) + :"Ir" (i), "m" (l->a.counter) : "memory"); + return result; +} + +#define local_cmpxchg(l, old, new) \ + ((long)cmpxchg_local(&((l)->a.counter), old, new)) +#define local_xchg(l, new) (xchg_local(&((l)->a.counter), new)) + +/** + * local_add_unless - add unless the number is a given value + * @l: pointer of type local_t + * @a: the amount to add to l... + * @u: ...unless l is equal to u. + * + * Atomically adds @a to @l, so long as it was not @u. + * Returns non-zero if @l was not @u, and zero otherwise. + */ +#define local_add_unless(l, a, u) \ +({ \ + long c, old;\ + c = local_read(l); \ + for (;;) { \ + if (unlikely(c == (u))) \ + break; \ + old = local_cmpxchg((l), c, c + (a)); \ + if (likely(old == c)) \ + break; \ + c = old;\ + } \ + c != (u); \ +}) +#define local_inc_not_zero(l) local_add_unless((l), 1, 0) + +#define local_add_negative(a, l) (local_add_return((a), (l)) < 0) + +#define local_dec_return(l) local_sub_return(1,(l)) + +#define local_inc_return(l) local_add_return(1,(l)) + +#define local_sub_and_test(i,l) (local_sub_return((i), (l)) == 0) + +#define local_inc_and_test(l) (local_add_return(1, (l)) == 0) + +#define local_dec_and_test(l) (local_sub_return(1, (l)) == 0) + +/* Verify if faster than atomic ops */ +#define __local_inc(l) ((l)->a.counter++) +#define __local_dec(l) ((l)->a.counter++) +#define __local_add(i,l) ((l)->a.counter+=(i)) +#define __local_sub(i,l) ((l)->a.counter-=(i)) /* Use these for per-cpu local_t variables: on some archs they are * much more efficient than these naive implementations. Note they take * a variable, not an address. */ -#define cpu_local_read(v) local_read(&__get_cpu_var(v)) -#define cpu_local_set(v, i)local_set(&__get_cpu_var(v), (i)) - -#define cpu_local_inc(v) local_inc(&__get_cpu_var(v))
Re: [patch 5/5] [RFC] Add MMC Password Protection (lock/unlock) support V7: mmc_omap_dma.diff
Anderson Briglia wrote: > > This patch is needed only for lock/unlock commands. So, it's necessary to > make MMC omap works when using that feature. It's not a generic patch. > But I can take off this one from the series and send after (if) the > series > is integrated. > The patches are marked "[RFC]" which I interpret as that I shouldn't merge it. Is this incorrect? > > frame depends on data->blksz. When we were using data->blksz_bits > everything was > ok because we always had a multiple of 16 bits (2 bytes). Once a pwd > can has a size > not multiple of 2, the value must be rounded. > According to MMC OMAP Technical Reference Manual, because of each DMA > transfer is of > equal size, it is necessary to have the block size of the transfer be > a multiple of > the DMA write access size (which is 2 bytes). > This sounds very generic and not something that is specific to the password command. Rgds -- -- Pierre Ossman Linux kernel, MMC maintainerhttp://www.kernel.org PulseAudio, core developer http://pulseaudio.org rdesktop, core developer http://www.rdesktop.org - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 3/5] [RFC] Add MMC Password Protection (lock/unlock) support V7: mmc_lock_unlock.diff
Anderson Briglia wrote: > ext Pierre Ossman wrote: >> >> This definition makes them look like bits, which is not how they are >> used. > > How can I improve this? Defining using integers directly? > Precisely. Rgds -- -- Pierre Ossman Linux kernel, MMC maintainerhttp://www.kernel.org PulseAudio, core developer http://pulseaudio.org rdesktop, core developer http://www.rdesktop.org - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0 of 2] Add memcpy_cachebypass, a memcpy that doesn't cache reads
Andrew Morton wrote: The name memcpy_cachebypass() doesn't tell us whether it bypasses caching on the source, the dest or both. It'd be nice if it did. Yep, I'll fix that and resubmit. http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC][PATCH] Pseudo-random number generator
Alan <[EMAIL PROTECTED]> wrote: > On Fri, 01 Dec 2006 16:20:46 +0100 > Jan Glauber <[EMAIL PROTECTED]> wrote: >> Yes, a user can just symlink urandom to prandom and will have a faster >> generator. > > > More usefully they can use it as an entropy source with an entropy > daemon to feed it into the standard urandom/random. Only if other users will randomly drain /dev/prandom, otherwise you might as well use /dev/zero. -- Ich danke GMX dafür, die Verwendung meiner Adressen mittels per SPF verbreiteten Lügen zu sabotieren. http://david.woodhou.se/why-not-spf.html - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Implement file posix capabilities
On Thu, Nov 30, 2006 at 04:57:07PM -0600, Serge E. Hallyn wrote: | Quoting Bill O'Donnell ([EMAIL PROTECTED]): | > The memory fault when setfcaps is run as noted in #4 below also occurs | > on RHEL5 IA64 (2.6.18 kernel-2.6.18-1.2747.el5 with Serge's capability patch, | > and Kaigai's userspace tools installed). | > | > On Wed, Nov 29, 2006 at 02:40:13PM -0600, Bill O'Donnell wrote: | > | Once again, running into problems when trying this patch on SLES-10 IA64, | > | (Linux certify 2.6.18 #2 SMP PREEMPT Wed Nov 29 13:11:28 CST 2006 ia64) | > | | > | 1) replaced the ancient /lib/libcap.so.1.92 with less ancient libcap.so.1.10 | > | | > | 2) successfully applied Serge's patch to SLES 2.6.18 sources and rebooted | > | | > | 3) installed Kaigai's userspace tools... no problems evident | > | | > | 4) ran setfcaps to see capabilities... (note Memory fault): | > | | > | certify:~/libcap-1.10 # setfcaps | > | usage: setfcaps ... | > | cap_chown, cap_dac_override, cap_dac_read_search, cap_fowner | > | cap_fsetid, cap_kill, cap_setgid, cap_setuid | > | cap_setpcap, cap_linux_immutable, | > | cap_net_bind_service, cap_net_broadcast | > | cap_net_admin, cap_net_raw, cap_ipc_lock, cap_ipc_owner | > | cap_sys_module, cap_sys_rawio, cap_sys_chroot, cap_sys_ptrace | > | cap_sys_pacct, cap_sys_admin, cap_sys_boot, cap_sys_nice | > | cap_sys_resource, cap_sys_time, | > | cap_sys_tty_config, cap_mknod | > | cap_lease, cap_audit_write, cap_audit_controlMemory fault | | Ah, this actually makes sense. The setfcaps usage() statement does | | for (i=0; _cap_names[i]; i++) { | printf... | | so it expects _cap_names to end with a terminating NULL, but that | doesn't seem to be the case in cap_names.h in libcap. | | KaiGai, perhaps setfcaps should do something like | | diff setfcaps.c.orig setfcaps.c | 25c25 | < for (i=0; _cap_names[i]; i++) | --- | > for (i=0; i<__CAP_BITS; i++) I brute-force hardcoded the limit on this for loop (i< 31), and rebuilt Kaigai's tools, and retested (again, on this RHEL5 IA64 target. It all works now. I ran through Chris Friedhoff's "test protocol", and it went swimmingly (http://www.friedhoff.org/fscaps.html). Then I went back to my SLES-10 IA64 target, and repeated the fixup for Kaigai's tools. It now works, providing I changeout the antique libcap.so.92 for newer libcap.so.10 (why the version number is lower is beyond me). So, for my limited IA64 test target set, the following are true, providing Serge's capabilities kernel patch is applied, and Kaigai's userspace tools are utilized (obviously with the brute-force hack to setfcaps.c): 1) RHEL5 - libcap.so.10 is "stock": caps patch and hacked u-space tools PASS the tests. 2) SLES10 - libcap.so.92 is "stock": caps patch and hacked u-space tools FAIL the tests. 3) SLES10 - "stock" libcap.so.92 replaced with newer libcap.so.10: caps patch and hacked u-space tools PASS the tests. The question that remains unanswered: why is SLES using such an old libcap, and are they likely to replace it with the more accepted version (libcap.so.10) soon? Thanks, -Bill -- Bill O'Donnell SGI [EMAIL PROTECTED] - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
x86_64 Kernel faults pollute task structs
In arch/x86_64/kernel/traps.c:do_general_protection(), we have tsk->thread.error_code = error_code; tsk->thread.trap_no = 13; if (user_mode(regs)) { ... force_sig(SIGSEGV, tsk); return; } /* kernel gp */ { ... } When a kernel GP fault comes in, and the process has a pending SEGV, thread.error_code and trap_no will get corrupted, and those values will be passed to the process if it's handling SIGSEGV. UML on x86_64 sees process segfaults when the host is loaded. The trap_no in the sigcontext is 13, not 14, but cr2 and the faulting instruction are consistent with a normal, trap_no == 14, page fault. However, trap_no == 13 makes the UML kernel think that it's not a normal page fault, and passes the segfault along to the process. This patch - the do_general_protection part of it, anyway - makes the UML process segfaults disappear. --- arch/x86_64/kernel/traps.c~ 2006-12-01 15:02:55.0 -0500 +++ arch/x86_64/kernel/traps.c 2006-12-01 15:02:29.0 -0500 @@ -637,10 +637,10 @@ { struct task_struct *tsk = current; - tsk->thread.error_code = error_code; - tsk->thread.trap_no = trapnr; - if (user_mode(regs)) { + tsk->thread.error_code = error_code; + tsk->thread.trap_no = trapnr; + if (exception_trace && unhandled_signal(tsk, signr)) printk(KERN_INFO "%s[%d] trap %s rip:%lx rsp:%lx error:%lx\n", @@ -738,10 +738,10 @@ conditional_sti(regs); - tsk->thread.error_code = error_code; - tsk->thread.trap_no = 13; - if (user_mode(regs)) { + tsk->thread.error_code = error_code; + tsk->thread.trap_no = 13; + if (exception_trace && unhandled_signal(tsk, SIGSEGV)) printk(KERN_INFO "%s[%d] general protection rip:%lx rsp:%lx error:%lx\n", The simplistic model I had where a process takes a userspace segfault, and while it's in the kernel dealing with it, it takes a kernel GP fault, polluting trap_no and error_code, appears to be wrong. I put a some code which counted the number of times that sigismember(&tsk->pending.signal, SIGSEGV) is true when do_general_protection() is called, and that turned out to be zero. However, the fact that my processes stop segfaulting with the above patch suggests that there is something to this. At the very least, this patch seems harmless and speeds up kernel fault handling a tiny bit. Looking at i386, there is something similar. I'd suggest this for do_traps(): --- linux-2.6.orig/arch/i386/kernel/traps.c +++ linux-2.6/arch/i386/kernel/traps.c @@ -543,8 +543,6 @@ static void __kprobes do_trap(int trapnr siginfo_t *info) { struct task_struct *tsk = current; - tsk->thread.error_code = error_code; - tsk->thread.trap_no = trapnr; if (regs->eflags & VM_MASK) { if (vm86) @@ -556,6 +554,9 @@ static void __kprobes do_trap(int trapnr goto kernel_trap; trap_signal: { + tsk->thread.error_code = error_code; + tsk->thread.trap_no = trapnr; + if (info) force_sig_info(signr, info, tsk); else Interestingly, it looks like someone half-did this job in do_general_protection(), where trap_no and error_code are assigned twice: --- linux-2.6.orig/arch/i386/kernel/traps.c +++ linux-2.6/arch/i386/kernel/traps.c @@ -670,9 +671,6 @@ fastcall void __kprobes do_general_prote } put_cpu(); - current->thread.error_code = error_code; - current->thread.trap_no = 13; - if (regs->eflags & VM_MASK) goto gp_in_vm86; It looks like this behavior is not universal. I took a quick look at powerpc, and it appears not to be doing this. However, this might be something for arch maintainers to take a look at. If there are no objections, I'll roll the changes above into a proper, signed-off patch, and send it in. Jeff -- Work email - jdike at linux dot intel dot com - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] acpi: add backlight support to the sony_acpi driver (v2)
Hi! > Enable the sony_acpi driver to use the backlight subsysyem for > adjusting the monitor brightness. Old way of changing the brightness will be > still available for compatibility with existing tools. > > Signed-off-by: Alessandro Guido <[EMAIL PROTECTED]> Looks okay to me. We really want unified interface for backlight. Pavel -- Thanks for all the (sleeping) penguins. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] acpi: add backlight support to the sony_acpi driver (v2)
On Fri, 01 Dec 2006, Pavel Machek wrote: > Looks okay to me. We really want unified interface for backlight. Then I request some help to get http://article.gmane.org/gmane.linux.acpi.devel/19792 merged. Without it, the backlight interface becomes annoying on laptops. Your screen will be powered off when you remove the modules providing the backlight interface. This is not consistent with the needs of laptop backlight devices, or with the behaviour the drivers had before the backlight sysfs support was added. -- "One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: slow io_submit
On 12/1/06, Jens Axboe <[EMAIL PROTECTED]> wrote: On Fri, Dec 01 2006, Raz Ben-Jehuda(caro) wrote: > Jens suparna hello > > I have managed to understand why io_submit is sometimes very slow. > It is because the device is plugged once too many io's are being sent. > I have conducted a simple test with nr_request to default value of 128 > and and 256. > and it proved to be correct. I don't understand your email. The device is plugged when it is empty, not when it has emptied the request list. first , i am not top posting you. I made a mistake and associated plugging with a full queue. > I would truely appreciate your comment on this. On what? :-) If it's no blocking and returning EAGAIN instead, then I agree this is what should eventually happen. Who returns EGAIN to whom ? I am not sure i understand what you mean here. Right now nobody is working on that afaik, so it's not something that will hit the next kernel. thank you raz -- Jens Axboe -- Raz - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [2.6 patch] Tigran Aivazian: remove bouncing email addresses
On 01/12/06, Hua Zhong <[EMAIL PROTECTED]> wrote: I am curious, what's the point? These email addresses serve a "historical" purpose: they tell when the contribution was made, what the author's email addresses were at that point. It's not MAINTAINERS. If people want to contact someone, go find the latest address there. Yes, MAINTAINERS is the preferred location for maintainer info, but when there is no entry in maintainers (or when the person listed there is not responsive), many people (including me) use the names or email addresses listed in source files as people to contact. So it's nice when the email addresses are up to date. In my opinion the addresses should be working ones or not present at all (or at the very least there should be a note that the email address is outdated). -- Jesper Juhl <[EMAIL PROTECTED]> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html Plain text mails only, please http://www.expita.com/nomime.html - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC] Include ACPI DSDT from INITRD patch into mainline
> > Does that change the fact it is ugly ? > > No, but it does beg the question "how else can it be done"? Agreed. > Distros need a way for users to add a fixed DSDT without recompiling > their own kernels. Legal rights to do so aside, do they ? and if they do does it have to be an ugly hack in the mainstream kernel. Alan - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Fixed formatting in ia64_process_pending_irq()
On Fri, 01 Dec 2006 15:29:43 +0300 Pavel Emelianov <[EMAIL PROTECTED]> wrote: > A trivial issue found during code examining. > Someone typed unneeded extra spaces. It's the usual mess in there. akpm:/usr/src/linux-2.6.19> grep -r '^' arch/ia64 | wc -l 341 There isn't much point in fixing just four of them. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.19: ALi M5229 - CD-ROM not found with pata_ali
> Still the same in 2.6.19 + suspend pata_ali patch. The only way I can get > CD-ROM is with > > options pata_ali atapi_max_xfer_mask=0x7f And I've still got no idea why. Having studied the docs, the old and new drivers and a lot more I see no difference to explain it. Alan - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC] Include ACPI DSDT from INITRD patch into mainline
On Fri, 2006-12-01 at 16:01 -0500, Ben Collins wrote: > On Fri, 2006-12-01 at 20:45 +0100, Arjan van de Ven wrote: > > On Fri, 2006-12-01 at 14:35 -0500, Ben Collins wrote: > > > What about the point that userspace (udev, and such) is not available > > > when DSDT loading needs to occur? Init hasn't even started at that > > > point. > > > > that's a moot point; you need to load firmware from the initramfs ANYWAY > > for things like qlogic and others... > > I don't see how that relates. The DSDT needs to be loaded even before > driver initialization begins. in fact it needs to be loaded even before the ACPI engine starts executing, otherwise you're hot-replacing code underneath a live system... at which point you can do this same feature in another way :) there already is a feature that builds a dsdt into the kernel image, all a distro would need is a bit of objcopy magic to build the right one into the vmlinuz... - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Devel] Re: Linux 2.6.19 VServer 2.1.x
On Friday 01 December 2006 22:32, Herbert Poetzl wrote: > On Fri, Dec 01, 2006 at 01:33:03PM +0300, Kirill Korotaev wrote: > > OpenVZ has been using them for more than a month already ;-) > > great for you, here some details: > > - 2.6.19 was released 29th Nov 2006 > - OpenVZ page shows 2.6.9-023, 2.6.16 and the >2.6.18 development > - Linux-VServer has followed the -rc series >too, so that's nothing new > - I didn't manage to find an OpenVZ patch for >2.6.19 on your site > > but probably all the changes from 2.6.19 have > been backported to the stable 2.6.9 kernel > several months ago :) more details: http://git.openvz.org/?p=linux-2.6.18-openvz;a=commitdiff;h=2563d54c8c3215792af24d96d852fe30aed2a7b4 http://git.openvz.org/?p=linux-2.6.18-openvz;a=commitdiff;h=44100ee643f4f59e8b71ac10b7b5f01f8a423292 > > best, > Herbert > > > Kirill > > > > > Ladies and Gentlemen! > > > > > > here is the first Linux-VServer version (testing) > > > with support for the *spaces (uts, ipc and vfs) > > > introduced in 2.6.19 ... > > > > > > http://vserver.13thfloor.at/Experimental/patch-2.6.19-vs2.1.x-t1.diff > > > > > > it might not be as perfect as the kernel itself *G* > > > but it does work fine here, and with recent tools > > > most virtualization features work as expected > > > > > > please if you do testing, report issues or comments > > > to the Linux-VServer mailing list or to me directly > > > (at least CC would be fine) and do not bother the > > > nice kernel folks ... > > > > > > enjoy, > > > Herbert > > > ___ > > > Containers mailing list > > > [EMAIL PROTECTED] > > > https://lists.osdl.org/mailman/listinfo/containers > > ___ > Containers mailing list > [EMAIL PROTECTED] > https://lists.osdl.org/mailman/listinfo/containers > > ___ > Devel mailing list > [EMAIL PROTECTED] > https://openvz.org/mailman/listinfo/devel -- Thanks, Dmitry. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
CD oddities with VIA PATA
I'm testing 2.6.19 on this box, and I thought I might as well try out the Parallel ATA driver for the CD/DVD writer (VIA) since the disk is already handled by libata. So far, I've found two oddities - (i.) cdparanoia (9.8) works for root, but for a user it complains that the ioctl isn't cooked and refuses to run. For test purposes, it runs ok for a user as suid root, but I imagine that increases the likelihood of unspeakable things happening. (Fortunately, I don't have a dachshund) (ii.) As a user, I burned a small (28MB) CD using dvdrecord from dvdrtools-0.3.1, and on a different box I can mount it (using ide-cd) and it seems fine. On this box I can't mount it - [EMAIL PROTECTED] ~ $mount /media/cdrom/ mount: wrong fs type, bad option, bad superblock on /dev/cdrom, missing codepage or other error In some cases useful info is found in syslog - try dmesg | tail or so The syslog shows Dec 1 21:17:41 ac30 kernel: attempt to access beyond end of device Dec 1 21:17:41 ac30 kernel: sr0: rw=0, want=68, limit=4 Dec 1 21:17:41 ac30 kernel: isofs_fill_super: bread failed, dev=sr0, iso_blknum=16, block=16 The iso is the gparted-livecd-0.3.1-1.iso. The problem might be specific to small CDs, I can mount others (41M of data and more) without difficulty and all of the likely NLS options are selected as =y in my config. Ken -- das eine Mal als Tragödie, das andere Mal als Farce - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC] Include ACPI DSDT from INITRD patch into mainline
On Friday 01 December 2006 22:55, Alan wrote: > > > Does that change the fact it is ugly ? > > > > No, but it does beg the question "how else can it be done"? > > Agreed. So how else can it be done? > > Distros need a way for users to add a fixed DSDT without recompiling > > their own kernels. > > Legal rights to do so aside, do they ? Acer notebook users here dump DSDT from their own machine, fix it and then load via initrd. No legal problems. (... and without that even battery can't be monitored on sych notebooks) > and if they do does it have to be > an ugly hack in the mainstream kernel. Can it be done without hacks somehow (in the way that adding fixed DSDT is easy for user)? > Alan -- Arkadiusz MiśkiewiczPLD/Linux Team arekm / maven.plhttp://ftp.pld-linux.org/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC] Include ACPI DSDT from INITRD patch into mainline
On Fri, 1 Dec 2006 23:01:20 +0100 Arkadiusz Miskiewicz <[EMAIL PROTECTED]> wrote: > Acer notebook users here dump DSDT from their own machine, fix it and then > load via initrd. Under EU law thats two copies without permission and modification without permission of the rights holder > > and if they do does it have to be > > an ugly hack in the mainstream kernel. > > Can it be done without hacks somehow (in the way that adding fixed DSDT is > easy for user)? Arjan - can you explain the linking dsdt one in more detail ? - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] atomic.h atomic64_t standardization
Hi, I finalized the work for atomic64_t cmpxchg and atomic64_add_unless on all architectures. asm-generic/atomic.h atomic_long_t is also streamlined. Review is welcome. Mathieu ---BEGIN--- --- a/include/asm-alpha/atomic.h +++ b/include/asm-alpha/atomic.h @@ -175,19 +175,64 @@ static __inline__ long atomic64_sub_retu return result; } -#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) +#define atomic64_cmpxchg(v, old, new) \ + ((__typeof__((v)->counter))cmpxchg(&((v)->counter), old, new)) +#define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) + +#define atomic_cmpxchg(v, old, new) \ + ((__typeof__((v)->counter))cmpxchg(&((v)->counter), old, new)) #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) +/** + * atomic_add_unless - add unless the number is a given value + * @v: pointer of type atomic_t + * @a: the amount to add to v... + * @u: ...unless v is equal to u. + * + * Atomically adds @a to @v, so long as it was not @u. + * Returns non-zero if @v was not @u, and zero otherwise. + */ #define atomic_add_unless(v, a, u) \ ({ \ - int c, old; \ + __typeof__((v)->counter) c, old;\ c = atomic_read(v); \ - while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ + for (;;) { \ + if (unlikely(c == (u))) \ + break; \ + old = atomic_cmpxchg((v), c, c + (a)); \ + if (likely(old == c)) \ + break; \ c = old;\ + } \ c != (u); \ }) #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) +/** + * atomic64_add_unless - add unless the number is a given value + * @v: pointer of type atomic64_t + * @a: the amount to add to v... + * @u: ...unless v is equal to u. + * + * Atomically adds @a to @v, so long as it was not @u. + * Returns non-zero if @v was not @u, and zero otherwise. + */ +#define atomic64_add_unless(v, a, u) \ +({ \ + __typeof__((v)->counter) c, old;\ + c = atomic64_read(v); \ + for (;;) { \ + if (unlikely(c == (u))) \ + break; \ + old = atomic64_cmpxchg((v), c, c + (a));\ + if (likely(old == c)) \ + break; \ + c = old;\ + } \ + c != (u); \ +}) +#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) + #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) #define atomic64_add_negative(a, v) (atomic64_add_return((a), (v)) < 0) --- a/include/asm-alpha/system.h +++ b/include/asm-alpha/system.h @@ -443,6 +443,111 @@ #define xchg(ptr,x) \ (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \ }) +static inline unsigned long +__xchg_u8_local(volatile char *m, unsigned long val) +{ + unsigned long ret, tmp, addr64; + + __asm__ __volatile__( + " andnot %4,7,%3\n" + " insbl %1,%4,%1\n" + "1: ldq_l %2,0(%3)\n" + " extbl %2,%4,%0\n" + " mskbl %2,%4,%2\n" + " or %1,%2,%2\n" + " stq_c %2,0(%3)\n" + " beq %2,2f\n" + ".subsection 2\n" + "2: br 1b\n" + ".previous" + : "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64) + : "r" ((long)m), "1" (val) : "memory"); + + return ret; +} + +static inline unsigned long +__xchg_u16_local(volatile short *m, unsigned long val) +{ + unsigned long ret, tmp, addr64; + + __asm__ __volatile__( + " andnot %4,7,%3\n" + " inswl %1,%4,%1\n" + "1: ldq_l %2,0(%3)\n" + " extwl %2,%4,%0\n" + " mskwl %2,%4,%2\n" + " or %1,%2,%2\n" + " stq_c %2,0(%3)\n" + " beq %2,2f\n" + ".subsection 2\n" + "2: br 1b\n" + ".previous" + : "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
Re: failed 'ljmp' in linear addressing mode
On Wed, Nov 22, 2006 at 03:41:11PM -0800, Jun Sun wrote: > > I am plowing along as I am learning about the in'n'outs about i386. I am > totally stuck on this one. I would appreciate any help. > > As you can see, the function turns off paging mode (of course it > runs from identically mapped page) and tries to jump to an absolute > address at 0x1000. It appears the machine would reboot when running > "ljmp" instruction. > > Any pointers? > Pageexec gave me an excellent explanation on why "ljmp" fails. See below. It is so obvious once you see it. :) Thanks. Jun - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Fri, 01 Dec 2006 14:35:09 +0200 Subject: failed 'ljmp' in linear addressing mode hello, just saw your post on lkml. your original problem was that when you executed the far jump, the CPU's internal GDT base register was still loaded with the kernel's virtual address of gdt_table - an address somewhere high in the (then virtual) address space which when interpreted as a physical address (you turned off paging, remember) contained nothing, let alone a valid GDT. so when the CPU tried to look up __KERNEL_CS in the GDT, it found nothing there, that in turn triggered an exception which in turn double then triple faulted as the IDT couldn't be accessed either for the same reason. later you posted code that shows that you reload the IDT/GDT with a constant 0, i doubt that will do much good either on the long run as there's no valid GDT/IDT set up there normally. in short, the normal course of action when going from paged protected mode into non-paged protected mode is to reload IDT/GDT with physical addresses pointing to valid tables then reload the segment registers (if they're different from those used in paged mode) then you can go on with the rest. note that the reload operation uses *two* addresses (one for the memory operand of lgdt/lidt and one for the actual table address), both of which had better be of the same kind (physical or virtual). - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] local.h modifications
Hi, I also completed the support for all atomic operations in local.h for all architectures. The local_t type is now identical on each architectures : it contains an atomic_long_t field, just like the asm-generic implementation. Please review. Mathieu ---BEGIN--- --- a/include/asm-alpha/local.h +++ b/include/asm-alpha/local.h @@ -4,37 +4,115 @@ #define _ALPHA_LOCAL_H #include #include -typedef atomic64_t local_t; +typedef struct +{ + atomic_long_t a; +} local_t; -#define LOCAL_INIT(i) ATOMIC64_INIT(i) -#define local_read(v) atomic64_read(v) -#define local_set(v,i) atomic64_set(v,i) +#define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) } +#define local_read(l) atomic_long_read(&(l)->a) +#define local_set(l,i) atomic_long_set(&(l)->a, (i)) +#define local_inc(l) atomic_long_inc(&(l)->a) +#define local_dec(l) atomic_long_dec(&(l)->a) +#define local_add(i,l) atomic_long_add((i),(&(l)->a)) +#define local_sub(i,l) atomic_long_sub((i),(&(l)->a)) -#define local_inc(v) atomic64_inc(v) -#define local_dec(v) atomic64_dec(v) -#define local_add(i, v)atomic64_add(i, v) -#define local_sub(i, v)atomic64_sub(i, v) +static __inline__ long local_add_return(long i, local_t * l) +{ + long temp, result; + __asm__ __volatile__( + "1: ldq_l %0,%1\n" + " addq %0,%3,%2\n" + " addq %0,%3,%0\n" + " stq_c %0,%1\n" + " beq %0,2f\n" + ".subsection 2\n" + "2: br 1b\n" + ".previous" + :"=&r" (temp), "=m" (l->a.counter), "=&r" (result) + :"Ir" (i), "m" (l->a.counter) : "memory"); + return result; +} -#define __local_inc(v) ((v)->counter++) -#define __local_dec(v) ((v)->counter++) -#define __local_add(i,v) ((v)->counter+=(i)) -#define __local_sub(i,v) ((v)->counter-=(i)) +static __inline__ long local_sub_return(long i, local_t * v) +{ + long temp, result; + __asm__ __volatile__( + "1: ldq_l %0,%1\n" + " subq %0,%3,%2\n" + " subq %0,%3,%0\n" + " stq_c %0,%1\n" + " beq %0,2f\n" + ".subsection 2\n" + "2: br 1b\n" + ".previous" + :"=&r" (temp), "=m" (l->a.counter), "=&r" (result) + :"Ir" (i), "m" (l->a.counter) : "memory"); + return result; +} + +#define local_cmpxchg(l, old, new) \ + ((long)cmpxchg_local(&((l)->a.counter), old, new)) +#define local_xchg(l, new) (xchg_local(&((l)->a.counter), new)) + +/** + * local_add_unless - add unless the number is a given value + * @l: pointer of type local_t + * @a: the amount to add to l... + * @u: ...unless l is equal to u. + * + * Atomically adds @a to @l, so long as it was not @u. + * Returns non-zero if @l was not @u, and zero otherwise. + */ +#define local_add_unless(l, a, u) \ +({ \ + long c, old;\ + c = local_read(l); \ + for (;;) { \ + if (unlikely(c == (u))) \ + break; \ + old = local_cmpxchg((l), c, c + (a)); \ + if (likely(old == c)) \ + break; \ + c = old;\ + } \ + c != (u); \ +}) +#define local_inc_not_zero(l) local_add_unless((l), 1, 0) + +#define local_add_negative(a, l) (local_add_return((a), (l)) < 0) + +#define local_dec_return(l) local_sub_return(1,(l)) + +#define local_inc_return(l) local_add_return(1,(l)) + +#define local_sub_and_test(i,l) (local_sub_return((i), (l)) == 0) + +#define local_inc_and_test(l) (local_add_return(1, (l)) == 0) + +#define local_dec_and_test(l) (local_sub_return(1, (l)) == 0) + +/* Verify if faster than atomic ops */ +#define __local_inc(l) ((l)->a.counter++) +#define __local_dec(l) ((l)->a.counter++) +#define __local_add(i,l) ((l)->a.counter+=(i)) +#define __local_sub(i,l) ((l)->a.counter-=(i)) /* Use these for per-cpu local_t variables: on some archs they are * much more efficient than these naive implementations. Note they take * a variable, not an address. */ -#define cpu_local_read(v) local_read(&__get_cpu_var(v)) -#define cpu_local_set(v, i)local_set(&__get_cpu_var(v), (i)) - -#define cpu_local_inc(v) local_inc(&__get_cpu_var(v)) -#define cpu_local_dec(v) local_dec(&__get_cpu_var(v)) -#define cpu_local_add(i, v)local_add((i), &__get_cpu_var(v)) -#define cpu_local_sub(i, v)local_sub((i), &__get_cpu_var(v)) - -#define __cpu_local_inc(v) __local_inc(&__get_cpu_var(v)) -#define __cpu_local_dec(v) __local
[2.6 patch] paride: remove parport #ifdef's
CONFIG_PARIDE depends on CONFIG_PARPORT_PC, so there's no reason for these #ifdef's. Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]> --- drivers/block/paride/bpck6.c | 13 - drivers/block/paride/paride.c | 33 - 2 files changed, 46 deletions(-) --- linux-2.6.19-rc6-mm2/drivers/block/paride/bpck6.c.old 2006-12-01 23:14:49.0 +0100 +++ linux-2.6.19-rc6-mm2/drivers/block/paride/bpck6.c 2006-12-01 23:15:09.0 +0100 @@ -31,10 +31,7 @@ static int verbose; /* set this to 1 to #include #include #include - -#if defined(CONFIG_PARPORT_MODULE)||defined(CONFIG_PARPORT) #include -#endif #include "ppc6lnx.c" #include "paride.h" @@ -139,11 +136,6 @@ static int bpck6_test_port ( PIA *pi ) PPCSTRUCT(pi)->ppc_id=pi->unit; PPCSTRUCT(pi)->lpt_addr=pi->port; -#ifdef CONFIG_PARPORT_PC_MODULE -#define CONFIG_PARPORT_PC -#endif - -#ifdef CONFIG_PARPORT_PC /* look at the parport device to see if what modes we can use */ if(((struct pardevice *)(pi->pardev))->port->modes & (PARPORT_MODE_EPP) @@ -161,11 +153,6 @@ static int bpck6_test_port ( PIA *pi ) { return 1; } -#else - /* there is no way of knowing what kind of port we have - default to the highest mode possible */ - return 5; -#endif } static int bpck6_probe_unit ( PIA *pi ) --- linux-2.6.19-rc6-mm2/drivers/block/paride/paride.c.old 2006-12-01 23:15:18.0 +0100 +++ linux-2.6.19-rc6-mm2/drivers/block/paride/paride.c 2006-12-01 23:16:12.0 +0100 @@ -29,14 +29,7 @@ #include #include #include/* TASK_* */ - -#ifdef CONFIG_PARPORT_MODULE -#define CONFIG_PARPORT -#endif - -#ifdef CONFIG_PARPORT #include -#endif #include "paride.h" @@ -76,8 +69,6 @@ void pi_read_block(PIA * pi, char *buf, EXPORT_SYMBOL(pi_read_block); -#ifdef CONFIG_PARPORT - static void pi_wake_up(void *p) { PIA *pi = (PIA *) p; @@ -100,11 +91,8 @@ static void pi_wake_up(void *p) cont(); } -#endif - int pi_schedule_claimed(PIA * pi, void (*cont) (void)) { -#ifdef CONFIG_PARPORT unsigned long flags; spin_lock_irqsave(&pi_spinlock, flags); @@ -115,7 +103,6 @@ int pi_schedule_claimed(PIA * pi, void ( } pi->claimed = 1; spin_unlock_irqrestore(&pi_spinlock, flags); -#endif return 1; } EXPORT_SYMBOL(pi_schedule_claimed); @@ -133,20 +120,16 @@ static void pi_claim(PIA * pi) if (pi->claimed) return; pi->claimed = 1; -#ifdef CONFIG_PARPORT if (pi->pardev) wait_event(pi->parq, !parport_claim((struct pardevice *) pi->pardev)); -#endif } static void pi_unclaim(PIA * pi) { pi->claimed = 0; -#ifdef CONFIG_PARPORT if (pi->pardev) parport_release((struct pardevice *) (pi->pardev)); -#endif } void pi_connect(PIA * pi) @@ -167,21 +150,15 @@ EXPORT_SYMBOL(pi_disconnect); static void pi_unregister_parport(PIA * pi) { -#ifdef CONFIG_PARPORT if (pi->pardev) { parport_unregister_device((struct pardevice *) (pi->pardev)); pi->pardev = NULL; } -#endif } void pi_release(PIA * pi) { pi_unregister_parport(pi); -#ifndef CONFIG_PARPORT - if (pi->reserved) - release_region(pi->port, pi->reserved); -#endif /* !CONFIG_PARPORT */ if (pi->proto->release_proto) pi->proto->release_proto(pi); module_put(pi->proto->owner); @@ -269,8 +246,6 @@ EXPORT_SYMBOL(paride_unregister); static int pi_register_parport(PIA * pi, int verbose) { -#ifdef CONFIG_PARPORT - struct parport *port; port = parport_find_base(pi->port); @@ -290,7 +265,6 @@ static int pi_register_parport(PIA * pi, printk("%s: 0x%x is %s\n", pi->device, pi->port, port->name); pi->parname = (char *) port->name; -#endif return 1; } @@ -447,13 +421,6 @@ int pi_init(PIA * pi, int autoprobe, int printk("%s: Adapter not found\n", device); return 0; } -#ifndef CONFIG_PARPORT - if (!request_region(pi->port, pi->reserved, pi->device)) { - printk(KERN_WARNING "paride: Unable to request region 0x%x\n", - pi->port); - return 0; - } -#endif /* !CONFIG_PARPORT */ if (pi->parname) printk("%s: Sharing %s at 0x%x\n", pi->device, - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: "BUG: held lock freed!" lock validator tripped by kswapd & xfs
On 12/1/06, Mike Mattie <[EMAIL PROTECTED]> wrote: In an attempt to debug another kernel issue I turned on the lock validator and managed to generate this report. As a side note the first attempt to boot with the lock validator failed with a message indicating I had exceeded MAX_LOCK_DEPTH. To get this trace I patched sched.h: MAX_LOCK_DEPTH to 60. Dec 1 08:35:41 reforged [ 3052.513931] = Dec 1 08:35:41 reforged [ 3052.513937] [ BUG: held lock freed! ] Dec 1 08:35:41 reforged [ 3052.513939] - Dec 1 08:35:41 reforged [ 3052.513943] kswapd0/183 is freeing memory c3458000-c3458fff, with a lock still held there! Dec 1 08:35:41 reforged [ 3052.513947] (&(&ip->i_iolock)->mr_lock){}, at: [] xfs_ilock+0x20/0x75 Dec 1 08:35:41 reforged [ 3052.513959] 28 locks held by kswapd0/183: Dec 1 08:35:41 reforged [ 3052.513961] #0: (&(&ip->i_iolock)->mr_lock){}, at: [] xfs_ilock+0x20/0x75 Dec 1 08:35:41 reforged [ 3052.513968] #1: (&(&ip->i_lock)->mr_lock){}, at: [] xfs_ilock+0x52/0x75 Dec 1 08:35:41 reforged [ 3052.513975] seems to alternate between same two locks. But both c089 and c0bb are not between the page(oxfff=4095 or about 4k) which kswapd is trying to get rid of. I think this trace is on crack somehow. [ 3052.514136] stack backtrace: Dec 1 08:35:41 reforged [ 3052.514139] [] show_trace+0x16/0x19 Dec 1 08:35:41 reforged [ 3052.514146] [] dump_stack+0x1a/0x1f Dec 1 08:35:41 reforged [ 3052.514150] [] debug_check_no_locks_freed+0xe0/0xff Dec 1 08:35:41 reforged [ 3052.514159] [] free_hot_cold_page+0x96/0x109 Dec 1 08:35:41 reforged [ 3052.514166] [] __pagevec_free+0x1c/0x27 Dec 1 08:35:41 reforged [ 3052.514170] [] __pagevec_release_nonlru+0x65/0x71 Dec 1 08:35:41 reforged [ 3052.514176] [] shrink_inactive_list+0x4b1/0x722 Dec 1 08:35:41 reforged [ 3052.514181] [] shrink_zone+0xba/0xd9 Dec 1 08:35:41 reforged [ 3052.514185] [] kswapd+0x26a/0x361 Dec 1 08:35:41 reforged [ 3052.514189] [] kthread+0xb0/0xe1 Dec 1 08:35:41 reforged [ 3052.514192] [] kernel_thread_helper+0x5/0xb reforged log # Linux reforged 2.6.18.3 #4 PREEMPT Fri Dec 1 06:15:05 PST 2006 i686 AMD Athlon(tm) XP 3000+ AuthenticAMD GNU/Linux I know you are running preempt on up machine. I'd try running 2.6.18.4 with a small patch like this and see if you can't cause it to recrash for you. print_freed_lock_bug uses printk which in theory might be causing a preempt . diff -urp linux-2.6.18.4/include/linux/sched.h linux-debug/include/linux/sched.h --- linux-2.6.18.4/include/linux/sched.h2006-11-29 11:28:40.0 -0800 +++ linux-debug/include/linux/sched.h 2006-12-01 13:25:23.0 -0800 @@ -936,7 +936,7 @@ struct task_struct { int softirq_context; #endif #ifdef CONFIG_LOCKDEP -# define MAX_LOCK_DEPTH 30UL +# define MAX_LOCK_DEPTH (60UL) u64 curr_chain_key; int lockdep_depth; struct held_lock held_locks[MAX_LOCK_DEPTH]; diff -urp linux-2.6.18.4/kernel/lockdep.c linux-debug/kernel/lockdep.c --- linux-2.6.18.4/kernel/lockdep.c 2006-11-29 11:28:40.0 -0800 +++ linux-debug/kernel/lockdep.c2006-12-01 14:22:14.0 -0800 @@ -2608,6 +2608,7 @@ void debug_check_no_locks_freed(const vo return; local_irq_save(flags); + preempt_disable(); for (i = 0; i < curr->lockdep_depth; i++) { hlock = curr->held_locks + i; @@ -2621,6 +2622,7 @@ void debug_check_no_locks_freed(const vo print_freed_lock_bug(curr, mem_from, mem_to, hlock); break; } + preempt_enable(); local_irq_restore(flags); } -- http://dmoz.org/profiles/pollei.html http://sourceforge.net/users/stephen_pollei/ http://www.orkut.com/Profile.aspx?uid=2455954990164098214 http://stephen_pollei.home.comcast.net/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC] Include ACPI DSDT from INITRD patch into mainline
On Fri, 2006-12-01 at 22:49 +0100, Arjan van de Ven wrote: > On Fri, 2006-12-01 at 16:01 -0500, Ben Collins wrote: > > On Fri, 2006-12-01 at 20:45 +0100, Arjan van de Ven wrote: > > > On Fri, 2006-12-01 at 14:35 -0500, Ben Collins wrote: > > > > What about the point that userspace (udev, and such) is not available > > > > when DSDT loading needs to occur? Init hasn't even started at that > > > > point. > > > > > > that's a moot point; you need to load firmware from the initramfs ANYWAY > > > for things like qlogic and others... > > > > I don't see how that relates. The DSDT needs to be loaded even before > > driver initialization begins. > > in fact it needs to be loaded even before the ACPI engine starts > executing, otherwise you're hot-replacing code underneath a live > system... at which point you can do this same feature in another way :) > there already is a feature that builds a dsdt into the kernel image, all > a distro would need is a bit of objcopy magic to build the right one > into the vmlinuz... Providing object files for on-demand relinking of the kernel just adds a shit load of overhead. If you're suggesting modifying vmlinuz in place instead, that just seems really undesirable. Last thing I want is something mucking with the kernel binary. It's easier for me to keep this patch in my tree, especially since most users have come to expect this as the "standard" method for inserting their DSDT replacement. The only other thing I can think of is grub providing the DSDT just like it does for the initrd. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[2.6 patch] remove drivers/block/paride/jumbo
Let's remove this pre-historic paride building script. Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]> --- drivers/block/paride/jumbo | 70 - 1 file changed, 70 deletions(-) --- linux-2.6.19-rc6-mm2/drivers/block/paride/jumbo 2006-09-20 05:42:06.0 +0200 +++ /dev/null 2006-09-19 00:45:31.0 +0200 @@ -1,70 +0,0 @@ -#!/bin/sh -# -# This script can be used to build "jumbo" modules that contain the -# base PARIDE support, one protocol module and one high-level driver. -# -echo -n "High level driver [pcd] : " -read X -HLD=${X:-pcd} -# -echo -n "Protocol module [bpck] : " -read X -PROTO=${X:-bpck} -# -echo -n "Use MODVERSIONS [y] ? " -read X -UMODV=${X:-y} -# -echo -n "For SMP kernel [n] ? " -read X -USMP=${X:-n} -# -echo -n "Support PARPORT [n] ? " -read X -UPARP=${X:-n} -# -echo -# -case $USMP in - y* | Y* ) FSMP="-DCONFIG_SMP" - ;; - *)FSMP="" - ;; -esac -# -MODI="-include ../../../include/linux/modversions.h" -# -case $UMODV in - y* | Y* ) FMODV="-DMODVERSIONS $MODI" - ;; - *)FMODV="" - ;; -esac -# -case $UPARP in - y* | Y* ) FPARP="-DCONFIG_PARPORT" - ;; - *)FPARP="" - ;; -esac -# -TARG=$HLD-$PROTO.o -FPROTO=-DCONFIG_PARIDE_`echo "$PROTO" | tr [a-z] [A-Z]` -FK="-D__KERNEL__ -I ../../../include" -FLCH=-D_LINUX_CONFIG_H -# -echo cc $FK $FSMP $FLCH $FPARP $FPROTO $FMODV -Wall -O2 -o Jb.o -c paride.c -cc $FK $FSMP $FLCH $FPARP $FPROTO $FMODV -Wall -O2 -o Jb.o -c paride.c -# -echo cc $FK $FSMP $FMODV -Wall -O2 -o Jp.o -c $PROTO.c -cc $FK $FSMP $FMODV -Wall -O2 -o Jp.o -c $PROTO.c -# -echo cc $FK $FSMP $FMODV -DMODULE -DPARIDE_JUMBO -Wall -O2 -o Jd.o -c $HLD.c -cc $FK $FSMP $FMODV -DMODULE -DPARIDE_JUMBO -Wall -O2 -o Jd.o -c $HLD.c -# -echo ld -r -o $TARG Jp.o Jb.o Jd.o -ld -r -o $TARG Jp.o Jb.o Jd.o -# -# -rm Jp.o Jb.o Jd.o -# - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: CD oddities with VIA PATA
On Fri, Dec 01, 2006 at 10:01:34PM +, Ken Moffat wrote: > > (i.) cdparanoia (9.8) works for root, but for a user it complains > that the ioctl isn't cooked and refuses to run. For test purposes, > it runs ok for a user as suid root, but I imagine that increases > the likelihood of unspeakable things happening. (Fortunately, I > don't have a dachshund) > Forgot to mention the lines in the log from cdparanoia, but I think these frequent messages are expected: Dec 1 20:35:53 ac30 kernel: sg_write: data in/out 30576/30576 bytes for SCSI command 0xbe--guessing data in; Dec 1 20:35:53 ac30 kernel:program cdparanoia not setting count and/or reply_len properly Also forgot the details of the drive, just in case Dec 1 19:17:14 ac30 kernel: scsi3 : pata_via Dec 1 19:17:14 ac30 kernel: ata4.00: ATAPI, max UDMA/66 Dec 1 19:17:14 ac30 kernel: Losing some ticks... checking if CPU frequency changed. Dec 1 19:17:14 ac30 kernel: ata4.00: configured for UDMA/66 Dec 1 19:17:14 ac30 kernel: scsi 3:0:0:0: CD-ROMLITE-ON DVDRW SHW-1635S YS0G PQ: 0 ANSI: 5 Dec 1 19:17:14 ac30 kernel: sr0: scsi3-mmc drive: 48x/48x writer cd/rw xa/form2 cdda tray Dec 1 19:17:14 ac30 kernel: Uniform CD-ROM driver Revision: 3.20 Dec 1 19:17:14 ac30 kernel: sr 3:0:0:0: Attached scsi CD-ROM sr0 Dec 1 19:17:14 ac30 kernel: sr 3:0:0:0: Attached scsi generic sg1 type 5 Ken -- das eine Mal als Tragödie, das andere Mal als Farce - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [2.6 patch] remove drivers/block/paride/jumbo
On Fri, 1 Dec 2006 23:35:21 +0100 Adrian Bunk <[EMAIL PROTECTED]> wrote: > Let's remove this pre-historic paride building script. > > Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]> Acked-by: Alan Cox <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [2.6 patch] paride: remove parport #ifdef's
On Fri, 1 Dec 2006 23:33:15 +0100 Adrian Bunk <[EMAIL PROTECTED]> wrote: > CONFIG_PARIDE depends on CONFIG_PARPORT_PC, so there's no reason for > these #ifdef's. > > Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]> Acked-by: Alan Cox <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [OHCI] BIOS handoff failed (BIOS bug?)
On Fri, 1 Dec 2006 19:28:55 +0100, Sebastian Kemper <[EMAIL PROTECTED]> wrote: > I also increased the wait time from 5 seconds to 20 in > drivers/usb/host/pci-quirks.c but that didn't change anything. That was a good try, but I thought maybe it needs doing something twice, or having some extra bits set... There's always a possibility that the BIOS refuses the handoff on purpose though. If it does not cause any misbehaviour, it may be safe to ignore. -- Pete - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[GIT PATCH] PCI patches for 2.6.19
Here are some PCI patches for 2.6.19 They contain a number of PCI hotplug driver fixes and changes, and some other stuff that is detailed below. All of these patches have been in the -mm tree for a while. Please pull from: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/pci-2.6.git/ or if master.kernel.org hasn't synced up yet: master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6.git/ The full patches will be sent to the linux-pci mailing list, if anyone wants to see them. thanks, greg k-h arch/i386/kernel/pci-dma.c |4 +- arch/i386/pci/common.c |2 +- arch/i386/pci/fixup.c | 46 --- arch/i386/pci/i386.c| 64 ++- arch/i386/pci/irq.c |6 + arch/ia64/pci/pci.c | 75 ++--- arch/ia64/sn/kernel/Makefile|5 +- arch/ia64/sn/kernel/io_acpi_init.c | 231 +++ arch/ia64/sn/kernel/io_common.c | 613 ++ arch/ia64/sn/kernel/io_init.c | 633 +-- arch/ia64/sn/kernel/iomv.c | 11 +- arch/ia64/sn/kernel/setup.c | 18 + arch/ia64/sn/kernel/tiocx.c |2 +- arch/ia64/sn/pci/pcibr/pcibr_provider.c | 17 +- arch/ia64/sn/pci/tioce_provider.c | 18 - arch/powerpc/platforms/powermac/pci.c |1 - arch/sparc64/kernel/pci.c |9 - drivers/i2c/busses/Kconfig |1 + drivers/i2c/busses/i2c-i801.c |2 + drivers/message/i2o/pci.c | 15 +- drivers/pci/Kconfig |2 +- drivers/pci/access.c| 75 +++-- drivers/pci/hotplug/acpiphp.h |4 +- drivers/pci/hotplug/acpiphp_core.c | 39 +-- drivers/pci/hotplug/acpiphp_glue.c |8 +- drivers/pci/hotplug/ibmphp_pci.c|4 +- drivers/pci/hotplug/pciehp_core.c |7 +- drivers/pci/hotplug/pciehp_hpc.c|2 - drivers/pci/hotplug/rpadlpar_core.c |2 +- drivers/pci/hotplug/rpaphp_core.c |2 +- drivers/pci/hotplug/sgi_hotplug.c | 35 +- drivers/pci/msi.h |8 - drivers/pci/pci-acpi.c | 10 +- drivers/pci/pci-driver.c| 11 +- drivers/pci/pci-sysfs.c | 33 +- drivers/pci/pci.c | 123 +- drivers/pci/pci.h |1 + drivers/pci/probe.c | 27 ++ drivers/pci/quirks.c| 59 +--- drivers/pci/rom.c |9 +- include/asm-ia64/io.h |2 +- include/asm-ia64/machvec.h | 12 + include/asm-ia64/machvec_sn2.h |2 + include/asm-ia64/pci.h | 21 +- include/asm-ia64/sn/acpi.h | 16 + include/asm-ia64/sn/pcidev.h| 22 +- include/asm-ia64/sn/sn_feature_sets.h |6 + include/asm-ia64/sn/sn_sal.h|1 + include/asm-powerpc/pci.h | 20 +- include/asm-sparc64/pci.h |6 +- include/linux/ioport.h |1 + include/linux/pci.h |3 +- include/linux/pci_ids.h |7 + include/linux/pci_regs.h|6 + 54 files changed, 1400 insertions(+), 959 deletions(-) create mode 100644 arch/ia64/sn/kernel/io_acpi_init.c create mode 100644 arch/ia64/sn/kernel/io_common.c create mode 100644 include/asm-ia64/sn/acpi.h --- Adrian Bunk (2): PCI: ibmphp_pci.c: fix NULL dereference PCI: make arch/i386/pci/common.c:pci_bf_sort static Akinobu Mita (3): acpiphp: fix use of list_for_each macro acpiphp: fix missing acpiphp_glue_exit() pci: fix __pci_register_driver error handling Alan Cox (1): PCI: quirks: fix the festering mess that claims to handle IDE quirks Amol Lad (1): PCI: arch/i386/kernel/pci-dma.c: ioremap balanced with iounmap Greg Kroah-Hartman (1): PCI: Let PCI_MULTITHREAD_PROBE not be broken Inaky Perez-Gonzalez (2): PCI: switch pci_{enable,disable}_device() to be nestable PCI: pci_{enable,disable}_device() nestable ports Jason Gaston (2): PCI: irq: irq and pci_ids patch for Intel ICH9 i2c-i801: SMBus patch for Intel ICH9 John Keller (3): Altix: Add initial ACPI IO support Altix: SN ACPI hotplug support. Altix: Initial ACPI support - ROM shadowing. John Rose (1): PCI: rpaphp: change device tree examination Kenji Kaneshige (2): pciehp: remove unnecessary free_irq pciehp: remove unnecessary pci_disable_msi Kristen Carlson Accardi (1): pci: clear osc support flags if no _OSC method Matthew Wilcox (5): PCI: Use pci_generic_prep_mwi on ia64 PCI: Use pci_generic_prep_mwi on sparc64 PCI: Replace HAVE_ARCH_PCI_MWI with PCI_DISABLE_MWI PCI: Delete unused extern in powermac/pci.c
[GIT PATCH] Driver core patches for 2.6.19
Here are some driver core patches for 2.6.19 They contain: - driver core rework to allow code to move over to using 'struct device' instead of 'struct class_device'. This also entails full backward compatibility for distros that are using older versions of udev. - the conversion of a number of subsystems to use 'struct device' (note, the network conversion patches are on hold until some ieee1394 changes get made, which are still in my queue. That patch will remain in -mm until that happens.) - changes in the driver core that are needed by the PPC developers to handle their open-firmware based systems. - documentation update for platform devices. - other minor cleanups and fixes. All of these patches have been in the -mm tree for a quite a while. Please pull from: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6.git/ or if master.kernel.org hasn't synced up yet: master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6.git/ Patches will be sent as a follow-on to this message to lkml for people to see. thanks, greg k-h Documentation/driver-model/platform.txt | 204 +++--- arch/i386/kernel/cpuid.c| 20 ++-- arch/i386/kernel/msr.c | 20 ++-- drivers/acpi/glue.c | 20 ++-- drivers/base/bus.c | 34 - drivers/base/class.c| 166 +- drivers/base/core.c | 237 --- drivers/base/dd.c | 92 drivers/base/firmware_class.c | 119 drivers/base/platform.c | 48 ++ drivers/base/topology.c | 55 --- drivers/char/hw_random/core.c | 38 +++--- drivers/char/mem.c |8 +- drivers/char/misc.c | 13 +-- drivers/char/ppdev.c|6 +- drivers/char/raw.c | 12 +- drivers/char/tpm/tpm.c |2 +- drivers/char/tty_io.c | 19 ++-- drivers/char/vc_screen.c| 16 +- drivers/char/vt.c | 81 +-- drivers/i2c/i2c-dev.c | 26 ++-- drivers/input/serio/serio_raw.c |2 +- drivers/isdn/gigaset/common.c |2 +- drivers/isdn/gigaset/gigaset.h |2 +- drivers/isdn/gigaset/interface.c| 10 +- drivers/isdn/gigaset/proc.c | 19 ++-- drivers/mmc/mmc_queue.c |4 +- drivers/mmc/mmc_sysfs.c | 20 ++-- drivers/mmc/wbsd.c |6 +- drivers/net/ppp_generic.c |4 +- drivers/video/fbmem.c | 16 +- drivers/video/fbsysfs.c | 163 -- fs/sysfs/dir.c | 45 ++ fs/sysfs/file.c |3 + include/acpi/acpi_bus.h |2 +- include/asm-alpha/device.h |7 + include/asm-arm/device.h|7 + include/asm-arm26/device.h |7 + include/asm-avr32/device.h |7 + include/asm-cris/device.h |7 + include/asm-frv/device.h|7 + include/asm-generic/device.h| 12 ++ include/asm-h8300/device.h |7 + include/asm-i386/device.h | 15 ++ include/asm-ia64/device.h | 15 ++ include/asm-m32r/device.h |7 + include/asm-m68k/device.h |7 + include/asm-m68knommu/device.h |7 + include/asm-mips/device.h |7 + include/asm-parisc/device.h |7 + include/asm-powerpc/device.h|7 + include/asm-ppc/device.h|7 + include/asm-s390/device.h |7 + include/asm-sh/device.h |7 + include/asm-sh64/device.h |7 + include/asm-sparc/device.h |7 + include/asm-sparc64/device.h|7 + include/asm-um/device.h |7 + include/asm-v850/device.h |7 + include/asm-x86_64/device.h | 15 ++ include/asm-xtensa/device.h |7 + include/linux/device.h | 35 - include/linux/fb.h |8 +- include/linux/kobject.h |8 + include/linux/miscdevice.h |5 +- include/linux/mmc/host.h|8 +- include/linux/module.h |1 + include/linux/platform_device.h |6 + include/linux/sysfs.h |8 + include/linux/tty.h |5 +- include/sound/core.h|8 +- init/Kconfig| 20 +++ k
[PATCH 2/36] Driver core: fix "driver" symlink timing
From: Kay Sievers <[EMAIL PROTECTED]> Create the "driver" link before the child device may be created by the probing logic. This makes it possible for userspace (udev), to determine the driver property of the parent device, at the time the child device is created. Signed-off-by: Kay Sievers <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/base/dd.c | 82 +--- 1 files changed, 52 insertions(+), 30 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 9c88b1e..510e788 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -26,28 +26,12 @@ #define to_drv(node) container_of(node, struct device_driver, kobj.entry) -/** - * device_bind_driver - bind a driver to one device. - * @dev: device. - * - * Allow manual attachment of a driver to a device. - * Caller must have already set @dev->driver. - * - * Note that this does not modify the bus reference count - * nor take the bus's rwsem. Please verify those are accounted - * for before calling this. (It is ok to call with no other effort - * from a driver's probe() method.) - * - * This function must be called with @dev->sem held. - */ -int device_bind_driver(struct device *dev) +static void driver_bound(struct device *dev) { - int ret; - if (klist_node_attached(&dev->knode_driver)) { printk(KERN_WARNING "%s: device %s already bound\n", __FUNCTION__, kobject_name(&dev->kobj)); - return 0; + return; } pr_debug("bound device '%s' to driver '%s'\n", @@ -58,6 +42,12 @@ int device_bind_driver(struct device *de BUS_NOTIFY_BOUND_DRIVER, dev); klist_add_tail(&dev->knode_driver, &dev->driver->klist_devices); +} + +static int driver_sysfs_add(struct device *dev) +{ + int ret; + ret = sysfs_create_link(&dev->driver->kobj, &dev->kobj, kobject_name(&dev->kobj)); if (ret == 0) { @@ -70,6 +60,36 @@ int device_bind_driver(struct device *de return ret; } +static void driver_sysfs_remove(struct device *dev) +{ + struct device_driver *drv = dev->driver; + + if (drv) { + sysfs_remove_link(&drv->kobj, kobject_name(&dev->kobj)); + sysfs_remove_link(&dev->kobj, "driver"); + } +} + +/** + * device_bind_driver - bind a driver to one device. + * @dev: device. + * + * Allow manual attachment of a driver to a device. + * Caller must have already set @dev->driver. + * + * Note that this does not modify the bus reference count + * nor take the bus's rwsem. Please verify those are accounted + * for before calling this. (It is ok to call with no other effort + * from a driver's probe() method.) + * + * This function must be called with @dev->sem held. + */ +int device_bind_driver(struct device *dev) +{ + driver_bound(dev); + return driver_sysfs_add(dev); +} + struct stupid_thread_structure { struct device_driver *drv; struct device *dev; @@ -90,30 +110,32 @@ static int really_probe(void *void_data) drv->bus->name, drv->name, dev->bus_id); dev->driver = drv; + if (driver_sysfs_add(dev)) { + printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n", + __FUNCTION__, dev->bus_id); + goto probe_failed; + } + if (dev->bus->probe) { ret = dev->bus->probe(dev); - if (ret) { - dev->driver = NULL; + if (ret) goto probe_failed; - } } else if (drv->probe) { ret = drv->probe(dev); - if (ret) { - dev->driver = NULL; + if (ret) goto probe_failed; - } - } - if (device_bind_driver(dev)) { - printk(KERN_ERR "%s: device_bind_driver(%s) failed\n", - __FUNCTION__, dev->bus_id); - /* How does undo a ->probe? We're screwed. */ } + + driver_bound(dev); ret = 1; pr_debug("%s: Bound Device %s to Driver %s\n", drv->bus->name, dev->bus_id, drv->name); goto done; probe_failed: + driver_sysfs_remove(dev); + dev->driver = NULL; + if (ret == -ENODEV || ret == -ENXIO) { /* Driver matched, but didn't support device * or device not found. @@ -289,7 +311,7 @@ static void __device_release_driver(stru drv = dev->driver; if (drv) { get_driver(drv); - sysfs_remove_link(&drv->kobj, kobject_name(&dev->kobj)); + driver_sysfs_remove(dev); sysfs_remove_link(&dev->kobj, "driver"); klist_remove(&dev->knode_dri
[PATCH 8/36] CONFIG_SYSFS_DEPRECATED - PHYSDEV* uevent variables
From: Kay Sievers <[EMAIL PROTECTED]> Disable the PHYSDEV* uevent variables if CONFIG_SYSFS_DEPRECATED is enabled. Signed-off-by: Kay Sievers <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/base/core.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index b565b7e..f544adc 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -154,20 +154,24 @@ static int dev_uevent(struct kset *kset, "MINOR=%u", MINOR(dev->devt)); } +#ifdef CONFIG_SYSFS_DEPRECATED /* add bus name (same as SUBSYSTEM, deprecated) */ if (dev->bus) add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, "PHYSDEVBUS=%s", dev->bus->name); +#endif /* add driver name (PHYSDEV* values are deprecated)*/ if (dev->driver) { add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, "DRIVER=%s", dev->driver->name); +#ifdef CONFIG_SYSFS_DEPRECATED add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, "PHYSDEVDRIVER=%s", dev->driver->name); +#endif } /* terminate, set to next free slot, shrink available space */ -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/36] Driver core: add notification of bus events
From: Benjamin Herrenschmidt <[EMAIL PROTECTED]> I finally did as you suggested and added the notifier to the struct bus_type itself. There are still problems to be expected is something attaches to a bus type where the code can hook in different struct device sub-classes (which is imho a big bogosity but I won't even try to argue that case now) but it will solve nicely a number of issues I've had so far. That also means that clients interested in registering for such notifications have to do it before devices are added and after bus types are registered. Fortunately, most bus types that matter for the various usage scenarios I have in mind are registerd at postcore_initcall time, which means I have a really nice spot at arch_initcall time to add my notifiers. There are 4 notifications provided. Device being added (before hooked to the bus) and removed (failure of previous case or after being unhooked from the bus), along with driver being bound to a device and about to be unbound. The usage I have for these are: - The 2 first ones are used to maintain a struct device_ext that is hooked to struct device.firmware_data. This structure contains for now a pointer to the Open Firmware node related to the device (if any), the NUMA node ID (for quick access to it) and the DMA operations pointers & iommu table instance for DMA to/from this device. For bus types I own (like IBM VIO or EBUS), I just maintain that structure directly from the bus code when creating the devices. But for bus types managed by generic code like PCI or platform (actually, of_platform which is a variation of platform linked to Open Firmware device-tree), I need this notifier. - The other two ones have a completely different usage scenario. I have cases where multiple devices and their drivers depend on each other. For example, the IBM EMAC network driver needs to attach to a MAL DMA engine which is a separate device, and a PHY interface which is also a separate device. They are all of_platform_device's (well, about to be with my upcoming patches) but there is no say in what precise order the core will "probe" them and instanciate the various modules. The solution I found for that is to have the drivers for emac to use multithread_probe, and wait for a driver to be bound to the target MAL and PHY control devices (the device-tree contains reference to the MAL and PHY interface nodes, which I can then match to of_platform_devices). Right now, I've been polling, but with that notifier, I can more cleanly wait (with a timeout of course). Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/base/bus.c | 14 ++ drivers/base/core.c| 12 drivers/base/dd.c | 10 ++ include/linux/device.h | 25 + 4 files changed, 61 insertions(+), 0 deletions(-) diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 7d8a7ce..ed3e8a2 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -724,6 +724,8 @@ int bus_register(struct bus_type * bus) { int retval; + BLOCKING_INIT_NOTIFIER_HEAD(&bus->bus_notifier); + retval = kobject_set_name(&bus->subsys.kset.kobj, "%s", bus->name); if (retval) goto out; @@ -782,6 +784,18 @@ void bus_unregister(struct bus_type * bu subsystem_unregister(&bus->subsys); } +int bus_register_notifier(struct bus_type *bus, struct notifier_block *nb) +{ + return blocking_notifier_chain_register(&bus->bus_notifier, nb); +} +EXPORT_SYMBOL_GPL(bus_register_notifier); + +int bus_unregister_notifier(struct bus_type *bus, struct notifier_block *nb) +{ + return blocking_notifier_chain_unregister(&bus->bus_notifier, nb); +} +EXPORT_SYMBOL_GPL(bus_unregister_notifier); + int __init buses_init(void) { return subsystem_register(&bus_subsys); diff --git a/drivers/base/core.c b/drivers/base/core.c index 002fde4..d4f35d8 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -17,6 +17,7 @@ #include #include #include +#include #include @@ -428,6 +429,11 @@ int device_add(struct device *dev) if (platform_notify) platform_notify(dev); + /* notify clients of device entry (new way) */ + if (dev->bus) + blocking_notifier_call_chain(&dev->bus->bus_notifier, +BUS_NOTIFY_ADD_DEVICE, dev); + dev->uevent_attr.attr.name = "uevent"; dev->uevent_attr.attr.mode = S_IWUSR; if (dev->driver) @@ -504,6 +510,9 @@ int device_add(struct device *dev) BusError: device_pm_remove(dev); PMError: + if (dev->bus) + blocking_notifier_call_chain(&dev->bus->bus_notifier, +BUS_NOTIFY_DEL_DEVICE, dev); device_remove_groups(dev); GroupError: device_remove_attrs(dev); @@ -622,6 +631,9 @@ void device_del(struct device * dev
[PATCH] Be a bit defensive in quirk_nvidia_ck804() so we don't risk dereferencing a NULL pdev.
pci_get_slot() may return NULL if nothing was found. quirk_nvidia_ck804() does not check the value returned from pci_get_slot(), so it may end up causing a NULL pointer deref. Signed-off-by: Jesper Juhl <[EMAIL PROTECTED]> --- drivers/pci/quirks.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 5b44838..d3dcbda 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -1741,6 +1741,8 @@ static void __devinit quirk_nvidia_ck804 * a single one having MSI is enough to be sure that MSI are supported. */ pdev = pci_get_slot(dev->bus, 0); + if (!pdev) + return; if (dev->subordinate && !msi_ht_cap_enabled(dev) && !msi_ht_cap_enabled(pdev)) { printk(KERN_WARNING "PCI: MSI quirk detected. " - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 7/36] CONFIG_SYSFS_DEPRECATED - device symlinks
From: Kay Sievers <[EMAIL PROTECTED]> Turn off device symlinks CONFIG_SYSFS_DEPRECATED is enabled. Signed-off-by: Kay Sievers <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/base/core.c | 18 ++ 1 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 8f8347b..b565b7e 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -513,11 +513,13 @@ int device_add(struct device *dev) if (dev->kobj.parent != &dev->class->subsys.kset.kobj) sysfs_create_link(&dev->class->subsys.kset.kobj, &dev->kobj, dev->bus_id); +#ifdef CONFIG_SYSFS_DEPRECATED if (parent) { sysfs_create_link(&dev->kobj, &dev->parent->kobj, "device"); class_name = make_class_name(dev->class->name, &dev->kobj); sysfs_create_link(&dev->parent->kobj, &dev->kobj, class_name); } +#endif } if ((error = device_add_attrs(dev))) @@ -639,7 +641,6 @@ void put_device(struct device * dev) void device_del(struct device * dev) { struct device * parent = dev->parent; - char *class_name = NULL; struct class_interface *class_intf; if (parent) @@ -655,12 +656,16 @@ void device_del(struct device * dev) if (dev->kobj.parent != &dev->class->subsys.kset.kobj) sysfs_remove_link(&dev->class->subsys.kset.kobj, dev->bus_id); - class_name = make_class_name(dev->class->name, &dev->kobj); +#ifdef CONFIG_SYSFS_DEPRECATED if (parent) { - sysfs_remove_link(&dev->kobj, "device"); + char *class_name = make_class_name(dev->class->name, + &dev->kobj); sysfs_remove_link(&dev->parent->kobj, class_name); + kfree(class_name); + sysfs_remove_link(&dev->kobj, "device"); } - kfree(class_name); +#endif + down(&dev->class->sem); /* notify any interfaces that the device is now gone */ list_for_each_entry(class_intf, &dev->class->interfaces, node) @@ -869,8 +874,10 @@ int device_rename(struct device *dev, ch pr_debug("DEVICE: renaming '%s' to '%s'\n", dev->bus_id, new_name); +#ifdef CONFIG_SYSFS_DEPRECATED if ((dev->class) && (dev->parent)) old_class_name = make_class_name(dev->class->name, &dev->kobj); +#endif if (dev->class) { old_symlink_name = kmalloc(BUS_ID_SIZE, GFP_KERNEL); @@ -885,6 +892,7 @@ int device_rename(struct device *dev, ch error = kobject_rename(&dev->kobj, new_name); +#ifdef CONFIG_SYSFS_DEPRECATED if (old_class_name) { new_class_name = make_class_name(dev->class->name, &dev->kobj); if (new_class_name) { @@ -893,6 +901,8 @@ int device_rename(struct device *dev, ch sysfs_remove_link(&dev->parent->kobj, old_class_name); } } +#endif + if (dev->class) { sysfs_remove_link(&dev->class->subsys.kset.kobj, old_symlink_name); -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 36/36] Driver core: show drivers in /sys/module/
From: Kay Sievers <[EMAIL PROTECTED]> Show the drivers, which belong to the module: $ ls -l /sys/module/usbcore/drivers/ hub -> ../../../bus/usb/drivers/hub usb -> ../../../bus/usb/drivers/usb usbfs -> ../../../bus/usb/drivers/usbfs Signed-off-by: Kay Sievers <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- include/linux/module.h |1 + kernel/module.c| 31 +-- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/include/linux/module.h b/include/linux/module.h index d1d00ce..9258ffd 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -264,6 +264,7 @@ struct module struct module_attribute *modinfo_attrs; const char *version; const char *srcversion; + struct kobject *drivers_dir; /* Exported symbols */ const struct kernel_symbol *syms; diff --git a/kernel/module.c b/kernel/module.c index f016656..45e01cb 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -1086,22 +1086,35 @@ static int mod_sysfs_setup(struct module goto out; kobj_set_kset_s(&mod->mkobj, module_subsys); mod->mkobj.mod = mod; - err = kobject_register(&mod->mkobj.kobj); + + /* delay uevent until full sysfs population */ + kobject_init(&mod->mkobj.kobj); + err = kobject_add(&mod->mkobj.kobj); if (err) goto out; + mod->drivers_dir = kobject_add_dir(&mod->mkobj.kobj, "drivers"); + if (!mod->drivers_dir) + goto out_unreg; + err = module_param_sysfs_setup(mod, kparam, num_params); if (err) - goto out_unreg; + goto out_unreg_drivers; err = module_add_modinfo_attrs(mod); if (err) - goto out_unreg; + goto out_unreg_param; + kobject_uevent(&mod->mkobj.kobj, KOBJ_ADD); return 0; +out_unreg_drivers: + kobject_unregister(mod->drivers_dir); +out_unreg_param: + module_param_sysfs_remove(mod); out_unreg: - kobject_unregister(&mod->mkobj.kobj); + kobject_del(&mod->mkobj.kobj); + kobject_put(&mod->mkobj.kobj); out: return err; } @@ -1110,6 +1123,7 @@ static void mod_kobject_remove(struct mo { module_remove_modinfo_attrs(mod); module_param_sysfs_remove(mod); + kobject_unregister(mod->drivers_dir); kobject_unregister(&mod->mkobj.kobj); } @@ -2275,11 +2289,14 @@ void print_modules(void) void module_add_driver(struct module *mod, struct device_driver *drv) { + int no_warn; + if (!mod || !drv) return; - /* Don't check return code; this call is idempotent */ - sysfs_create_link(&drv->kobj, &mod->mkobj.kobj, "module"); + /* Don't check return codes; these calls are idempotent */ + no_warn = sysfs_create_link(&drv->kobj, &mod->mkobj.kobj, "module"); + no_warn = sysfs_create_link(mod->drivers_dir, &drv->kobj, drv->name); } EXPORT_SYMBOL(module_add_driver); @@ -2288,6 +2305,8 @@ void module_remove_driver(struct device_ if (!drv) return; sysfs_remove_link(&drv->kobj, "module"); + if (drv->owner && drv->owner->drivers_dir) + sysfs_remove_link(drv->owner->drivers_dir, drv->name); } EXPORT_SYMBOL(module_remove_driver); -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/36] Driver Core: Move virtual_device_parent() to core.c
From: Greg Kroah-Hartman <[EMAIL PROTECTED]> It doesn't need to be global or in device.h Cc: Kay Sievers <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/base/class.c | 17 - drivers/base/core.c| 17 + include/linux/device.h |2 -- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/base/class.c b/drivers/base/class.c index 0ff267a..2e705f6 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -893,23 +893,6 @@ void class_interface_unregister(struct c class_put(parent); } -int virtual_device_parent(struct device *dev) -{ - if (!dev->class) - return -ENODEV; - - if (!dev->class->virtual_dir) { - static struct kobject *virtual_dir = NULL; - - if (!virtual_dir) - virtual_dir = kobject_add_dir(&devices_subsys.kset.kobj, "virtual"); - dev->class->virtual_dir = kobject_add_dir(virtual_dir, dev->class->name); - } - - dev->kobj.parent = dev->class->virtual_dir; - return 0; -} - int __init classes_init(void) { int retval; diff --git a/drivers/base/core.c b/drivers/base/core.c index d4f35d8..dbcd40b 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -384,6 +384,23 @@ void device_initialize(struct device *de device_init_wakeup(dev, 0); } +static int virtual_device_parent(struct device *dev) +{ + if (!dev->class) + return -ENODEV; + + if (!dev->class->virtual_dir) { + static struct kobject *virtual_dir = NULL; + + if (!virtual_dir) + virtual_dir = kobject_add_dir(&devices_subsys.kset.kobj, "virtual"); + dev->class->virtual_dir = kobject_add_dir(virtual_dir, dev->class->name); + } + + dev->kobj.parent = dev->class->virtual_dir; + return 0; +} + /** * device_add - add device to device hierarchy. * @dev: device. diff --git a/include/linux/device.h b/include/linux/device.h index b00e027..00b29e0 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -440,8 +440,6 @@ extern struct device *device_create(stru __attribute__((format(printf,4,5))); extern void device_destroy(struct class *cls, dev_t devt); -extern int virtual_device_parent(struct device *dev); - /* * Platform "fixup" functions - allow the platform to have their say * about devices and actions that the general device layer doesn't -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 10/36] Driver core: convert vt code to use struct device
From: Greg Kroah-Hartman <[EMAIL PROTECTED]> Converts from using struct "class_device" to "struct device" making everything show up properly in /sys/devices/ with symlinks from the /sys/class directory. Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/char/vt.c | 81 +--- 1 files changed, 39 insertions(+), 42 deletions(-) diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 8e4413f..87587b4 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c @@ -112,7 +112,7 @@ struct con_driver { const struct consw *con; const char *desc; - struct class_device *class_dev; + struct device *dev; int node; int first; int last; @@ -3023,10 +3023,10 @@ static inline int vt_unbind(struct con_d } #endif /* CONFIG_VT_HW_CONSOLE_BINDING */ -static ssize_t store_bind(struct class_device *class_device, +static ssize_t store_bind(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct con_driver *con = class_get_devdata(class_device); + struct con_driver *con = dev_get_drvdata(dev); int bind = simple_strtoul(buf, NULL, 0); if (bind) @@ -3037,17 +3037,19 @@ static ssize_t store_bind(struct class_d return count; } -static ssize_t show_bind(struct class_device *class_device, char *buf) +static ssize_t show_bind(struct device *dev, struct device_attribute *attr, +char *buf) { - struct con_driver *con = class_get_devdata(class_device); + struct con_driver *con = dev_get_drvdata(dev); int bind = con_is_bound(con->con); return snprintf(buf, PAGE_SIZE, "%i\n", bind); } -static ssize_t show_name(struct class_device *class_device, char *buf) +static ssize_t show_name(struct device *dev, struct device_attribute *attr, +char *buf) { - struct con_driver *con = class_get_devdata(class_device); + struct con_driver *con = dev_get_drvdata(dev); return snprintf(buf, PAGE_SIZE, "%s %s\n", (con->flag & CON_DRIVER_FLAG_MODULE) ? "(M)" : "(S)", @@ -3055,43 +3057,40 @@ static ssize_t show_name(struct class_de } -static struct class_device_attribute class_device_attrs[] = { +static struct device_attribute device_attrs[] = { __ATTR(bind, S_IRUGO|S_IWUSR, show_bind, store_bind), __ATTR(name, S_IRUGO, show_name, NULL), }; -static int vtconsole_init_class_device(struct con_driver *con) +static int vtconsole_init_device(struct con_driver *con) { int i; int error = 0; con->flag |= CON_DRIVER_FLAG_ATTR; - class_set_devdata(con->class_dev, con); - for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) { - error = class_device_create_file(con->class_dev, -&class_device_attrs[i]); + dev_set_drvdata(con->dev, con); + for (i = 0; i < ARRAY_SIZE(device_attrs); i++) { + error = device_create_file(con->dev, &device_attrs[i]); if (error) break; } if (error) { while (--i >= 0) - class_device_remove_file(con->class_dev, -&class_device_attrs[i]); + device_remove_file(con->dev, &device_attrs[i]); con->flag &= ~CON_DRIVER_FLAG_ATTR; } return error; } -static void vtconsole_deinit_class_device(struct con_driver *con) +static void vtconsole_deinit_device(struct con_driver *con) { int i; if (con->flag & CON_DRIVER_FLAG_ATTR) { - for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) - class_device_remove_file(con->class_dev, -&class_device_attrs[i]); + for (i = 0; i < ARRAY_SIZE(device_attrs); i++) + device_remove_file(con->dev, &device_attrs[i]); con->flag &= ~CON_DRIVER_FLAG_ATTR; } } @@ -3179,18 +3178,17 @@ int register_con_driver(const struct con if (retval) goto err; - con_driver->class_dev = class_device_create(vtconsole_class, NULL, - MKDEV(0, con_driver->node), - NULL, "vtcon%i", - con_driver->node); + con_driver->dev = device_create(vtconsole_class, NULL, + MKDEV(0, con_driver->node), + "vtcon%i", con_driver->node); - if (IS_ERR(con_driver->class_dev)) { - printk(KERN_WARNING "Unable to create class_device for %s; " + if (IS_ERR(con_driver->dev)) { + printk(KERN_WARNING "Unable to create device for %s; "
[PATCH 31/36] Driver core: make drivers/base/core.c:setup_parent() static
From: Adrian Bunk <[EMAIL PROTECTED]> This patch makes the needlessly global setup_parent() static. Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/base/core.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index a29e685..75b45a1 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -389,7 +389,7 @@ void device_initialize(struct device *de } #ifdef CONFIG_SYSFS_DEPRECATED -int setup_parent(struct device *dev, struct device *parent) +static int setup_parent(struct device *dev, struct device *parent) { /* Set the parent to the class, not the parent device */ /* this keeps sysfs from having a symlink to make old udevs happy */ @@ -418,7 +418,7 @@ static int virtual_device_parent(struct return 0; } -int setup_parent(struct device *dev, struct device *parent) +static int setup_parent(struct device *dev, struct device *parent) { int error; -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 33/36] driver core: Use klist_remove() in device_move()
From: Cornelia Huck <[EMAIL PROTECTED]> As pointed out by Alan Stern, device_move needs to use klist_remove which waits until removal is complete. Signed-off-by: Cornelia Huck <[EMAIL PROTECTED]> Cc: Alan Stern <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/base/core.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index e4eaf46..e4b530e 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1022,7 +1022,7 @@ int device_move(struct device *dev, stru old_parent = dev->parent; dev->parent = new_parent; if (old_parent) - klist_del(&dev->knode_parent); + klist_remove(&dev->knode_parent); klist_add_tail(&dev->knode_parent, &new_parent->klist_children); if (!dev->class) goto out_put; @@ -1031,7 +1031,7 @@ int device_move(struct device *dev, stru /* We ignore errors on cleanup since we're hosed anyway... */ device_move_class_links(dev, new_parent, old_parent); if (!kobject_move(&dev->kobj, &old_parent->kobj)) { - klist_del(&dev->knode_parent); + klist_remove(&dev->knode_parent); if (old_parent) klist_add_tail(&dev->knode_parent, &old_parent->klist_children); -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 21/36] Driver core: convert firmware code to use struct device
From: Greg Kroah-Hartman <[EMAIL PROTECTED]> Converts from using struct "class_device" to "struct device" making everything show up properly in /sys/devices/ with symlinks from the /sys/class directory. Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/base/firmware_class.c | 119 +++- 1 files changed, 57 insertions(+), 62 deletions(-) diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 1461569..4bad287 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -21,6 +21,8 @@ #include #include "base.h" +#define to_dev(obj) container_of(obj, struct device, kobj) + MODULE_AUTHOR("Manuel Estrada Sainz <[EMAIL PROTECTED]>"); MODULE_DESCRIPTION("Multi purpose firmware loading support"); MODULE_LICENSE("GPL"); @@ -86,12 +88,12 @@ firmware_timeout_store(struct class *cla static CLASS_ATTR(timeout, 0644, firmware_timeout_show, firmware_timeout_store); -static void fw_class_dev_release(struct class_device *class_dev); +static void fw_dev_release(struct device *dev); -static int firmware_class_uevent(struct class_device *class_dev, char **envp, -int num_envp, char *buffer, int buffer_size) +static int firmware_uevent(struct device *dev, char **envp, int num_envp, + char *buffer, int buffer_size) { - struct firmware_priv *fw_priv = class_get_devdata(class_dev); + struct firmware_priv *fw_priv = dev_get_drvdata(dev); int i = 0, len = 0; if (!test_bit(FW_STATUS_READY, &fw_priv->status)) @@ -110,21 +112,21 @@ static int firmware_class_uevent(struct static struct class firmware_class = { .name = "firmware", - .uevent = firmware_class_uevent, - .release= fw_class_dev_release, + .dev_uevent = firmware_uevent, + .dev_release= fw_dev_release, }; -static ssize_t -firmware_loading_show(struct class_device *class_dev, char *buf) +static ssize_t firmware_loading_show(struct device *dev, +struct device_attribute *attr, char *buf) { - struct firmware_priv *fw_priv = class_get_devdata(class_dev); + struct firmware_priv *fw_priv = dev_get_drvdata(dev); int loading = test_bit(FW_STATUS_LOADING, &fw_priv->status); return sprintf(buf, "%d\n", loading); } /** * firmware_loading_store - set value in the 'loading' control file - * @class_dev: class_device pointer + * @dev: device pointer * @buf: buffer to scan for loading control value * @count: number of bytes in @buf * @@ -134,11 +136,11 @@ firmware_loading_show(struct class_devic * 0: Conclude the load and hand the data to the driver code. * -1: Conclude the load with an error and discard any written data. **/ -static ssize_t -firmware_loading_store(struct class_device *class_dev, - const char *buf, size_t count) +static ssize_t firmware_loading_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { - struct firmware_priv *fw_priv = class_get_devdata(class_dev); + struct firmware_priv *fw_priv = dev_get_drvdata(dev); int loading = simple_strtol(buf, NULL, 10); switch (loading) { @@ -174,15 +176,14 @@ firmware_loading_store(struct class_devi return count; } -static CLASS_DEVICE_ATTR(loading, 0644, - firmware_loading_show, firmware_loading_store); +static DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store); static ssize_t firmware_data_read(struct kobject *kobj, char *buffer, loff_t offset, size_t count) { - struct class_device *class_dev = to_class_dev(kobj); - struct firmware_priv *fw_priv = class_get_devdata(class_dev); + struct device *dev = to_dev(kobj); + struct firmware_priv *fw_priv = dev_get_drvdata(dev); struct firmware *fw; ssize_t ret_count = count; @@ -234,7 +235,7 @@ fw_realloc_buffer(struct firmware_priv * /** * firmware_data_write - write method for firmware - * @kobj: kobject for the class_device + * @kobj: kobject for the device * @buffer: buffer being written * @offset: buffer offset for write in total data store area * @count: buffer size @@ -246,8 +247,8 @@ static ssize_t firmware_data_write(struct kobject *kobj, char *buffer, loff_t offset, size_t count) { - struct class_device *class_dev = to_class_dev(kobj); - struct firmware_priv *fw_priv = class_get_devdata(class_dev); + struct device *dev = to_dev(kobj); + struct firmware_priv *fw_priv = dev_get_drvdata(dev); struct firmware *fw; ssize_t retval; @@ -280,13 +281,12 @@ static struct bin_attribute firmware_att .write = firmware_data_write, }; -static void -fw_class_dev_release(st
[PATCH 22/36] Driver core: convert fb code to use struct device
From: Greg Kroah-Hartman <[EMAIL PROTECTED]> Converts from using struct "class_device" to "struct device" making everything show up properly in /sys/devices/ with symlinks from the /sys/class directory. Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/video/fbmem.c | 16 ++-- drivers/video/fbsysfs.c | 163 ++- include/linux/fb.h |8 +- 3 files changed, 103 insertions(+), 84 deletions(-) diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 93ffcdd..e973a87 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -1296,14 +1296,14 @@ register_framebuffer(struct fb_info *fb_ break; fb_info->node = i; - fb_info->class_device = class_device_create(fb_class, NULL, MKDEV(FB_MAJOR, i), - fb_info->device, "fb%d", i); - if (IS_ERR(fb_info->class_device)) { + fb_info->dev = device_create(fb_class, fb_info->device, +MKDEV(FB_MAJOR, i), "fb%d", i); + if (IS_ERR(fb_info->dev)) { /* Not fatal */ - printk(KERN_WARNING "Unable to create class_device for framebuffer %d; errno = %ld\n", i, PTR_ERR(fb_info->class_device)); - fb_info->class_device = NULL; + printk(KERN_WARNING "Unable to create device for framebuffer %d; errno = %ld\n", i, PTR_ERR(fb_info->dev)); + fb_info->dev = NULL; } else - fb_init_class_device(fb_info); + fb_init_device(fb_info); if (fb_info->pixmap.addr == NULL) { fb_info->pixmap.addr = kmalloc(FBPIXMAPSIZE, GFP_KERNEL); @@ -1356,8 +1356,8 @@ unregister_framebuffer(struct fb_info *f fb_destroy_modelist(&fb_info->modelist); registered_fb[i]=NULL; num_registered_fb--; - fb_cleanup_class_device(fb_info); - class_device_destroy(fb_class, MKDEV(FB_MAJOR, i)); + fb_cleanup_device(fb_info); + device_destroy(fb_class, MKDEV(FB_MAJOR, i)); event.info = fb_info; fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event); return 0; diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c index d3a5041..323bdf6 100644 --- a/drivers/video/fbsysfs.c +++ b/drivers/video/fbsysfs.c @@ -73,7 +73,7 @@ EXPORT_SYMBOL(framebuffer_alloc); * * @info: frame buffer info structure * - * Drop the reference count of the class_device embedded in the + * Drop the reference count of the device embedded in the * framebuffer info structure. * */ @@ -120,10 +120,10 @@ static int mode_string(char *buf, unsign m, mode->xres, mode->yres, v, mode->refresh); } -static ssize_t store_mode(struct class_device *class_device, const char * buf, - size_t count) +static ssize_t store_mode(struct device *device, struct device_attribute *attr, + const char *buf, size_t count) { - struct fb_info *fb_info = class_get_devdata(class_device); + struct fb_info *fb_info = dev_get_drvdata(device); char mstr[100]; struct fb_var_screeninfo var; struct fb_modelist *modelist; @@ -151,9 +151,10 @@ static ssize_t store_mode(struct class_d return -EINVAL; } -static ssize_t show_mode(struct class_device *class_device, char *buf) +static ssize_t show_mode(struct device *device, struct device_attribute *attr, +char *buf) { - struct fb_info *fb_info = class_get_devdata(class_device); + struct fb_info *fb_info = dev_get_drvdata(device); if (!fb_info->mode) return 0; @@ -161,10 +162,11 @@ static ssize_t show_mode(struct class_de return mode_string(buf, 0, fb_info->mode); } -static ssize_t store_modes(struct class_device *class_device, const char * buf, - size_t count) +static ssize_t store_modes(struct device *device, + struct device_attribute *attr, + const char *buf, size_t count) { - struct fb_info *fb_info = class_get_devdata(class_device); + struct fb_info *fb_info = dev_get_drvdata(device); LIST_HEAD(old_list); int i = count / sizeof(struct fb_videomode); @@ -186,9 +188,10 @@ static ssize_t store_modes(struct class_ return 0; } -static ssize_t show_modes(struct class_device *class_device, char *buf) +static ssize_t show_modes(struct device *device, struct device_attribute *attr, + char *buf) { - struct fb_info *fb_info = class_get_devdata(class_device); + struct fb_info *fb_info = dev_get_drvdata(device); unsigned int i; struct list_head *pos; struct fb_modelist *modelist; @@ -203,10 +206,10 @@ static ssize_t show_modes(struct class_d return i; } -static ssize_t store_bpp(struct class_device *class_device, const char * buf, -
[PATCH 27/36] Driver core: Call platform_notify_remove later
From: Benjamin Herrenschmidt <[EMAIL PROTECTED]> Move the call to platform_notify_remove() to after the call to bus_remove_device(), where it belongs. It's bogus to notify the platform of removal while drivers are still attached to the device and possibly still operating since the platform might use this callback to tear down some resources used by the driver (ACPI bits, iommu table, ...) Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> Cc: "Brown, Len" <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/base/core.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index f544adc..5d11bbd 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -682,6 +682,7 @@ void device_del(struct device * dev) device_remove_file(dev, &dev->uevent_attr); device_remove_groups(dev); device_remove_attrs(dev); + bus_remove_device(dev); /* Notify the platform of the removal, in case they * need to do anything... @@ -691,7 +692,6 @@ void device_del(struct device * dev) if (dev->bus) blocking_notifier_call_chain(&dev->bus->bus_notifier, BUS_NOTIFY_DEL_DEVICE, dev); - bus_remove_device(dev); device_pm_remove(dev); kobject_uevent(&dev->kobj, KOBJ_REMOVE); kobject_del(&dev->kobj); -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 19/36] Driver core: convert ppdev code to use struct device
From: Greg Kroah-Hartman <[EMAIL PROTECTED]> Converts from using struct "class_device" to "struct device" making everything show up properly in /sys/devices/ with symlinks from the /sys/class directory. Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/char/ppdev.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index efc485e..c1e3dd8 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c @@ -752,13 +752,13 @@ static const struct file_operations pp_f static void pp_attach(struct parport *port) { - class_device_create(ppdev_class, NULL, MKDEV(PP_MAJOR, port->number), - NULL, "parport%d", port->number); + device_create(ppdev_class, NULL, MKDEV(PP_MAJOR, port->number), + "parport%d", port->number); } static void pp_detach(struct parport *port) { - class_device_destroy(ppdev_class, MKDEV(PP_MAJOR, port->number)); + device_destroy(ppdev_class, MKDEV(PP_MAJOR, port->number)); } static struct parport_driver pp_driver = { -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 15/36] I2C: convert i2c-dev to use struct device instead of struct class_device
From: Greg Kroah-Hartman <[EMAIL PROTECTED]> As class_device is going away eventually... Cc: Jean Delvare <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/i2c/i2c-dev.c | 26 +- 1 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index 3f86903..94a4e9a 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c @@ -42,7 +42,7 @@ static struct i2c_driver i2cdev_driver; struct i2c_dev { struct list_head list; struct i2c_adapter *adap; - struct class_device *class_dev; + struct device *dev; }; #define I2C_MINORS 256 @@ -92,15 +92,16 @@ static void return_i2c_dev(struct i2c_de spin_unlock(&i2c_dev_list_lock); } -static ssize_t show_adapter_name(struct class_device *class_dev, char *buf) +static ssize_t show_adapter_name(struct device *dev, +struct device_attribute *attr, char *buf) { - struct i2c_dev *i2c_dev = i2c_dev_get_by_minor(MINOR(class_dev->devt)); + struct i2c_dev *i2c_dev = i2c_dev_get_by_minor(MINOR(dev->devt)); if (!i2c_dev) return -ENODEV; return sprintf(buf, "%s\n", i2c_dev->adap->name); } -static CLASS_DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL); +static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL); static ssize_t i2cdev_read (struct file *file, char __user *buf, size_t count, loff_t *offset) @@ -413,15 +414,14 @@ static int i2cdev_attach_adapter(struct return PTR_ERR(i2c_dev); /* register this i2c device with the driver core */ - i2c_dev->class_dev = class_device_create(i2c_dev_class, NULL, -MKDEV(I2C_MAJOR, adap->nr), -&adap->dev, "i2c-%d", -adap->nr); - if (!i2c_dev->class_dev) { + i2c_dev->dev = device_create(i2c_dev_class, &adap->dev, +MKDEV(I2C_MAJOR, adap->nr), +"i2c-%d", adap->nr); + if (!i2c_dev->dev) { res = -ENODEV; goto error; } - res = class_device_create_file(i2c_dev->class_dev, &class_device_attr_name); + res = device_create_file(i2c_dev->dev, &dev_attr_name); if (res) goto error_destroy; @@ -429,7 +429,7 @@ static int i2cdev_attach_adapter(struct adap->name, adap->nr); return 0; error_destroy: - class_device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr)); + device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr)); error: return_i2c_dev(i2c_dev); kfree(i2c_dev); @@ -444,9 +444,9 @@ static int i2cdev_detach_adapter(struct if (!i2c_dev) /* attach_adapter must have failed */ return 0; - class_device_remove_file(i2c_dev->class_dev, &class_device_attr_name); + device_remove_file(i2c_dev->dev, &dev_attr_name); return_i2c_dev(i2c_dev); - class_device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr)); + device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr)); kfree(i2c_dev); pr_debug("i2c-dev: adapter [%s] unregistered\n", adap->name); -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 24/36] Driver core: convert sound core to use struct device
From: Greg Kroah-Hartman <[EMAIL PROTECTED]> Converts from using struct "class_device" to "struct device" making everything show up properly in /sys/devices/ with symlinks from the /sys/class directory. It also makes the struct sound_card to show up as a "real" device where all the different sound class devices are placed as childs and different card attribute files can hang off of. /sys/class/sound is still a flat directory, but the symlink targets of all devices belonging to the same card, point the the /sys/devices tree below the new card device object. Thanks to Kay for the updates to this patch. Signed-off-by: Kay Sievers <[EMAIL PROTECTED]> Acked-by: Jaroslav Kysela <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- include/sound/core.h |8 +--- sound/core/init.c |8 sound/core/pcm.c |7 --- sound/core/sound.c| 22 +- sound/oss/soundcard.c | 16 sound/sound_core.c|6 +++--- 6 files changed, 37 insertions(+), 30 deletions(-) diff --git a/include/sound/core.h b/include/sound/core.h index fa1ca01..a994bea 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -132,6 +132,7 @@ struct snd_card { int shutdown; /* this card is going down */ int free_on_last_close; /* free in context of file_release */ wait_queue_head_t shutdown_sleep; + struct device *parent; struct device *dev; #ifdef CONFIG_PM @@ -187,13 +188,14 @@ struct snd_minor { int device; /* device number */ const struct file_operations *f_ops;/* file operations */ void *private_data; /* private data for f_ops->open */ - struct class_device *class_dev; /* class device for sysfs */ + struct device *dev; /* device for sysfs */ }; /* sound.c */ extern int snd_major; extern int snd_ecards_limit; +extern struct class *sound_class; void snd_request_card(int card); @@ -203,7 +205,7 @@ int snd_register_device(int type, struct int snd_unregister_device(int type, struct snd_card *card, int dev); void *snd_lookup_minor_data(unsigned int minor, int type); int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev, - const struct class_device_attribute *attr); + struct device_attribute *attr); #ifdef CONFIG_SND_OSSEMUL int snd_register_oss_device(int type, struct snd_card *card, int dev, @@ -255,7 +257,7 @@ int snd_card_file_add(struct snd_card *c int snd_card_file_remove(struct snd_card *card, struct file *file); #ifndef snd_card_set_dev -#define snd_card_set_dev(card,devptr) ((card)->dev = (devptr)) +#define snd_card_set_dev(card,devptr) ((card)->parent = (devptr)) #endif /* device.c */ diff --git a/sound/core/init.c b/sound/core/init.c index 3058d62..6152a75 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -361,6 +361,8 @@ static int snd_card_do_free(struct snd_c snd_printk(KERN_WARNING "unable to free card info\n"); /* Not fatal error */ } + if (card->dev) + device_unregister(card->dev); kfree(card); return 0; } @@ -495,6 +497,12 @@ int snd_card_register(struct snd_card *c int err; snd_assert(card != NULL, return -EINVAL); + if (!card->dev) { + card->dev = device_create(sound_class, card->parent, 0, + "card%i", card->number); + if (IS_ERR(card->dev)) + card->dev = NULL; + } if ((err = snd_device_register_all(card)) < 0) return err; mutex_lock(&snd_card_mutex); diff --git a/sound/core/pcm.c b/sound/core/pcm.c index fbbbcd2..5ac6e19 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -910,7 +910,8 @@ void snd_pcm_detach_substream(struct snd substream->pstr->substream_opened--; } -static ssize_t show_pcm_class(struct class_device *class_device, char *buf) +static ssize_t show_pcm_class(struct device *dev, + struct device_attribute *attr, char *buf) { struct snd_pcm *pcm; const char *str; @@ -921,7 +922,7 @@ static ssize_t show_pcm_class(struct cla [SNDRV_PCM_CLASS_DIGITIZER] = "digitizer", }; - if (! (pcm = class_get_devdata(class_device)) || + if (! (pcm = dev_get_drvdata(dev)) || pcm->dev_class > SNDRV_PCM_CLASS_LAST) str = "none"; else @@ -929,7 +930,7 @@ static ssize_t show_pcm_class(struct cla return snprintf(buf, PAGE_SIZE, "%s\n", str); } -static struct class_device_attribute pcm_attrs = +static struct device_attribute pcm_attrs = __ATTR(pcm_class, S_IRUGO, show_pcm_class, NULL); static int snd_pcm_dev_register(struct snd_device *device) diff --git a/sound/core/sound.c b/sound/core/sound.c in
[PATCH 14/36] Driver core: convert raw device code to use struct device
From: Greg Kroah-Hartman <[EMAIL PROTECTED]> Converts from using struct "class_device" to "struct device" making everything show up properly in /sys/devices/ with symlinks from the /sys/class directory. Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/char/raw.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/char/raw.c b/drivers/char/raw.c index 89b718e..3b32313 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c @@ -127,9 +127,9 @@ raw_ioctl(struct inode *inode, struct fi static void bind_device(struct raw_config_request *rq) { - class_device_destroy(raw_class, MKDEV(RAW_MAJOR, rq->raw_minor)); - class_device_create(raw_class, NULL, MKDEV(RAW_MAJOR, rq->raw_minor), - NULL, "raw%d", rq->raw_minor); + device_destroy(raw_class, MKDEV(RAW_MAJOR, rq->raw_minor)); + device_create(raw_class, NULL, MKDEV(RAW_MAJOR, rq->raw_minor), + "raw%d", rq->raw_minor); } /* @@ -200,7 +200,7 @@ static int raw_ctl_ioctl(struct inode *i if (rq.block_major == 0 && rq.block_minor == 0) { /* unbind */ rawdev->binding = NULL; - class_device_destroy(raw_class, + device_destroy(raw_class, MKDEV(RAW_MAJOR, rq.raw_minor)); } else { rawdev->binding = bdget(dev); @@ -283,7 +283,7 @@ static int __init raw_init(void) ret = PTR_ERR(raw_class); goto error_region; } - class_device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, "rawctl"); + device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), "rawctl"); return 0; @@ -295,7 +295,7 @@ error: static void __exit raw_exit(void) { - class_device_destroy(raw_class, MKDEV(RAW_MAJOR, 0)); + device_destroy(raw_class, MKDEV(RAW_MAJOR, 0)); class_destroy(raw_class); cdev_del(&raw_cdev); unregister_chrdev_region(MKDEV(RAW_MAJOR, 0), MAX_RAW_MINORS); -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 18/36] Driver core: convert PPP code to use struct device
From: Greg Kroah-Hartman <[EMAIL PROTECTED]> Converts from using struct "class_device" to "struct device" making everything show up properly in /sys/devices/ with symlinks from the /sys/class directory. Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/net/ppp_generic.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index f5802e7..c6de566 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c @@ -860,7 +860,7 @@ static int __init ppp_init(void) err = PTR_ERR(ppp_class); goto out_chrdev; } - class_device_create(ppp_class, NULL, MKDEV(PPP_MAJOR, 0), NULL, "ppp"); + device_create(ppp_class, NULL, MKDEV(PPP_MAJOR, 0), "ppp"); } out: @@ -2675,7 +2675,7 @@ static void __exit ppp_cleanup(void) cardmap_destroy(&all_ppp_units); if (unregister_chrdev(PPP_MAJOR, "ppp") != 0) printk(KERN_ERR "PPP: failed to unregister PPP device\n"); - class_device_destroy(ppp_class, MKDEV(PPP_MAJOR, 0)); + device_destroy(ppp_class, MKDEV(PPP_MAJOR, 0)); class_destroy(ppp_class); } -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 20/36] Driver core: convert mmc code to use struct device
From: Greg Kroah-Hartman <[EMAIL PROTECTED]> Converts from using struct "class_device" to "struct device" making everything show up properly in /sys/devices/ with symlinks from the /sys/class directory. Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/mmc/mmc_queue.c |4 ++-- drivers/mmc/mmc_sysfs.c | 20 ++-- drivers/mmc/wbsd.c |6 +++--- include/linux/mmc/host.h |8 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/mmc/mmc_queue.c b/drivers/mmc/mmc_queue.c index 4ccdd82..61a1de8 100644 --- a/drivers/mmc/mmc_queue.c +++ b/drivers/mmc/mmc_queue.c @@ -130,8 +130,8 @@ int mmc_init_queue(struct mmc_queue *mq, u64 limit = BLK_BOUNCE_HIGH; int ret; - if (host->dev->dma_mask && *host->dev->dma_mask) - limit = *host->dev->dma_mask; + if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask) + limit = *mmc_dev(host)->dma_mask; mq->card = card; mq->queue = blk_init_queue(mmc_request, lock); diff --git a/drivers/mmc/mmc_sysfs.c b/drivers/mmc/mmc_sysfs.c index 10cc973..ac53296 100644 --- a/drivers/mmc/mmc_sysfs.c +++ b/drivers/mmc/mmc_sysfs.c @@ -199,7 +199,7 @@ void mmc_init_card(struct mmc_card *card memset(card, 0, sizeof(struct mmc_card)); card->host = host; device_initialize(&card->dev); - card->dev.parent = card->host->dev; + card->dev.parent = mmc_dev(host); card->dev.bus = &mmc_bus_type; card->dev.release = mmc_release_card; } @@ -242,7 +242,7 @@ void mmc_remove_card(struct mmc_card *ca } -static void mmc_host_classdev_release(struct class_device *dev) +static void mmc_host_classdev_release(struct device *dev) { struct mmc_host *host = cls_dev_to_mmc_host(dev); kfree(host); @@ -250,7 +250,7 @@ static void mmc_host_classdev_release(st static struct class mmc_host_class = { .name = "mmc_host", - .release= mmc_host_classdev_release, + .dev_release= mmc_host_classdev_release, }; static DEFINE_IDR(mmc_host_idr); @@ -267,10 +267,10 @@ struct mmc_host *mmc_alloc_host_sysfs(in if (host) { memset(host, 0, sizeof(struct mmc_host) + extra); - host->dev = dev; - host->class_dev.dev = host->dev; + host->parent = dev; + host->class_dev.parent = dev; host->class_dev.class = &mmc_host_class; - class_device_initialize(&host->class_dev); + device_initialize(&host->class_dev); } return host; @@ -292,10 +292,10 @@ int mmc_add_host_sysfs(struct mmc_host * if (err) return err; - snprintf(host->class_dev.class_id, BUS_ID_SIZE, + snprintf(host->class_dev.bus_id, BUS_ID_SIZE, "mmc%d", host->index); - return class_device_add(&host->class_dev); + return device_add(&host->class_dev); } /* @@ -303,7 +303,7 @@ int mmc_add_host_sysfs(struct mmc_host * */ void mmc_remove_host_sysfs(struct mmc_host *host) { - class_device_del(&host->class_dev); + device_del(&host->class_dev); spin_lock(&mmc_host_lock); idr_remove(&mmc_host_idr, host->index); @@ -315,7 +315,7 @@ void mmc_remove_host_sysfs(struct mmc_ho */ void mmc_free_host_sysfs(struct mmc_host *host) { - class_device_put(&host->class_dev); + put_device(&host->class_dev); } static struct workqueue_struct *workqueue; diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c index ced309b..682e62b 100644 --- a/drivers/mmc/wbsd.c +++ b/drivers/mmc/wbsd.c @@ -1488,7 +1488,7 @@ static void __devinit wbsd_request_dma(s /* * Translate the address to a physical address. */ - host->dma_addr = dma_map_single(host->mmc->dev, host->dma_buffer, + host->dma_addr = dma_map_single(mmc_dev(host->mmc), host->dma_buffer, WBSD_DMA_SIZE, DMA_BIDIRECTIONAL); /* @@ -1512,7 +1512,7 @@ kfree: */ BUG_ON(1); - dma_unmap_single(host->mmc->dev, host->dma_addr, + dma_unmap_single(mmc_dev(host->mmc), host->dma_addr, WBSD_DMA_SIZE, DMA_BIDIRECTIONAL); host->dma_addr = (dma_addr_t)NULL; @@ -1530,7 +1530,7 @@ err: static void __devexit wbsd_release_dma(struct wbsd_host *host) { if (host->dma_addr) { - dma_unmap_single(host->mmc->dev, host->dma_addr, + dma_unmap_single(mmc_dev(host->mmc), host->dma_addr, WBSD_DMA_SIZE, DMA_BIDIRECTIONAL); } kfree(host->dma_buffer); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 587264a..528e7d3 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -74,8 +74,8 @@ struct mmc_card; struct device; struct mmc_host { - struct device *dev; - struct class_device class_dev; + struct de
[PATCH 13/36] Driver core: convert tty core to use struct device
From: Greg Kroah-Hartman <[EMAIL PROTECTED]> Converts from using struct "class_device" to "struct device" making everything show up properly in /sys/devices/ with symlinks from the /sys/class directory. Also fixes up the isdn drivers that were putting something in the class device's directory. Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/char/tty_io.c| 19 ++- drivers/isdn/gigaset/common.c|2 +- drivers/isdn/gigaset/gigaset.h |2 +- drivers/isdn/gigaset/interface.c | 10 +- drivers/isdn/gigaset/proc.c | 19 ++- include/linux/tty.h |5 ++--- 6 files changed, 29 insertions(+), 28 deletions(-) diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index e90ea39..50dc492 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -3612,7 +3612,8 @@ static struct class *tty_class; * This field is optional, if there is no known struct device * for this tty device it can be set to NULL safely. * - * Returns a pointer to the class device (or ERR_PTR(-EFOO) on error). + * Returns a pointer to the struct device for this tty device + * (or ERR_PTR(-EFOO) on error). * * This call is required to be made to register an individual tty device * if the tty driver's flags have the TTY_DRIVER_DYNAMIC_DEV bit set. If @@ -3622,8 +3623,8 @@ static struct class *tty_class; * Locking: ?? */ -struct class_device *tty_register_device(struct tty_driver *driver, -unsigned index, struct device *device) +struct device *tty_register_device(struct tty_driver *driver, unsigned index, + struct device *device) { char name[64]; dev_t dev = MKDEV(driver->major, driver->minor_start) + index; @@ -3639,7 +3640,7 @@ struct class_device *tty_register_device else tty_line_name(driver, index, name); - return class_device_create(tty_class, NULL, dev, device, "%s", name); + return device_create(tty_class, device, dev, name); } /** @@ -3655,7 +3656,7 @@ struct class_device *tty_register_device void tty_unregister_device(struct tty_driver *driver, unsigned index) { - class_device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index); + device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index); } EXPORT_SYMBOL(tty_register_device); @@ -3895,20 +3896,20 @@ static int __init tty_init(void) if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) || register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0) panic("Couldn't register /dev/tty driver\n"); - class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), NULL, "tty"); + device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), "tty"); cdev_init(&console_cdev, &console_fops); if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) || register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0) panic("Couldn't register /dev/console driver\n"); - class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), NULL, "console"); + device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), "console"); #ifdef CONFIG_UNIX98_PTYS cdev_init(&ptmx_cdev, &ptmx_fops); if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) || register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) panic("Couldn't register /dev/ptmx driver\n"); - class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx"); + device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), "ptmx"); #endif #ifdef CONFIG_VT @@ -3916,7 +3917,7 @@ static int __init tty_init(void) if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) || register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) panic("Couldn't register /dev/tty0 driver\n"); - class_device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0"); + device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), "tty0"); vty_init(); #endif diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c index 5800bee..defd574 100644 --- a/drivers/isdn/gigaset/common.c +++ b/drivers/isdn/gigaset/common.c @@ -702,7 +702,7 @@ struct cardstate *gigaset_initcs(struct cs->open_count = 0; cs->dev = NULL; cs->tty = NULL; - cs->class = NULL; + cs->tty_dev = NULL; cs->cidmode = cidmode != 0; //if(onechannel) { //FIXME diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h index 884bd72..06298cc 100644 --- a/drivers/isdn/gigaset/gigaset.h +++ b/drivers/isdn/gigaset/gigaset.h @@ -444,7 +444,7 @@ struct cardstate { struct gigaset_driver *driver; unsigned minor_index; struct device
[PATCH 30/36] driver core: Introduce device_find_child().
From: Cornelia Huck <[EMAIL PROTECTED]> Introduce device_find_child() to match device_for_each_child(). Signed-off-by: Cornelia Huck <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/base/core.c| 33 + include/linux/device.h |2 ++ 2 files changed, 35 insertions(+), 0 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 5d11bbd..a29e685 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -750,12 +750,45 @@ int device_for_each_child(struct device return error; } +/** + * device_find_child - device iterator for locating a particular device. + * @parent: parent struct device + * @data: Data to pass to match function + * @match: Callback function to check device + * + * This is similar to the device_for_each_child() function above, but it + * returns a reference to a device that is 'found' for later use, as + * determined by the @match callback. + * + * The callback should return 0 if the device doesn't match and non-zero + * if it does. If the callback returns non-zero and a reference to the + * current device can be obtained, this function will return to the caller + * and not iterate over any more devices. + */ +struct device * device_find_child(struct device *parent, void *data, + int (*match)(struct device *, void *)) +{ + struct klist_iter i; + struct device *child; + + if (!parent) + return NULL; + + klist_iter_init(&parent->klist_children, &i); + while ((child = next_device(&i))) + if (match(child, data) && get_device(child)) + break; + klist_iter_exit(&i); + return child; +} + int __init devices_init(void) { return subsystem_register(&devices_subsys); } EXPORT_SYMBOL_GPL(device_for_each_child); +EXPORT_SYMBOL_GPL(device_find_child); EXPORT_SYMBOL_GPL(device_initialize); EXPORT_SYMBOL_GPL(device_add); diff --git a/include/linux/device.h b/include/linux/device.h index 2d9dc35..0a0370c 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -421,6 +421,8 @@ extern int __must_check device_add(struc extern void device_del(struct device * dev); extern int device_for_each_child(struct device *, void *, int (*fn)(struct device *, void *)); +extern struct device *device_find_child(struct device *, void *data, + int (*match)(struct device *, void *)); extern int device_rename(struct device *dev, char *new_name); /* -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 29/36] sysfs: sysfs_write_file() writes zero terminated data
From: Thomas Maier <[EMAIL PROTECTED]> since most of the files in sysfs are text files, it would be nice, if the "store" function called during sysfs_write_file() gets a zero terminated string / data. The current implementation seems not to ensure this. (But only if it is the first time the zeroed buffer page is allocated.) So the buffer can be scanned by sscanf() easily, for example. This patch simply sets a \0 char behind the data in buffer->page. Signed-off-by: Thomas Maier <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- fs/sysfs/file.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 298303b..95c1651 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c @@ -190,6 +190,9 @@ fill_write_buffer(struct sysfs_buffer * count = PAGE_SIZE - 1; error = copy_from_user(buffer->page,buf,count); buffer->needs_read_fill = 1; + /* if buf is assumed to contain a string, terminate it by \0, + so e.g. sscanf() can scan the string easily */ + buffer->page[count] = 0; return error ? -EFAULT : count; } -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [OHCI] BIOS handoff failed (BIOS bug?)
On Fri, 1 Dec 2006 15:23:39 -0800, [EMAIL PROTECTED] wrote: > BIOS handoff assumes an SMI, right? Could SMI be masked? That might be a bad idea, because things like fans may be controlled by SMM BIOS. The best thing we can do is to follow the published procedure, and maybe insert a workaround if Sebastian can identify it. -- Pete - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 17/36] Driver core: convert cpuid code to use struct device
From: Greg Kroah-Hartman <[EMAIL PROTECTED]> Converts from using struct "class_device" to "struct device" making everything show up properly in /sys/devices/ with symlinks from the /sys/class directory. Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- arch/i386/kernel/cpuid.c | 20 ++-- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/i386/kernel/cpuid.c b/arch/i386/kernel/cpuid.c index fde8bea..ab0c327 100644 --- a/arch/i386/kernel/cpuid.c +++ b/arch/i386/kernel/cpuid.c @@ -156,14 +156,14 @@ static struct file_operations cpuid_fops .open = cpuid_open, }; -static int cpuid_class_device_create(int i) +static int cpuid_device_create(int i) { int err = 0; - struct class_device *class_err; + struct device *dev; - class_err = class_device_create(cpuid_class, NULL, MKDEV(CPUID_MAJOR, i), NULL, "cpu%d",i); - if (IS_ERR(class_err)) - err = PTR_ERR(class_err); + dev = device_create(cpuid_class, NULL, MKDEV(CPUID_MAJOR, i), "cpu%d",i); + if (IS_ERR(dev)) + err = PTR_ERR(dev); return err; } @@ -174,10 +174,10 @@ static int cpuid_class_cpu_callback(stru switch (action) { case CPU_ONLINE: - cpuid_class_device_create(cpu); + cpuid_device_create(cpu); break; case CPU_DEAD: - class_device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); + device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); break; } return NOTIFY_OK; @@ -206,7 +206,7 @@ static int __init cpuid_init(void) goto out_chrdev; } for_each_online_cpu(i) { - err = cpuid_class_device_create(i); + err = cpuid_device_create(i); if (err != 0) goto out_class; } @@ -218,7 +218,7 @@ static int __init cpuid_init(void) out_class: i = 0; for_each_online_cpu(i) { - class_device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, i)); + device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, i)); } class_destroy(cpuid_class); out_chrdev: @@ -232,7 +232,7 @@ static void __exit cpuid_exit(void) int cpu = 0; for_each_online_cpu(cpu) - class_device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); + device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); class_destroy(cpuid_class); unregister_chrdev(CPUID_MAJOR, "cpu/cpuid"); unregister_hotcpu_notifier(&cpuid_class_cpu_notifier); -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [OHCI] BIOS handoff failed (BIOS bug?)
On Fri, Dec 01, 2006 at 03:02:01PM -0800, Pete Zaitcev wrote: > On Fri, 1 Dec 2006 19:28:55 +0100, Sebastian Kemper <[EMAIL PROTECTED]> wrote: > > > I also increased the wait time from 5 seconds to 20 in > > drivers/usb/host/pci-quirks.c but that didn't change anything. > > That was a good try, but I thought maybe it needs doing something > twice, or having some extra bits set... There's always a possibility > that the BIOS refuses the handoff on purpose though. If it does not > cause any misbehaviour, it may be safe to ignore. BIOS handoff assumes an SMI, right? Could SMI be masked? - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 16/36] Driver core: convert msr code to use struct device
From: Greg Kroah-Hartman <[EMAIL PROTECTED]> Converts from using struct "class_device" to "struct device" making everything show up properly in /sys/devices/ with symlinks from the /sys/class directory. Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- arch/i386/kernel/msr.c | 20 ++-- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/i386/kernel/msr.c b/arch/i386/kernel/msr.c index d535cdb..a773f77 100644 --- a/arch/i386/kernel/msr.c +++ b/arch/i386/kernel/msr.c @@ -239,14 +239,14 @@ static struct file_operations msr_fops = .open = msr_open, }; -static int msr_class_device_create(int i) +static int msr_device_create(int i) { int err = 0; - struct class_device *class_err; + struct device *dev; - class_err = class_device_create(msr_class, NULL, MKDEV(MSR_MAJOR, i), NULL, "msr%d",i); - if (IS_ERR(class_err)) - err = PTR_ERR(class_err); + dev = device_create(msr_class, NULL, MKDEV(MSR_MAJOR, i), "msr%d",i); + if (IS_ERR(dev)) + err = PTR_ERR(dev); return err; } @@ -258,10 +258,10 @@ static int msr_class_cpu_callback(struct switch (action) { case CPU_ONLINE: - msr_class_device_create(cpu); + msr_device_create(cpu); break; case CPU_DEAD: - class_device_destroy(msr_class, MKDEV(MSR_MAJOR, cpu)); + device_destroy(msr_class, MKDEV(MSR_MAJOR, cpu)); break; } return NOTIFY_OK; @@ -290,7 +290,7 @@ static int __init msr_init(void) goto out_chrdev; } for_each_online_cpu(i) { - err = msr_class_device_create(i); + err = msr_device_create(i); if (err != 0) goto out_class; } @@ -302,7 +302,7 @@ static int __init msr_init(void) out_class: i = 0; for_each_online_cpu(i) - class_device_destroy(msr_class, MKDEV(MSR_MAJOR, i)); + device_destroy(msr_class, MKDEV(MSR_MAJOR, i)); class_destroy(msr_class); out_chrdev: unregister_chrdev(MSR_MAJOR, "cpu/msr"); @@ -314,7 +314,7 @@ static void __exit msr_exit(void) { int cpu = 0; for_each_online_cpu(cpu) - class_device_destroy(msr_class, MKDEV(MSR_MAJOR, cpu)); + device_destroy(msr_class, MKDEV(MSR_MAJOR, cpu)); class_destroy(msr_class); unregister_chrdev(MSR_MAJOR, "cpu/msr"); unregister_hotcpu_notifier(&msr_class_cpu_notifier); -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Cluster-devel] Re: [GFS2] Change argument of gfs2_dinode_out [17/70]
On Fri, 2006-12-01 at 21:08 +, Al Viro wrote: > On Fri, Dec 01, 2006 at 02:52:11PM -0600, Russell Cattelan wrote: > > code clean up are not without risk and with no regression test suite to > > verify > > that a "cleanup" has not broken something. Cleanups are very much a > > hindrance to stabilization. With no know working points in a code > > history it becomes difficult > > to bisect changes and figure out when bugs were introduced > > Especially when cleanups are mixed in with bug fixes. > > > > Pretty code does not equal correct code. > > No, but convoluted and unreadable code ends up being crappier due > to lack of review. And that's aside of the memory footprint, > likeliness of bugs introduced by code modifications (having in-core > and on-disk data structures with different contents and the same C > type => trouble that won't be caught by compiler), etc. Nothing makes up for the complete lack of GFS2 testing. reviewed code does not equal correct code either. Honestly tell me what test suite do you run on GFS2? Sure is it possible to make an educated guess that some cleanups will not destabilize the code. Indeed the stuff you have done is quite useful to ensure that endian bugs are being caught by the compiler/sparse. But no amount of "it shouldn't break anything" assertions can replace testing. But there is a large quantity of the 70 or so patches that were sent out were to enable "future" cleanup's. Putting in partial cleanups do nothing core code readability and I many cases is more confusing. Unless you meticulously keep up with the partial cleanups looking at the code is now a jumbled mess of inconsistencies. gfs2 is supposed to be stabilized and use-able for the up coming rhel5 release, not pretty up for somebody to print out and hang on their wall. -- Russell Cattelan <[EMAIL PROTECTED]> signature.asc Description: This is a digitally signed message part
[PATCH 28/36] cpu topology: consider sysfs_create_group return value
From: Heiko Carstens <[EMAIL PROTECTED]> Take return value of sysfs_create_group() into account. That function got called in case of CPU_ONLINE notification. Since callbacks are not allowed to fail on CPU_ONLINE notification do the sysfs group creation on CPU_UP_PREPARE notification. Also remember if creation succeeded in a bitmask. So it's possible to know whether it's legal to call sysfs_remove_group or not. In addition some other minor stuff: - since CPU_UP_PREPARE might fail add CPU_UP_CANCELED handling as well. - use hotcpu_notifier instead of register_hotcpu_notifier. - #ifdef code that isn't needed in the !CONFIG_HOTPLUG_CPU case. Signed-off-by: Heiko Carstens <[EMAIL PROTECTED]> Acked-by: Cornelia Huck <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/base/topology.c | 55 +++--- 1 files changed, 32 insertions(+), 23 deletions(-) diff --git a/drivers/base/topology.c b/drivers/base/topology.c index 28dccb7..3d12b85 100644 --- a/drivers/base/topology.c +++ b/drivers/base/topology.c @@ -94,54 +94,63 @@ static struct attribute_group topology_a .name = "topology" }; +static cpumask_t topology_dev_map = CPU_MASK_NONE; + /* Add/Remove cpu_topology interface for CPU device */ -static int __cpuinit topology_add_dev(struct sys_device * sys_dev) +static int __cpuinit topology_add_dev(unsigned int cpu) { - return sysfs_create_group(&sys_dev->kobj, &topology_attr_group); + int rc; + struct sys_device *sys_dev = get_cpu_sysdev(cpu); + + rc = sysfs_create_group(&sys_dev->kobj, &topology_attr_group); + if (!rc) + cpu_set(cpu, topology_dev_map); + return rc; } -static int __cpuinit topology_remove_dev(struct sys_device * sys_dev) +#ifdef CONFIG_HOTPLUG_CPU +static void __cpuinit topology_remove_dev(unsigned int cpu) { + struct sys_device *sys_dev = get_cpu_sysdev(cpu); + + if (!cpu_isset(cpu, topology_dev_map)) + return; + cpu_clear(cpu, topology_dev_map); sysfs_remove_group(&sys_dev->kobj, &topology_attr_group); - return 0; } static int __cpuinit topology_cpu_callback(struct notifier_block *nfb, - unsigned long action, void *hcpu) + unsigned long action, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; - struct sys_device *sys_dev; + int rc = 0; - sys_dev = get_cpu_sysdev(cpu); switch (action) { - case CPU_ONLINE: - topology_add_dev(sys_dev); + case CPU_UP_PREPARE: + rc = topology_add_dev(cpu); break; + case CPU_UP_CANCELED: case CPU_DEAD: - topology_remove_dev(sys_dev); + topology_remove_dev(cpu); break; } - return NOTIFY_OK; + return rc ? NOTIFY_BAD : NOTIFY_OK; } - -static struct notifier_block __cpuinitdata topology_cpu_notifier = -{ - .notifier_call = topology_cpu_callback, -}; +#endif static int __cpuinit topology_sysfs_init(void) { - int i; + int cpu; + int rc; - for_each_online_cpu(i) { - topology_cpu_callback(&topology_cpu_notifier, CPU_ONLINE, - (void *)(long)i); + for_each_online_cpu(cpu) { + rc = topology_add_dev(cpu); + if (rc) + return rc; } - - register_hotcpu_notifier(&topology_cpu_notifier); + hotcpu_notifier(topology_cpu_callback, 0); return 0; } device_initcall(topology_sysfs_init); - -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 34/36] Driver core: platform_driver_probe(), can save codespace
From: David Brownell <[EMAIL PROTECTED]> This defines a new platform_driver_probe() method allowing the driver's probe() method, and its support code+data, to safely live in __init sections for typical system configurations. Many system-on-chip processors could benefit from this API, to the tune of recovering hundreds to thousands of bytes per driver. That's memory which is currently wasted holding code which can never be called after system startup, yet can not be removed. It can't be removed because of the linkage requirement that pointers to init section code (like, ideally, probe support) must not live in other sections (like driver method tables) after those pointers would be invalid. Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/base/platform.c | 48 +++ include/linux/platform_device.h |6 + 2 files changed, 54 insertions(+), 0 deletions(-) diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 940ce41..d1df4a0 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -388,6 +388,11 @@ static int platform_drv_probe(struct dev return drv->probe(dev); } +static int platform_drv_probe_fail(struct device *_dev) +{ + return -ENXIO; +} + static int platform_drv_remove(struct device *_dev) { struct platform_driver *drv = to_platform_driver(_dev->driver); @@ -451,6 +456,49 @@ void platform_driver_unregister(struct p } EXPORT_SYMBOL_GPL(platform_driver_unregister); +/** + * platform_driver_probe - register driver for non-hotpluggable device + * @drv: platform driver structure + * @probe: the driver probe routine, probably from an __init section + * + * Use this instead of platform_driver_register() when you know the device + * is not hotpluggable and has already been registered, and you want to + * remove its run-once probe() infrastructure from memory after the driver + * has bound to the device. + * + * One typical use for this would be with drivers for controllers integrated + * into system-on-chip processors, where the controller devices have been + * configured as part of board setup. + * + * Returns zero if the driver registered and bound to a device, else returns + * a negative error code and with the driver not registered. + */ +int platform_driver_probe(struct platform_driver *drv, + int (*probe)(struct platform_device *)) +{ + int retval, code; + + /* temporary section violation during probe() */ + drv->probe = probe; + retval = code = platform_driver_register(drv); + + /* Fixup that section violation, being paranoid about code scanning +* the list of drivers in order to probe new devices. Check to see +* if the probe was successful, and make sure any forced probes of +* new devices fail. +*/ + spin_lock(&platform_bus_type.klist_drivers.k_lock); + drv->probe = NULL; + if (code == 0 && list_empty(&drv->driver.klist_devices.k_list)) + retval = -ENODEV; + drv->driver.probe = platform_drv_probe_fail; + spin_unlock(&platform_bus_type.klist_drivers.k_lock); + + if (code != retval) + platform_driver_unregister(drv); + return retval; +} +EXPORT_SYMBOL_GPL(platform_driver_probe); /* modalias support enables more hands-off userspace setup: * (a) environment variable lets new-style hotplug events work once system is diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 29cd6de..20f47b8 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -58,6 +58,12 @@ struct platform_driver { extern int platform_driver_register(struct platform_driver *); extern void platform_driver_unregister(struct platform_driver *); +/* non-hotpluggable platform devices may use this so that probe() and + * its support may live in __init sections, conserving runtime memory. + */ +extern int platform_driver_probe(struct platform_driver *driver, + int (*probe)(struct platform_device *)); + #define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev) #define platform_set_drvdata(_dev,data)dev_set_drvdata(&(_dev)->dev, (data)) -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 26/36] ACPI: Change ACPI to use dev_archdata instead of firmware_data
From: Benjamin Herrenschmidt <[EMAIL PROTECTED]> Change ACPI to use dev_archdata instead of firmware_data This patch changes ACPI to use the new dev_archdata on i386, x86_64 and ia64 (is there any other arch using ACPI ?) to store it's acpi_handle. It also removes the firmware_data field from struct device as this was the only user. Only build-tested on x86 Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> Cc: Len Brown <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/acpi/glue.c | 20 +++- include/acpi/acpi_bus.h |2 +- include/asm-i386/device.h | 10 +- include/asm-ia64/device.h | 10 +- include/asm-x86_64/device.h | 10 +- include/linux/device.h |2 -- 6 files changed, 39 insertions(+), 15 deletions(-) diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 10f160d..a2f46d5 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -267,9 +267,9 @@ static int acpi_bind_one(struct device * { acpi_status status; - if (dev->firmware_data) { + if (dev->archdata.acpi_handle) { printk(KERN_WARNING PREFIX - "Drivers changed 'firmware_data' for %s\n", dev->bus_id); + "Drivers changed 'acpi_handle' for %s\n", dev->bus_id); return -EINVAL; } get_device(dev); @@ -278,25 +278,26 @@ static int acpi_bind_one(struct device * put_device(dev); return -EINVAL; } - dev->firmware_data = handle; + dev->archdata.acpi_handle = handle; return 0; } static int acpi_unbind_one(struct device *dev) { - if (!dev->firmware_data) + if (!dev->archdata.acpi_handle) return 0; - if (dev == acpi_get_physical_device(dev->firmware_data)) { + if (dev == acpi_get_physical_device(dev->archdata.acpi_handle)) { /* acpi_get_physical_device increase refcnt by one */ put_device(dev); - acpi_detach_data(dev->firmware_data, acpi_glue_data_handler); - dev->firmware_data = NULL; + acpi_detach_data(dev->archdata.acpi_handle, +acpi_glue_data_handler); + dev->archdata.acpi_handle = NULL; /* acpi_bind_one increase refcnt by one */ put_device(dev); } else { printk(KERN_ERR PREFIX - "Oops, 'firmware_data' corrupt for %s\n", dev->bus_id); + "Oops, 'acpi_handle' corrupt for %s\n", dev->bus_id); } return 0; } @@ -328,7 +329,8 @@ static int acpi_platform_notify(struct d if (!ret) { struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; - acpi_get_name(dev->firmware_data, ACPI_FULL_PATHNAME, &buffer); + acpi_get_name(dev->archdata.acpi_handle, + ACPI_FULL_PATHNAME, &buffer); DBG("Device %s -> %s\n", dev->bus_id, (char *)buffer.pointer); kfree(buffer.pointer); } else diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index f338e40..fdd1095 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -357,7 +357,7 @@ struct device *acpi_get_physical_device( /* helper */ acpi_handle acpi_get_child(acpi_handle, acpi_integer); acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); -#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->firmware_data)) +#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle)) #endif /* CONFIG_ACPI */ diff --git a/include/asm-i386/device.h b/include/asm-i386/device.h index d8f9872..849604c 100644 --- a/include/asm-i386/device.h +++ b/include/asm-i386/device.h @@ -3,5 +3,13 @@ * * This file is released under the GPLv2 */ -#include +#ifndef _ASM_I386_DEVICE_H +#define _ASM_I386_DEVICE_H +struct dev_archdata { +#ifdef CONFIG_ACPI + void*acpi_handle; +#endif +}; + +#endif /* _ASM_I386_DEVICE_H */ diff --git a/include/asm-ia64/device.h b/include/asm-ia64/device.h index d8f9872..3db6daf 100644 --- a/include/asm-ia64/device.h +++ b/include/asm-ia64/device.h @@ -3,5 +3,13 @@ * * This file is released under the GPLv2 */ -#include +#ifndef _ASM_IA64_DEVICE_H +#define _ASM_IA64_DEVICE_H +struct dev_archdata { +#ifdef CONFIG_ACPI + void*acpi_handle; +#endif +}; + +#endif /* _ASM_IA64_DEVICE_H */ diff --git a/include/asm-x86_64/device.h b/include/asm-x86_64/device.h index d8f9872..3afa03f 100644 --- a/include/asm-x86_64/device.h +++ b/include/asm-x86_64/device.h @@ -3,5 +3,13 @@ * * This file is released under the GPLv2 */ -#include +#ifndef _ASM_X86_64_DEVICE_H +#define _ASM_X86_64_DEVICE_H +struct dev_archdata { +#ifdef CONFIG_ACPI + void*acpi_handle; +#endif +}; + +#endif /* _ASM_X86_64_DEVICE_H */ diff --git a/include/lin
[PATCH 35/36] Documentation/driver-model/platform.txt update/rewrite
From: David Brownell <[EMAIL PROTECTED]> This is almost a rewrite of the driver-model/platform.txt documentation; the previous text was obsolete (for several years), evidently it never got updated to match the change from being a PC "legacy_bus" to the more widely used core bus for most embedded systems. Signed-off-by: David Brownell <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- Documentation/driver-model/platform.txt | 204 ++- 1 files changed, 118 insertions(+), 86 deletions(-) diff --git a/Documentation/driver-model/platform.txt b/Documentation/driver-model/platform.txt index 5eee3e0..9f0bc3b 100644 --- a/Documentation/driver-model/platform.txt +++ b/Documentation/driver-model/platform.txt @@ -1,99 +1,131 @@ Platform Devices and Drivers +See for the driver model interface to the +platform bus: platform_device, and platform_driver. This pseudo-bus +is used to connect devices on busses with minimal infrastructure, +like those used to integrate peripherals on many system-on-chip +processors, or some "legacy" PC interconnects; as opposed to large +formally specified ones like PCI or USB. + Platform devices Platform devices are devices that typically appear as autonomous entities in the system. This includes legacy port-based devices and -host bridges to peripheral buses. - - -Platform drivers - -Drivers for platform devices are typically very simple and -unstructured. Either the device was present at a particular I/O port -and the driver was loaded, or it was not. There was no possibility -of hotplugging or alternative discovery besides probing at a specific -I/O address and expecting a specific response. +host bridges to peripheral buses, and most controllers integrated +into system-on-chip platforms. What they usually have in common +is direct addressing from a CPU bus. Rarely, a platform_device will +be connected through a segment of some other kind of bus; but its +registers will still be directly addressible. +Platform devices are given a name, used in driver binding, and a +list of resources such as addresses and IRQs. -Other Architectures, Modern Firmware, and new Platforms -~~~ -These devices are not always at the legacy I/O ports. This is true on -other architectures and on some modern architectures. In most cases, -the drivers are modified to discover the devices at other well-known -ports for the given platform. However, the firmware in these systems -does usually know where exactly these devices reside, and in some -cases, it's the only way of discovering them. +struct platform_device { + const char *name; + u32 id; + struct device dev; + u32 num_resources; + struct resource *resource; +}; -The Platform Bus - -A platform bus has been created to deal with these issues. First and -foremost, it groups all the legacy devices under a common bus, and -gives them a common parent if they don't already have one. - -But, besides the organizational benefits, the platform bus can also -accommodate firmware-based enumeration. - - -Device Discovery +Platform drivers -The platform bus has no concept of probing for devices. Devices -discovery is left up to either the legacy drivers or the -firmware. These entities are expected to notify the platform of -devices that it discovers via the bus's add() callback: - - platform_bus.add(parent,bus_id). - - -Bus IDs -~~~ -Bus IDs are the canonical names for the devices. There is no globally -standard addressing mechanism for legacy devices. In the IA-32 world, -we have Pnp IDs to use, as well as the legacy I/O ports. However, -neither tell what the device really is or have any meaning on other -platforms. - -Since both PnP IDs and the legacy I/O ports (and other standard I/O -ports for specific devices) have a 1:1 mapping, we map the -platform-specific name or identifier to a generic name (at least -within the scope of the kernel). - -For example, a serial driver might find a device at I/O 0x3f8. The -ACPI firmware might also discover a device with PnP ID (_HID) -PNP0501. Both correspond to the same device and should be mapped to the -canonical name 'serial'. - -The bus_id field should be a concatenation of the canonical name and -the instance of that type of device. For example, the device at I/O -port 0x3f8 should have a bus_id of "serial0". This places the -responsibility of enumerating devices of a particular type up to the -discovery mechanism. But, they are the entity that should know best -(as opposed to the platform bus driver). - - -Drivers -~~~ -Drivers for platform devices should have a name that is the same as -the canonical name of the devices they support. This allows the -platform bus driver to do simple matching with the basic data -structures
[PATCH 32/36] driver core: Introduce device_move(): move a device to a new parent.
From: Cornelia Huck <[EMAIL PROTECTED]> Provide a function device_move() to move a device to a new parent device. Add auxilliary functions kobject_move() and sysfs_move_dir(). kobject_move() generates a new uevent of type KOBJ_MOVE, containing the previous path (DEVPATH_OLD) in addition to the usual values. For this, a new interface kobject_uevent_env() is created that allows to add further environmental data to the uevent at the kobject layer. Signed-off-by: Cornelia Huck <[EMAIL PROTECTED]> Acked-by: Kay Sievers <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/base/core.c | 92 +++ fs/sysfs/dir.c | 45 +++ include/linux/device.h |1 + include/linux/kobject.h |8 include/linux/sysfs.h |8 lib/kobject.c | 50 + lib/kobject_uevent.c| 28 -- 7 files changed, 228 insertions(+), 4 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 75b45a1..e4eaf46 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -955,3 +955,95 @@ int device_rename(struct device *dev, ch return error; } + + +static int device_move_class_links(struct device *dev, + struct device *old_parent, + struct device *new_parent) +{ +#ifdef CONFIG_SYSFS_DEPRECATED + int error; + char *class_name; + + class_name = make_class_name(dev->class->name, &dev->kobj); + if (!class_name) { + error = PTR_ERR(class_name); + class_name = NULL; + goto out; + } + if (old_parent) { + sysfs_remove_link(&dev->kobj, "device"); + sysfs_remove_link(&old_parent->kobj, class_name); + } + error = sysfs_create_link(&dev->kobj, &new_parent->kobj, "device"); + if (error) + goto out; + error = sysfs_create_link(&new_parent->kobj, &dev->kobj, class_name); + if (error) + sysfs_remove_link(&dev->kobj, "device"); +out: + kfree(class_name); + return error; +#else + return 0; +#endif +} + +/** + * device_move - moves a device to a new parent + * @dev: the pointer to the struct device to be moved + * @new_parent: the new parent of the device + */ +int device_move(struct device *dev, struct device *new_parent) +{ + int error; + struct device *old_parent; + + dev = get_device(dev); + if (!dev) + return -EINVAL; + + if (!device_is_registered(dev)) { + error = -EINVAL; + goto out; + } + new_parent = get_device(new_parent); + if (!new_parent) { + error = -EINVAL; + goto out; + } + pr_debug("DEVICE: moving '%s' to '%s'\n", dev->bus_id, + new_parent->bus_id); + error = kobject_move(&dev->kobj, &new_parent->kobj); + if (error) { + put_device(new_parent); + goto out; + } + old_parent = dev->parent; + dev->parent = new_parent; + if (old_parent) + klist_del(&dev->knode_parent); + klist_add_tail(&dev->knode_parent, &new_parent->klist_children); + if (!dev->class) + goto out_put; + error = device_move_class_links(dev, old_parent, new_parent); + if (error) { + /* We ignore errors on cleanup since we're hosed anyway... */ + device_move_class_links(dev, new_parent, old_parent); + if (!kobject_move(&dev->kobj, &old_parent->kobj)) { + klist_del(&dev->knode_parent); + if (old_parent) + klist_add_tail(&dev->knode_parent, + &old_parent->klist_children); + } + put_device(new_parent); + goto out; + } +out_put: + put_device(old_parent); +out: + put_device(dev); + return error; +} + +EXPORT_SYMBOL_GPL(device_move); diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 3aa3434..a5782e8 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c @@ -372,6 +372,51 @@ int sysfs_rename_dir(struct kobject * ko return error; } +int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent) +{ + struct dentry *old_parent_dentry, *new_parent_dentry, *new_dentry; + struct sysfs_dirent *new_parent_sd, *sd; + int error; + + if (!new_parent) + return -EINVAL; + + old_parent_dentry = kobj->parent ? + kobj->parent->dentry : sysfs_mount->mnt_sb->s_root; + new_parent_dentry = new_parent->dentry; + +again: + mutex_lock(&old_parent_dentry->d_inode->i_mutex); + if (!mutex_trylock(&new_parent_dentry->d_inode->i_mutex)) { + mutex_unlock(&old_parent_dentry->d_inode->i_mutex); +
[PATCH 25/36] Driver core: add dev_archdata to struct device
From: Benjamin Herrenschmidt <[EMAIL PROTECTED]> Add arch specific dev_archdata to struct device Adds an arch specific struct dev_arch to struct device. This enables architecture to add specific fields to every device in the system, like DMA operation pointers, NUMA node ID, firmware specific data, etc... Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]> Acked-by: Andi Kleen <[EMAIL PROTECTED]> Acked-By: David Howells <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- include/asm-alpha/device.h |7 +++ include/asm-arm/device.h |7 +++ include/asm-arm26/device.h |7 +++ include/asm-avr32/device.h |7 +++ include/asm-cris/device.h |7 +++ include/asm-frv/device.h |7 +++ include/asm-generic/device.h | 12 include/asm-h8300/device.h |7 +++ include/asm-i386/device.h |7 +++ include/asm-ia64/device.h |7 +++ include/asm-m32r/device.h |7 +++ include/asm-m68k/device.h |7 +++ include/asm-m68knommu/device.h |7 +++ include/asm-mips/device.h |7 +++ include/asm-parisc/device.h|7 +++ include/asm-powerpc/device.h |7 +++ include/asm-ppc/device.h |7 +++ include/asm-s390/device.h |7 +++ include/asm-sh/device.h|7 +++ include/asm-sh64/device.h |7 +++ include/asm-sparc/device.h |7 +++ include/asm-sparc64/device.h |7 +++ include/asm-um/device.h|7 +++ include/asm-v850/device.h |7 +++ include/asm-x86_64/device.h|7 +++ include/asm-xtensa/device.h|7 +++ include/linux/device.h |3 +++ 27 files changed, 190 insertions(+), 0 deletions(-) diff --git a/include/asm-alpha/device.h b/include/asm-alpha/device.h new file mode 100644 index 000..d8f9872 --- /dev/null +++ b/include/asm-alpha/device.h @@ -0,0 +1,7 @@ +/* + * Arch specific extensions to struct device + * + * This file is released under the GPLv2 + */ +#include + diff --git a/include/asm-arm/device.h b/include/asm-arm/device.h new file mode 100644 index 000..d8f9872 --- /dev/null +++ b/include/asm-arm/device.h @@ -0,0 +1,7 @@ +/* + * Arch specific extensions to struct device + * + * This file is released under the GPLv2 + */ +#include + diff --git a/include/asm-arm26/device.h b/include/asm-arm26/device.h new file mode 100644 index 000..d8f9872 --- /dev/null +++ b/include/asm-arm26/device.h @@ -0,0 +1,7 @@ +/* + * Arch specific extensions to struct device + * + * This file is released under the GPLv2 + */ +#include + diff --git a/include/asm-avr32/device.h b/include/asm-avr32/device.h new file mode 100644 index 000..d8f9872 --- /dev/null +++ b/include/asm-avr32/device.h @@ -0,0 +1,7 @@ +/* + * Arch specific extensions to struct device + * + * This file is released under the GPLv2 + */ +#include + diff --git a/include/asm-cris/device.h b/include/asm-cris/device.h new file mode 100644 index 000..d8f9872 --- /dev/null +++ b/include/asm-cris/device.h @@ -0,0 +1,7 @@ +/* + * Arch specific extensions to struct device + * + * This file is released under the GPLv2 + */ +#include + diff --git a/include/asm-frv/device.h b/include/asm-frv/device.h new file mode 100644 index 000..d8f9872 --- /dev/null +++ b/include/asm-frv/device.h @@ -0,0 +1,7 @@ +/* + * Arch specific extensions to struct device + * + * This file is released under the GPLv2 + */ +#include + diff --git a/include/asm-generic/device.h b/include/asm-generic/device.h new file mode 100644 index 000..c17c960 --- /dev/null +++ b/include/asm-generic/device.h @@ -0,0 +1,12 @@ +/* + * Arch specific extensions to struct device + * + * This file is released under the GPLv2 + */ +#ifndef _ASM_GENERIC_DEVICE_H +#define _ASM_GENERIC_DEVICE_H + +struct dev_archdata { +}; + +#endif /* _ASM_GENERIC_DEVICE_H */ diff --git a/include/asm-h8300/device.h b/include/asm-h8300/device.h new file mode 100644 index 000..d8f9872 --- /dev/null +++ b/include/asm-h8300/device.h @@ -0,0 +1,7 @@ +/* + * Arch specific extensions to struct device + * + * This file is released under the GPLv2 + */ +#include + diff --git a/include/asm-i386/device.h b/include/asm-i386/device.h new file mode 100644 index 000..d8f9872 --- /dev/null +++ b/include/asm-i386/device.h @@ -0,0 +1,7 @@ +/* + * Arch specific extensions to struct device + * + * This file is released under the GPLv2 + */ +#include + diff --git a/include/asm-ia64/device.h b/include/asm-ia64/device.h new file mode 100644 index 000..d8f9872 --- /dev/null +++ b/include/asm-ia64/device.h @@ -0,0 +1,7 @@ +/* + * Arch specific extensions to struct device + * + * This file is released under the GPLv2 + */ +#include + diff --git a/include/asm-m32r/device.h b/include/asm-m32r/device.h new file mode 100644 index 000..d8f9872 --- /dev/null +++ b/include/asm-m32r/device.h @@ -0
[PATCH 23/36] Driver core: change mem class_devices to be real devices
From: Greg Kroah-Hartman <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/char/mem.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 5547337..e67eef4 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -980,10 +980,10 @@ static int __init chr_dev_init(void) mem_class = class_create(THIS_MODULE, "mem"); for (i = 0; i < ARRAY_SIZE(devlist); i++) - class_device_create(mem_class, NULL, - MKDEV(MEM_MAJOR, devlist[i].minor), - NULL, devlist[i].name); - + device_create(mem_class, NULL, + MKDEV(MEM_MAJOR, devlist[i].minor), + devlist[i].name); + return 0; } -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [OHCI] BIOS handoff failed (BIOS bug?)
On Fri, Dec 01, 2006 at 03:29:22PM -0800, Pete Zaitcev wrote: > On Fri, 1 Dec 2006 15:23:39 -0800, [EMAIL PROTECTED] wrote: > > > BIOS handoff assumes an SMI, right? Could SMI be masked? > > That might be a bad idea, because things like fans may be controlled > by SMM BIOS. The best thing we can do is to follow the published > procedure, and maybe insert a workaround if Sebastian can identify it. Sorry, I don't mean "could we mask it" but rather "is it possible that it is already masked"? Tim - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 6/36] CONFIG_SYSFS_DEPRECATED - bus symlinks
From: Kay Sievers <[EMAIL PROTECTED]> Turn off the bus symlinks if CONFIG_SYSFS_DEPRECATED is enabled Signed-off-by: Kay Sievers <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/base/bus.c | 20 +--- 1 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/base/bus.c b/drivers/base/bus.c index ed3e8a2..472810f 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -355,6 +355,21 @@ static void device_remove_attrs(struct b } } +#ifdef CONFIG_SYSFS_DEPRECATED +static int make_deprecated_bus_links(struct device *dev) +{ + return sysfs_create_link(&dev->kobj, +&dev->bus->subsys.kset.kobj, "bus"); +} + +static void remove_deprecated_bus_links(struct device *dev) +{ + sysfs_remove_link(&dev->kobj, "bus"); +} +#else +static inline int make_deprecated_bus_links(struct device *dev) { return 0; } +static inline void remove_deprecated_bus_links(struct device *dev) { } +#endif /** * bus_add_device - add device to bus @@ -381,8 +396,7 @@ int bus_add_device(struct device * dev) &dev->bus->subsys.kset.kobj, "subsystem"); if (error) goto out_subsys; - error = sysfs_create_link(&dev->kobj, - &dev->bus->subsys.kset.kobj, "bus"); + error = make_deprecated_bus_links(dev); if (error) goto out_deprecated; } @@ -436,7 +450,7 @@ void bus_remove_device(struct device * d { if (dev->bus) { sysfs_remove_link(&dev->kobj, "subsystem"); - sysfs_remove_link(&dev->kobj, "bus"); + remove_deprecated_bus_links(dev); sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id); device_remove_attrs(dev->bus, dev); if (dev->is_registered) { -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 9/36] CONFIG_SYSFS_DEPRECATED - class symlinks
From: Kay Sievers <[EMAIL PROTECTED]> Turn off class symlinks CONFIG_SYSFS_DEPRECATED is enabled. Signed-off-by: Kay Sievers <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/base/class.c | 149 +- 1 files changed, 98 insertions(+), 51 deletions(-) diff --git a/drivers/base/class.c b/drivers/base/class.c index 2e705f6..f098881 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -352,6 +352,92 @@ static const char *class_uevent_name(str return class_dev->class->name; } +#ifdef CONFIG_SYSFS_DEPRECATED +char *make_class_name(const char *name, struct kobject *kobj) +{ + char *class_name; + int size; + + size = strlen(name) + strlen(kobject_name(kobj)) + 2; + + class_name = kmalloc(size, GFP_KERNEL); + if (!class_name) + return ERR_PTR(-ENOMEM); + + strcpy(class_name, name); + strcat(class_name, ":"); + strcat(class_name, kobject_name(kobj)); + return class_name; +} + +static int deprecated_class_uevent(char **envp, int num_envp, int *cur_index, + char *buffer, int buffer_size, + int *cur_len, + struct class_device *class_dev) +{ + struct device *dev = class_dev->dev; + char *path; + + if (!dev) + return 0; + + /* add device, backing this class device (deprecated) */ + path = kobject_get_path(&dev->kobj, GFP_KERNEL); + + add_uevent_var(envp, num_envp, cur_index, buffer, buffer_size, + cur_len, "PHYSDEVPATH=%s", path); + kfree(path); + + if (dev->bus) + add_uevent_var(envp, num_envp, cur_index, + buffer, buffer_size, cur_len, + "PHYSDEVBUS=%s", dev->bus->name); + + if (dev->driver) + add_uevent_var(envp, num_envp, cur_index, + buffer, buffer_size, cur_len, + "PHYSDEVDRIVER=%s", dev->driver->name); + return 0; +} + +static int make_deprecated_class_device_links(struct class_device *class_dev) +{ + char *class_name; + int error; + + if (!class_dev->dev) + return 0; + + class_name = make_class_name(class_dev->class->name, &class_dev->kobj); + error = sysfs_create_link(&class_dev->dev->kobj, &class_dev->kobj, + class_name); + kfree(class_name); + return error; +} + +static void remove_deprecated_class_device_links(struct class_device *class_dev) +{ + char *class_name; + + if (!class_dev->dev) + return; + + class_name = make_class_name(class_dev->class->name, &class_dev->kobj); + sysfs_remove_link(&class_dev->dev->kobj, class_name); + kfree(class_name); +} +#else +static inline int deprecated_class_uevent(char **envp, int num_envp, + int *cur_index, char *buffer, + int buffer_size, int *cur_len, + struct class_device *class_dev) +{ return 0; } +static inline int make_deprecated_class_device_links(struct class_device *cd) +{ return 0; } +static void remove_deprecated_class_device_links(struct class_device *cd) +{ } +#endif + static int class_uevent(struct kset *kset, struct kobject *kobj, char **envp, int num_envp, char *buffer, int buffer_size) { @@ -362,25 +448,8 @@ static int class_uevent(struct kset *kse pr_debug("%s - name = %s\n", __FUNCTION__, class_dev->class_id); - if (class_dev->dev) { - /* add device, backing this class device (deprecated) */ - struct device *dev = class_dev->dev; - char *path = kobject_get_path(&dev->kobj, GFP_KERNEL); - - add_uevent_var(envp, num_envp, &i, buffer, buffer_size, - &length, "PHYSDEVPATH=%s", path); - kfree(path); - - if (dev->bus) - add_uevent_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "PHYSDEVBUS=%s", dev->bus->name); - - if (dev->driver) - add_uevent_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "PHYSDEVDRIVER=%s", dev->driver->name); - } + deprecated_class_uevent(envp, num_envp, &i, buffer, buffer_size, + &length, class_dev); if (MAJOR(class_dev->devt)) { add_uevent_var(envp, num_envp, &i, @@ -506,29 +575,11 @@ void class_device_initialize(struct clas INIT_LIST_HEAD(&class_dev->node); } -char *make_class_name(const char *name, struct kobject *kobj) -{ -
[PATCH] introduce put_pid_rcu() to fix unsafe put_pid(vc->vt_pid)
Compile tested. drivers/char/vt_ioctl.c changes vc->vt_pid doing put_pid(xchg(&vc->vt_pid, ...)); This is unsafe, put_pid() can actually free the memory while vc->vt_pid is still used by kill_pid(vc->vt_pid). Add a new helper, put_pid_rcu(), which frees "struct pid" via rcu callback and convert vt_ioctl.c to use it. Signed-off-by: Oleg Nesterov <[EMAIL PROTECTED]> include/linux/pid.h |2 ++ kernel/pid.c| 18 ++ drivers/char/vt_ioctl.c | 22 ++ 3 files changed, 38 insertions(+), 4 deletions(-) --- 19-rc6/include/linux/pid.h~vt_pid 2006-10-22 18:24:02.0 +0400 +++ 19-rc6/include/linux/pid.h 2006-12-02 01:38:59.0 +0300 @@ -64,6 +64,8 @@ static inline struct pid *get_pid(struct } extern void FASTCALL(put_pid(struct pid *pid)); +extern void put_pid_rcu(struct pid *pid); + extern struct task_struct *FASTCALL(pid_task(struct pid *pid, enum pid_type)); extern struct task_struct *FASTCALL(get_pid_task(struct pid *pid, enum pid_type)); --- 19-rc6/kernel/pid.c~vt_pid 2006-10-22 18:24:03.0 +0400 +++ 19-rc6/kernel/pid.c 2006-12-02 01:35:15.0 +0300 @@ -196,6 +196,24 @@ fastcall void free_pid(struct pid *pid) call_rcu(&pid->rcu, delayed_put_pid); } +static void delayed_free_pid(struct rcu_head *rhp) +{ + struct pid *pid = container_of(rhp, struct pid, rcu); + kmem_cache_free(pid_cachep, pid); +} + +void put_pid_rcu(struct pid *pid) +{ + if (!pid) + return; + /* +* ->count can't go to 0 unless delayed_put_pid() was already +* called (RCU owns a reference), so we can re-use pid->rcu. +*/ + if (atomic_dec_and_test(&pid->count)) + call_rcu(&pid->rcu, delayed_free_pid); +} + struct pid *alloc_pid(void) { struct pid *pid; --- 19-rc6/drivers/char/vt_ioctl.c~vt_pid 2006-10-22 18:23:58.0 +0400 +++ 19-rc6/drivers/char/vt_ioctl.c 2006-12-02 02:44:48.0 +0300 @@ -358,6 +358,20 @@ do_unimap_ioctl(int cmd, struct unimapde return 0; } +static inline void set_vt_pid(struct vc_data *vc, struct pid *pid) +{ + put_pid_rcu(xchg(&vc->vt_pid, pid)); +} + +static int kill_vt_pid(struct vc_data *vc, int sig) +{ + int ret; + rcu_read_lock(); + ret = kill_pid(rcu_dereference(vc->vt_pid), sig, 1); + rcu_read_unlock(); + return ret; +} + /* * We handle the console-specific ioctl's here. We allow the * capability to modify any console, not just the fg_console. @@ -672,7 +686,7 @@ int vt_ioctl(struct tty_struct *tty, str vc->vt_mode = tmp; /* the frsig is ignored, so we set it to 0 */ vc->vt_mode.frsig = 0; - put_pid(xchg(&vc->vt_pid, get_pid(task_pid(current; + set_vt_pid(vc, get_pid(task_pid(current))); /* no switch is required -- [EMAIL PROTECTED] */ vc->vt_newvt = -1; release_console_sem(); @@ -1063,7 +1077,7 @@ void reset_vc(struct vc_data *vc) vc->vt_mode.relsig = 0; vc->vt_mode.acqsig = 0; vc->vt_mode.frsig = 0; - put_pid(xchg(&vc->vt_pid, NULL)); + set_vt_pid(vc, NULL); vc->vt_newvt = -1; if (!in_interrupt())/* Via keyboard.c:SAK() - akpm */ reset_palette(vc); @@ -1114,7 +1128,7 @@ static void complete_change_console(stru * tell us if the process has gone or something else * is awry */ - if (kill_pid(vc->vt_pid, vc->vt_mode.acqsig, 1) != 0) { + if (kill_vt_pid(vc, vc->vt_mode.acqsig) != 0) { /* * The controlling process has died, so we revert back to * normal operation. In this case, we'll also change back @@ -1174,7 +1188,7 @@ void change_console(struct vc_data *new_ * tell us if the process has gone or something else * is awry */ - if (kill_pid(vc->vt_pid, vc->vt_mode.relsig, 1) == 0) { + if (kill_vt_pid(vc, vc->vt_mode.relsig) == 0) { /* * It worked. Mark the vt to switch to and * return. The process needs to send us a - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Be a bit defensive in quirk_nvidia_ck804() so we don't risk dereferencing a NULL pdev.
On Sat, 2 Dec 2006 00:21:56 +0100 Jesper Juhl <[EMAIL PROTECTED]> wrote: > pci_get_slot() may return NULL if nothing was found. > quirk_nvidia_ck804() does not check the value returned from pci_get_slot(), > so it may end up causing a NULL pointer deref. > > > Signed-off-by: Jesper Juhl <[EMAIL PROTECTED]> I don't think its a physically possible case but it does no harm and it'll kill boot if it happens Acked-by: Alan Cox <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/36] Driver core: make old versions of udev work properly
From: Greg Kroah-Hartman <[EMAIL PROTECTED]> If CONFIG_SYSFS_DEPRECATED is enabled, old versions of udev will work properly with devices that are associated with a class. Cc: Kay Sievers <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/base/core.c | 59 ++ 1 files changed, 45 insertions(+), 14 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index dbcd40b..8f8347b 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -384,6 +384,19 @@ void device_initialize(struct device *de device_init_wakeup(dev, 0); } +#ifdef CONFIG_SYSFS_DEPRECATED +int setup_parent(struct device *dev, struct device *parent) +{ + /* Set the parent to the class, not the parent device */ + /* this keeps sysfs from having a symlink to make old udevs happy */ + if (dev->class) + dev->kobj.parent = &dev->class->subsys.kset.kobj; + else if (parent) + dev->kobj.parent = &parent->kobj; + + return 0; +} +#else static int virtual_device_parent(struct device *dev) { if (!dev->class) @@ -401,6 +414,22 @@ static int virtual_device_parent(struct return 0; } +int setup_parent(struct device *dev, struct device *parent) +{ + int error; + + /* if this is a class device, and has no parent, create one */ + if ((dev->class) && (parent == NULL)) { + error = virtual_device_parent(dev); + if (error) + return error; + } else if (parent) + dev->kobj.parent = &parent->kobj; + + return 0; +} +#endif + /** * device_add - add device to device hierarchy. * @dev: device. @@ -423,23 +452,18 @@ int device_add(struct device *dev) if (!dev || !strlen(dev->bus_id)) goto Error; - /* if this is a class device, and has no parent, create one */ - if ((dev->class) && (dev->parent == NULL)) { - error = virtual_device_parent(dev); - if (error) - goto Error; - } + pr_debug("DEV: registering device: ID = '%s'\n", dev->bus_id); parent = get_device(dev->parent); - pr_debug("DEV: registering device: ID = '%s'\n", dev->bus_id); + error = setup_parent(dev, parent); + if (error) + goto Error; /* first, register with generic layer. */ kobject_set_name(&dev->kobj, "%s", dev->bus_id); - if (parent) - dev->kobj.parent = &parent->kobj; - - if ((error = kobject_add(&dev->kobj))) + error = kobject_add(&dev->kobj); + if (error) goto Error; /* notify platform of device entry */ @@ -484,8 +508,11 @@ int device_add(struct device *dev) if (dev->class) { sysfs_create_link(&dev->kobj, &dev->class->subsys.kset.kobj, "subsystem"); - sysfs_create_link(&dev->class->subsys.kset.kobj, &dev->kobj, - dev->bus_id); + /* If this is not a "fake" compatible device, then create the +* symlink from the class to the device. */ + if (dev->kobj.parent != &dev->class->subsys.kset.kobj) + sysfs_create_link(&dev->class->subsys.kset.kobj, + &dev->kobj, dev->bus_id); if (parent) { sysfs_create_link(&dev->kobj, &dev->parent->kobj, "device"); class_name = make_class_name(dev->class->name, &dev->kobj); @@ -623,7 +650,11 @@ void device_del(struct device * dev) } if (dev->class) { sysfs_remove_link(&dev->kobj, "subsystem"); - sysfs_remove_link(&dev->class->subsys.kset.kobj, dev->bus_id); + /* If this is not a "fake" compatible device, remove the +* symlink from the class to the device. */ + if (dev->kobj.parent != &dev->class->subsys.kset.kobj) + sysfs_remove_link(&dev->class->subsys.kset.kobj, + dev->bus_id); class_name = make_class_name(dev->class->name, &dev->kobj); if (parent) { sysfs_remove_link(&dev->kobj, "device"); -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [GIT PATCH] PCI patches for 2.6.19
On Fri, Dec 01, 2006 at 03:16:24PM -0800, Greg KH wrote: > Here are some PCI patches for 2.6.19 You meant 2.6.20-rc1? grant > > They contain a number of PCI hotplug driver fixes and changes, and some > other stuff that is detailed below. > > All of these patches have been in the -mm tree for a while. > > Please pull from: > git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/pci-2.6.git/ > or if master.kernel.org hasn't synced up yet: > master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6.git/ > > The full patches will be sent to the linux-pci mailing list, if anyone > wants to see them. > > thanks, > > greg k-h > > arch/i386/kernel/pci-dma.c |4 +- > arch/i386/pci/common.c |2 +- > arch/i386/pci/fixup.c | 46 --- > arch/i386/pci/i386.c| 64 ++- > arch/i386/pci/irq.c |6 + > arch/ia64/pci/pci.c | 75 ++--- > arch/ia64/sn/kernel/Makefile|5 +- > arch/ia64/sn/kernel/io_acpi_init.c | 231 +++ > arch/ia64/sn/kernel/io_common.c | 613 ++ > arch/ia64/sn/kernel/io_init.c | 633 > +-- > arch/ia64/sn/kernel/iomv.c | 11 +- > arch/ia64/sn/kernel/setup.c | 18 + > arch/ia64/sn/kernel/tiocx.c |2 +- > arch/ia64/sn/pci/pcibr/pcibr_provider.c | 17 +- > arch/ia64/sn/pci/tioce_provider.c | 18 - > arch/powerpc/platforms/powermac/pci.c |1 - > arch/sparc64/kernel/pci.c |9 - > drivers/i2c/busses/Kconfig |1 + > drivers/i2c/busses/i2c-i801.c |2 + > drivers/message/i2o/pci.c | 15 +- > drivers/pci/Kconfig |2 +- > drivers/pci/access.c| 75 +++-- > drivers/pci/hotplug/acpiphp.h |4 +- > drivers/pci/hotplug/acpiphp_core.c | 39 +-- > drivers/pci/hotplug/acpiphp_glue.c |8 +- > drivers/pci/hotplug/ibmphp_pci.c|4 +- > drivers/pci/hotplug/pciehp_core.c |7 +- > drivers/pci/hotplug/pciehp_hpc.c|2 - > drivers/pci/hotplug/rpadlpar_core.c |2 +- > drivers/pci/hotplug/rpaphp_core.c |2 +- > drivers/pci/hotplug/sgi_hotplug.c | 35 +- > drivers/pci/msi.h |8 - > drivers/pci/pci-acpi.c | 10 +- > drivers/pci/pci-driver.c| 11 +- > drivers/pci/pci-sysfs.c | 33 +- > drivers/pci/pci.c | 123 +- > drivers/pci/pci.h |1 + > drivers/pci/probe.c | 27 ++ > drivers/pci/quirks.c| 59 +--- > drivers/pci/rom.c |9 +- > include/asm-ia64/io.h |2 +- > include/asm-ia64/machvec.h | 12 + > include/asm-ia64/machvec_sn2.h |2 + > include/asm-ia64/pci.h | 21 +- > include/asm-ia64/sn/acpi.h | 16 + > include/asm-ia64/sn/pcidev.h| 22 +- > include/asm-ia64/sn/sn_feature_sets.h |6 + > include/asm-ia64/sn/sn_sal.h|1 + > include/asm-powerpc/pci.h | 20 +- > include/asm-sparc64/pci.h |6 +- > include/linux/ioport.h |1 + > include/linux/pci.h |3 +- > include/linux/pci_ids.h |7 + > include/linux/pci_regs.h|6 + > 54 files changed, 1400 insertions(+), 959 deletions(-) > create mode 100644 arch/ia64/sn/kernel/io_acpi_init.c > create mode 100644 arch/ia64/sn/kernel/io_common.c > create mode 100644 include/asm-ia64/sn/acpi.h > > --- > > Adrian Bunk (2): > PCI: ibmphp_pci.c: fix NULL dereference > PCI: make arch/i386/pci/common.c:pci_bf_sort static > > Akinobu Mita (3): > acpiphp: fix use of list_for_each macro > acpiphp: fix missing acpiphp_glue_exit() > pci: fix __pci_register_driver error handling > > Alan Cox (1): > PCI: quirks: fix the festering mess that claims to handle IDE quirks > > Amol Lad (1): > PCI: arch/i386/kernel/pci-dma.c: ioremap balanced with iounmap > > Greg Kroah-Hartman (1): > PCI: Let PCI_MULTITHREAD_PROBE not be broken > > Inaky Perez-Gonzalez (2): > PCI: switch pci_{enable,disable}_device() to be nestable > PCI: pci_{enable,disable}_device() nestable ports > > Jason Gaston (2): > PCI: irq: irq and pci_ids patch for Intel ICH9 > i2c-i801: SMBus patch for Intel ICH9 > > John Keller (3): > Altix: Add initial ACPI IO support > Altix: SN ACPI hotplug support. > Altix: Initial ACPI support - ROM shadowing. > > John Rose (1): > PCI: rpaphp: change device tree examination > > Kenji Kaneshige (2): > pciehp: remove unnecessary free_irq > pciehp: remove unnecessa
[PATCH 4/36] CONFIG_SYSFS_DEPRECATED
From: Kay Sievers <[EMAIL PROTECTED]> Provide a way to support older versions of udev that are shipped in older distros. If this option is disabled, it will also turn off the compatible symlinks in sysfs that older programs might rely on. When in doubt, or if running a distro older than 2006, say Yes here. Signed-off-by: Kay Sievers <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- init/Kconfig | 20 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index 176f7e5..14d4846 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -249,6 +249,26 @@ config CPUSETS Say N if unsure. +config SYSFS_DEPRECATED + bool "Create deprecated sysfs files" + default y + help + This option creates deprecated symlinks such as the + "device"-link, the :-link, and the + "bus"-link. It may also add deprecated key in the + uevent environment. + None of these features or values should be used today, as + they export driver core implementation details to userspace + or export properties which can't be kept stable across kernel + releases. + + If enabled, this option will also move any device structures + that belong to a class, back into the /sys/class heirachy, in + order to support older versions of udev. + + If you are using a distro that was released in 2006 or later, + it should be safe to say N here. + config RELAY bool "Kernel->user space relay support (formerly relayfs)" help -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 12/36] Driver core: change misc class_devices to be real devices
From: Greg Kroah-Hartman <[EMAIL PROTECTED]> This also ment that some of the misc drivers had to also be fixed up as they were assuming the device was a class_device. Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/char/hw_random/core.c | 38 +++--- drivers/char/misc.c | 13 - drivers/char/tpm/tpm.c |2 +- drivers/input/serio/serio_raw.c |2 +- include/linux/miscdevice.h |5 ++--- 5 files changed, 27 insertions(+), 33 deletions(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 154a81d..ebace20 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c @@ -162,7 +162,8 @@ static struct miscdevice rng_miscdev = { }; -static ssize_t hwrng_attr_current_store(struct class_device *class, +static ssize_t hwrng_attr_current_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t len) { int err; @@ -192,7 +193,8 @@ static ssize_t hwrng_attr_current_store( return err ? : len; } -static ssize_t hwrng_attr_current_show(struct class_device *class, +static ssize_t hwrng_attr_current_show(struct device *dev, + struct device_attribute *attr, char *buf) { int err; @@ -210,7 +212,8 @@ static ssize_t hwrng_attr_current_show(s return ret; } -static ssize_t hwrng_attr_available_show(struct class_device *class, +static ssize_t hwrng_attr_available_show(struct device *dev, +struct device_attribute *attr, char *buf) { int err; @@ -234,20 +237,18 @@ static ssize_t hwrng_attr_available_show return ret; } -static CLASS_DEVICE_ATTR(rng_current, S_IRUGO | S_IWUSR, -hwrng_attr_current_show, -hwrng_attr_current_store); -static CLASS_DEVICE_ATTR(rng_available, S_IRUGO, -hwrng_attr_available_show, -NULL); +static DEVICE_ATTR(rng_current, S_IRUGO | S_IWUSR, + hwrng_attr_current_show, + hwrng_attr_current_store); +static DEVICE_ATTR(rng_available, S_IRUGO, + hwrng_attr_available_show, + NULL); static void unregister_miscdev(void) { - class_device_remove_file(rng_miscdev.class, -&class_device_attr_rng_available); - class_device_remove_file(rng_miscdev.class, -&class_device_attr_rng_current); + device_remove_file(rng_miscdev.this_device, &dev_attr_rng_available); + device_remove_file(rng_miscdev.this_device, &dev_attr_rng_current); misc_deregister(&rng_miscdev); } @@ -258,20 +259,19 @@ static int register_miscdev(void) err = misc_register(&rng_miscdev); if (err) goto out; - err = class_device_create_file(rng_miscdev.class, - &class_device_attr_rng_current); + err = device_create_file(rng_miscdev.this_device, +&dev_attr_rng_current); if (err) goto err_misc_dereg; - err = class_device_create_file(rng_miscdev.class, - &class_device_attr_rng_available); + err = device_create_file(rng_miscdev.this_device, +&dev_attr_rng_available); if (err) goto err_remove_current; out: return err; err_remove_current: - class_device_remove_file(rng_miscdev.class, -&class_device_attr_rng_current); + device_remove_file(rng_miscdev.this_device, &dev_attr_rng_current); err_misc_dereg: misc_deregister(&rng_miscdev); goto out; diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 62ebe09..7a484fc 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c @@ -169,11 +169,6 @@ fail: return err; } -/* - * TODO for 2.7: - * - add a struct kref to struct miscdevice and make all usages of - *them dynamic. - */ static struct class *misc_class; static const struct file_operations misc_fops = { @@ -228,10 +223,10 @@ int misc_register(struct miscdevice * mi misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); dev = MKDEV(MISC_MAJOR, misc->minor); - misc->class = class_device_create(misc_class, NULL, dev, misc->dev, + misc->this_device = device_create(misc_class, misc->parent, dev, "%s", misc->name); - if (IS_ERR(misc->class)) { - err = PTR_ERR(misc->class); + if (IS_ERR(misc->this_device)) { + err = PTR_ERR(misc->this_device); goto out; } @@ -264,7 +2
[PATCH 11/36] Driver core: convert vc code to use struct device
From: Greg Kroah-Hartman <[EMAIL PROTECTED]> Converts from using struct "class_device" to "struct device" making everything show up properly in /sys/devices/ with symlinks from the /sys/class directory. Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/char/vc_screen.c | 16 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c index bd7a98c..f442b57 100644 --- a/drivers/char/vc_screen.c +++ b/drivers/char/vc_screen.c @@ -476,16 +476,16 @@ static struct class *vc_class; void vcs_make_sysfs(struct tty_struct *tty) { - class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), - NULL, "vcs%u", tty->index + 1); - class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), - NULL, "vcsa%u", tty->index + 1); + device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), + "vcs%u", tty->index + 1); + device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), + "vcsa%u", tty->index + 1); } void vcs_remove_sysfs(struct tty_struct *tty) { - class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 1)); - class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 129)); + device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 1)); + device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 129)); } int __init vcs_init(void) @@ -494,7 +494,7 @@ int __init vcs_init(void) panic("unable to get major %d for vcs device", VCS_MAJOR); vc_class = class_create(THIS_MODULE, "vc"); - class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs"); - class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa"); + device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), "vcs"); + device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), "vcsa"); return 0; } -- 1.4.4.1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC] Include ACPI DSDT from INITRD patch into mainline
On Fri, Dec 01, 2006 at 03:58:14PM -0500, Ben Collins wrote: > On Fri, 2006-12-01 at 19:53 +, Alan wrote: > > > > The whole approach of using filp_open() not the firmware interface > > > > is horribly ugly and does not belong mainstream. > > > > > > What about the point that userspace (udev, and such) is not available > > > when DSDT loading needs to occur? Init hasn't even started at that > > > point. > > > > Does that change the fact it is ugly ? > > No, but it does beg the question "how else can it be done"? > > Distros need a way for users to add a fixed DSDT without recompiling > their own kernels. There already is a way. It's called beating up the braindead bios authors, and pressuring motherboard vendors to push out updates. Dave -- http://www.codemonkey.org.uk - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.19-rc6-mm2
Andrew, I booted without the video and vga settings with earlyprintk=vga and got output. The kenerl was complaining about a crc error. Checking the patch list I found: crc32-replace-bitreverse-by-bitrev32.patch reversing this patch fixes booting here. Please do not push this on - it breaks amd64 here. Thanks Ed Tomlinson On Thursday 30 November 2006 08:03, Ed Tomlinson wrote: > On Wednesday 29 November 2006 23:10, Randy Dunlap wrote: > > On Wed, 29 Nov 2006 22:42:20 -0500 Ed Tomlinson wrote: > > > > > On Tuesday 28 November 2006 05:02, Andrew Morton wrote: > > > > > > > Will appear eventually at > > > > > > > > ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.19-rc6/2.6.19-rc6-mm2/ > > > > > > This kernel does not boot here. It does not get far enough to post > > > anything to my serial console. > > > > Have you tried using "earlyprintk=..." to see if it produces any > > more output? > > Nothing is displayed by earlyprintk. I also added it to the rc5-mm2 boot to > verify it. The messages > displayed were the same as below... > > Thanks > Ed > > > > The last booted kernel here is 19-rc5-mm2. Grub is used to boot, here > > > is the starting log > > > of rc5-mm2 build is UP AMD64: > > > > > > [0.00] Linux version 2.6.19-rc5-mm2 ([EMAIL PROTECTED]) (gcc > > > version 4.1.1 (Gentoo 4.1.1-r1)) #1 PREEM6 > > > [0.00] Command line: root=/dev/sda3 vga=0x318 > > > video=vesafb:ywrap,mtrr:3 console=tty0 console=tty1 > > > [0.00] BIOS-provided physical RAM map: > > > [0.00] BIOS-e820: - 0009f800 (usable) > > > [0.00] BIOS-e820: 0009f800 - 000a (reserved) > > > [0.00] BIOS-e820: 000f - 0010 (reserved) > > > [0.00] BIOS-e820: 0010 - 3fff (usable) > > > [0.00] BIOS-e820: 3fff - 3fff3000 (ACPI NVS) > > > [0.00] BIOS-e820: 3fff3000 - 4000 (ACPI data) > > > [0.00] BIOS-e820: fec0 - fec01000 (reserved) > > > [0.00] BIOS-e820: fee0 - fef0 (reserved) > > > [0.00] BIOS-e820: fefffc00 - ff00 (reserved) > > > [0.00] BIOS-e820: - 0001 (reserved) > > > [0.00] end_pfn_map = 1048576 > > > [0.00] DMI 2.2 present. > > > [0.00] Zone PFN ranges: > > > [0.00] DMA 0 -> 4096 > > > [0.00] DMA324096 -> 1048576 > > > [0.00] Normal1048576 -> 1048576 > > > [0.00] early_node_map[2] active PFN ranges > > > [0.00] 0:0 -> 159 > > > [0.00] 0: 256 -> 262128 > > > [0.00] Nvidia board detected. Ignoring ACPI timer override. > > > [0.00] ACPI: PM-Timer IO Port: 0x4008 > > > [0.00] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled) > > > [0.00] Processor #0 (Bootup-CPU) > > > [0.00] ACPI: LAPIC_NMI (acpi_id[0x00] high edge lint[0x1]) > > > [0.00] ACPI: IOAPIC (id[0x02] address[0xfec0] gsi_base[0]) > > > [0.00] IOAPIC[0]: apic_id 2, address 0xfec0, GSI 0-23 > > > [0.00] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl) > > > [0.00] ACPI: BIOS IRQ0 pin2 override ignored. > > > [0.00] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level) > > > [0.00] ACPI: INT_SRC_OVR (bus 0 bus_irq 14 global_irq 14 high > > > edge) > > > [0.00] ACPI: INT_SRC_OVR (bus 0 bus_irq 15 global_irq 15 high > > > edge) > > > [0.00] Setting APIC routing to flat > > > [0.00] Using ACPI (MADT) for SMP configuration information > > > [0.00] Nosave address range: 0009f000 - 000a > > > [0.00] Nosave address range: 000a - 000f > > > [0.00] Nosave address range: 000f - 0010 > > > [0.00] Allocating PCI resources starting at 5000 (gap: > > > 4000:bec0) > > > [0.00] Built 1 zonelists. Total pages: 257320 > > > [0.00] Kernel command line: root=/dev/sda3 vga=0x318 > > > video=vesafb:ywrap,mtrr:3 console=tty0 cons1 > > > [0.00] Initializing CPU#0 > > > [0.00] PID hash table entries: 4096 (order: 12, 32768 bytes) > > > > > > Any ideas what I should try or suggestions on patches to remove/try. > > > > > > Thanks > > > Ed > > > > --- > > ~Randy > > - > > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > > the body of a message to [EMAIL PROTECTED] > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > Please read the FAQ at http://www.tux.org/lkml/ > > > > > - > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to [EMAIL PROTECTED] > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please re
Re: [GIT PATCH] PCI patches for 2.6.19
On Fri, Dec 01, 2006 at 04:37:33PM -0700, Grant Grundler wrote: > On Fri, Dec 01, 2006 at 03:16:24PM -0800, Greg KH wrote: > > Here are some PCI patches for 2.6.19 > > You meant 2.6.20-rc1? No, well yes, they are "against" 2.6.19 :) thanks, greg k-h - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.19-rc6-mm2
On Fri, 1 Dec 2006 19:33:21 -0500 Ed Tomlinson <[EMAIL PROTECTED]> wrote: > I booted without the video and vga settings with earlyprintk=vga and got > output. The > kenerl was complaining about a crc error. Checking the patch list I found: > > crc32-replace-bitreverse-by-bitrev32.patch > > reversing this patch fixes booting here. Odd that you're the only person seeing this - could be a miscompile? What was the error message, exactly? - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [GIT PULL] MMC update
On Fri, 1 Dec 2006, Pierre Ossman wrote: > > git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc.git for-linus I get Already up-to-date. did you forget to push? Or is mirroring just really slow again? Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [GIT PATCH] PCI patches for 2.6.19
On Fri, 1 Dec 2006 16:37:33 -0700 Grant Grundler wrote: > On Fri, Dec 01, 2006 at 03:16:24PM -0800, Greg KH wrote: > > Here are some PCI patches for 2.6.19 > > You meant 2.6.20-rc1? He meant "for", as in "on top of" or "to patch" 2.6.19. Language has lots of ambiguity... --- ~Randy - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] atomic.h atomic64_t standardization
Mathieu Desnoyers wrote: Hi, I finalized the work for atomic64_t cmpxchg and atomic64_add_unless on all architectures. asm-generic/atomic.h atomic_long_t is also streamlined. Review is welcome. Beautiful! Now I can do the rwsem consolidation. Thanks. Nick -- SUSE Labs, Novell Inc. Send instant messages to your online friends http://au.messenger.yahoo.com - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Linux 2.6.18.5
We (the -stable team) are announcing the release of the 2.6.18.5 kernel. The diffstat and short summary of the fixes are below. I'll also be replying to this message with a copy of the patch between 2.6.18.4 and 2.6.18.5, as it is small enough to do so. The updated 2.6.18.y git tree can be found at: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.18.y.git and can be browsed at the normal kernel.org git web browser: www.kernel.org/git/ thanks, -chris Makefile |2 arch/alpha/Kconfig|2 arch/i386/kernel/microcode.c |9 -- arch/ia64/sn/kernel/bte.c |9 +- block/scsi_ioctl.c|3 drivers/char/agp/generic.c|2 drivers/char/agp/intel-agp.c |2 drivers/media/Kconfig |1 drivers/net/tg3.c |4 - drivers/net/wireless/bcm43xx/bcm43xx_main.c | 18 drivers/pcmcia/ds.c |5 + drivers/scsi/scsi_lib.c |1 fs/fuse/dir.c | 52 + include/linux/netfilter_ipv4.h|2 net/bluetooth/hci_sock.c | 11 +- net/dccp/ipv6.c |2 net/ieee80211/softmac/ieee80211softmac_io.c |2 net/ipv4/ipvs/ip_vs_core.c| 10 ++ net/ipv4/netfilter.c |9 +- net/ipv4/netfilter/arp_tables.c | 39 ++--- net/ipv4/netfilter/ip_conntrack_helper_h323.c |4 - net/ipv4/netfilter/ip_nat_standalone.c|3 net/ipv4/netfilter/ip_tables.c| 103 +- net/ipv4/netfilter/iptable_mangle.c |3 net/ipv4/udp.c| 19 +++- net/ipv6/netfilter/ip6_tables.c | 53 ++--- net/ipv6/udp.c|7 - net/netfilter/Kconfig |6 + 28 files changed, 231 insertions(+), 152 deletions(-) Summary of changes from v2.6.18.4 to v2.6.18.5 Chris Wright: Linux 2.6.18.5 Daniel Ritz: pcmcia: fix 'rmmod pcmcia' with unbound devices David S. Miller: BLUETOOTH: Fix unaligned access in hci_send_to_sock. Fernando J. Pereda: alpha: Fix ALPHA_EV56 dependencies typo Ira W. Snyder: TG3: Add missing unlock in tg3_open() error path. Laurent Riffard: softmac: fix a slab corruption in WEP restricted key association Linus Torvalds: AGP: Allocate AGP pages with GFP_DMA32 by default Maciej W. Rozycki: V4L: Do not enable VIDEO_V4L2 unconditionally Michael Buesch: bcm43xx: Drain TX status before starting IRQs Miklos Szeredi: fuse: fix Oops in lookup Olaf Kirch: UDP: Make udp_encap_rcv use pskb_may_pull Patrick McHardy: NETFILTER: Missing check for CAP_NET_ADMIN in iptables compat layer NETFILTER: ip_tables: compat error way cleanup NETFILTER: ip_tables: fix module refcount leaks in compat error paths NETFILTER: Missed and reordered checks in {arp,ip,ip6}_tables NETFILTER: arp_tables: missing unregistration on module unload NETFILTER: Honour source routing for LVS-NAT NETFILTER: Kconfig: fix xt_physdev dependencies NETFILTER: xt_CONNSECMARK: fix Kconfig dependencies NETFILTER: H.323 conntrack: fix crash with CONFIG_IP_NF_CT_ACCT Robin Holt: IA64: bte_unaligned_copy() transfers one extra cache line. Shaohua Li: x86 microcode: don't check the size Tejun Heo: scsi: clear garbage after CDBs on SG_IO YOSHIFUJI Hideaki: IPV6: Fix address/interface handling in UDP and DCCP, according to the scoping architecture. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Linux 2.6.18.5
diff --git a/Makefile b/Makefile index d026088..85d8009 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 18 -EXTRAVERSION = .4 +EXTRAVERSION = .5 NAME=Avast! A bilge rat! # *DOCUMENTATION* diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 213c785..2b36afd 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig @@ -381,7 +381,7 @@ config ALPHA_EV56 config ALPHA_EV56 prompt "EV56 CPU (speed >= 333MHz)?" - depends on ALPHA_NORITAKE && ALPHA_PRIMO + depends on ALPHA_NORITAKE || ALPHA_PRIMO config ALPHA_EV56 prompt "EV56 CPU (speed >= 400MHz)?" diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c index 40b44cc..e5520eb 100644 --- a/arch/i386/kernel/microcode.c +++ b/arch/i386/kernel/microcode.c @@ -250,14 +250,14 @@ static int find_matching_ucodes (void) } total_size = get_totalsize(&mc_header); - if ((cursor + total_size > user_buffer_size) || (total_size < DEFAULT_UCODE_TOTALSIZE)) { + if (cursor + total_size > user_buffer_size) { printk(KERN_ERR "microcode: error! Bad data in microcode data file\n"); error = -EINVAL; goto out; } data_size = get_datasize(&mc_header); - if ((data_size + MC_HEADER_SIZE > total_size) || (data_size < DEFAULT_UCODE_DATASIZE)) { + if (data_size + MC_HEADER_SIZE > total_size) { printk(KERN_ERR "microcode: error! Bad data in microcode data file\n"); error = -EINVAL; goto out; @@ -460,11 +460,6 @@ static ssize_t microcode_write (struct f { ssize_t ret; - if (len < DEFAULT_UCODE_TOTALSIZE) { - printk(KERN_ERR "microcode: not enough data\n"); - return -EINVAL; - } - if ((len >> PAGE_SHIFT) > num_physpages) { printk(KERN_ERR "microcode: too much data (max %ld pages)\n", num_physpages); return -EINVAL; diff --git a/arch/ia64/sn/kernel/bte.c b/arch/ia64/sn/kernel/bte.c index 27dee45..c55f487 100644 --- a/arch/ia64/sn/kernel/bte.c +++ b/arch/ia64/sn/kernel/bte.c @@ -382,14 +382,13 @@ bte_result_t bte_unaligned_copy(u64 src, * bcopy to the destination. */ - /* Add the leader from source */ - headBteLen = len + (src & L1_CACHE_MASK); - /* Add the trailing bytes from footer. */ - headBteLen += L1_CACHE_BYTES - (headBteLen & L1_CACHE_MASK); - headBteSource = src & ~L1_CACHE_MASK; headBcopySrcOffset = src & L1_CACHE_MASK; headBcopyDest = dest; headBcopyLen = len; + + headBteSource = src - headBcopySrcOffset; + /* Add the leading and trailing bytes from source */ + headBteLen = L1_CACHE_ALIGN(len + headBcopySrcOffset); } if (headBcopyLen > 0) { diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index ed3d3ae..848ac42 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c @@ -286,9 +286,8 @@ static int sg_io(struct file *file, requ * fill in request structure */ rq->cmd_len = hdr->cmd_len; + memset(rq->cmd, 0, BLK_MAX_CDB); /* ATAPI hates garbage after CDB */ memcpy(rq->cmd, cmd, hdr->cmd_len); - if (sizeof(rq->cmd) != hdr->cmd_len) - memset(rq->cmd + hdr->cmd_len, 0, sizeof(rq->cmd) - hdr->cmd_len); memset(sense, 0, sizeof(sense)); rq->sense = sense; diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index cc5ea34..d218575 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c @@ -1042,7 +1042,7 @@ void *agp_generic_alloc_page(struct agp_ { struct page * page; - page = alloc_page(GFP_KERNEL); + page = alloc_page(GFP_KERNEL | GFP_DMA32); if (page == NULL) return NULL; diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index 61ac380..64bb579 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c @@ -160,7 +160,7 @@ static void *i8xx_alloc_pages(void) { struct page * page; - page = alloc_pages(GFP_KERNEL, 2); + page = alloc_pages(GFP_KERNEL | GFP_DMA32, 2); if (page == NULL) return NULL; diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index ed4aa4e..9f7e1fe 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig @@ -54,6 +54,7 @@ config VIDEO_V4L1_COMPAT config VIDEO_V4L2 bool + depends on VIDEO_DEV default y source "drivers/media/video/Kconfig" diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index eafabb2..fa620ae 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -6889,8 +6889,10 @@ static int tg3_open(stru
data corruption with nvidia chipsets and IDE/SATA drives // memory hole mapping related bug?!
Hi. Perhaps some of you have read my older two threads: http://marc.theaimsgroup.com/?t=11631244001&r=1&w=2 and the even older http://marc.theaimsgroup.com/?t=11629131451&r=1&w=2 The issue was basically the following: I found a severe bug mainly by fortune because it occurs very rarely. My test looks like the following: I have about 30GB of testing data on my harddisk,... I repeat verifying sha512 sums on these files and check if errors occur. One test pass verifies the 30GB 50 times,... about one to four differences are found in each pass. The corrupted data is not one single completely wrong block of data or so,.. but if you look at the area of the file where differences are found,.. than some bytes are ok,.. some are wrong,.. and so on (seems to be randomly). Also, there seems to be no event that triggers the corruption,.. it seems to be randomly, too. It is really definitely not a harware issue (see my old threads my emails to Tyan/Hitachi and my "workaround" below. My system isn't overclocked. My System: Mainboard: Tyan S2895 Chipsets: Nvidia nforce professional 2200 and 2050 and AMD 8131 CPU: 2x DualCore Opterons model 275 RAM: 4GB Kingston Registered/ECC Diskdrives: IBM/Hitachi: 1 PATA, 2 SATA The data corruption error occurs on all drives. You might have a look at the emails between me and Tyan and Hitachi,.. they contain probalby lots of valuable information (especially my different tests). Some days ago,.. an engineer of Tyan suggested me to boot the kernel with mem=3072M. When doing this,.. the issue did not occur (I don't want to say it was solved. Why? See my last emails to Tyan!) Then he suggested me to disable the memory hole mapping in the BIOS,... When doing so,.. the error doesn't occur, too. But I loose about 2GB RAM,.. and,.. more important,.. I cant believe that this is responsible for the whole issue. I don't consider it a solution but more a poor workaround which perhaps only by fortune solves the issue (Why? See my last eMails to Tyan ;) ) So I'd like to ask you if you perhaps could read the current information in this and previous mails,.. and tell me your opinions. It is very likely that a large number of users suffer from this error (namely all Nvidia chipset users) but only few (there are some,.. I found most of them in the Nvidia forums,.. and they have exactly the same issue) identify this as an error because it's so rare. Perhaps someone have an idea why disabling the memhole mapping solves it. I've always thought that memhole mapping just moves some address space to higher addreses to avoid the conflict between address space for PCI devices and address space for pyhsical memory. But this should be just a simple addition and not solve this obviously complex error. Lots of thanks in advance. Best wishes, Chris. # ### email #1 to Tyan/Hitachi ### # (sorry for reposting but the AMD support system requires to add some keywords in the subject, and I wanted to have the correct subject for all other parties (Tyan and Hitachi) too, so that CC'ing would be possible for all. Hi. I provide this information to: - Tyan ([EMAIL PROTECTED]) - Mr. Rodger Dusatko - Hitachi ([EMAIL PROTECTED] , please add the GST Support Request #627-602-082-5 in the subject) Mr. Schledz) - and with this email for the first time to AMD [EMAIL PROTECTED] (for the AMD people: please have a look at the information at the very end of this email first,... there you'll find links where you can read the introduction and description about the whole issue). It might be useful if you contact each other (and especially nvidia which I wasn't able to contact myself),.. but please CC me in all you communications. Also, please forward my emails/information to your responsible technical engineers and developers. Please do not ignore this problem: - it existing, - several users are experiencing it (thus this is not a single failure of my system), - it can cause severe data corruption (which is even more grave, as the a user won't notice it throught error messages) and - it happens with different Operating Systems (at least Linux and Windows). This is my current state of testing. For further information,.. please do not hesitate to ask. You'll find old information (included in my previous mails or found at the linux-kernel mailinglist thread I've included in my mails) at the end. - In the meantime I do not use diff any longer for my tests, simply because it takes much longer than to use sha512sums to verify dataintegrity (but this has not effect on the testing or the issue itself, it just proves that the error is not in the diff program). - I always test 30GB insteat of 15 - As before I'm still very sure, that the following components are fully working and not damaged (see my old mails or lkml): CPUs
Re: [PATCH] Be a bit defensive in quirk_nvidia_ck804() so we don't risk dereferencing a NULL pdev.
On Sat, 2 Dec 2006, Jesper Juhl wrote: > pci_get_slot() may return NULL if nothing was found. > quirk_nvidia_ck804() does not check the value returned from pci_get_slot(), > so it may end up causing a NULL pointer deref. > Looks good. The possible NULL pointer is actually not at pci_dev_put, but rather at pci_find_capability on the msi_ht_cap_enabled(pdev) call. > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c > index 5b44838..d3dcbda 100644 > --- a/drivers/pci/quirks.c > +++ b/drivers/pci/quirks.c > @@ -1741,6 +1741,8 @@ static void __devinit quirk_nvidia_ck804 >* a single one having MSI is enough to be sure that MSI are supported. >*/ > pdev = pci_get_slot(dev->bus, 0); > + if (!pdev) > + return; > if (dev->subordinate && !msi_ht_cap_enabled(dev) > && !msi_ht_cap_enabled(pdev)) { > printk(KERN_WARNING "PCI: MSI quirk detected. " > The check for dev->subordinate in the neighboring conditional can also be removed. David - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Cluster-devel] Re: [GFS2] Change argument of gfs2_dinode_out [17/70]
On Fri, Dec 01, 2006 at 05:29:46PM -0600, Russell Cattelan wrote: > gfs2 is supposed to be stabilized and use-able for the up coming rhel5 > release, not pretty up for somebody to print out and hang on their wall. Your insight, sir, is truly stunning. That is to say, it reminds of a sudden and unpleasant contact with something dense and misplaced. May I direct your attention to the fact that rhel5 is quite unlikely to be based on 2.6.20? - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: data corruption with nvidia chipsets and IDE/SATA drives // memory hole mapping related bug?!
On Sat Dec 02, 2006 at 01:56:06AM +0100, Christoph Anton Mitterer wrote: > The issue was basically the following: > I found a severe bug mainly by fortune because it occurs very rarely. > My test looks like the following: I have about 30GB of testing data on > my harddisk,... I repeat verifying sha512 sums on these files and check > if errors occur. > One test pass verifies the 30GB 50 times,... about one to four > differences are found in each pass. Doh! I have a Tyan S2895 in my system, and I've been pulling my hair out trying to track down the cause of a similar somewhat rare failure for the pre-computer sha1 of a block of data to actually match the calculated sha1. I'd been hunting in vain the past few days trying to find a cause -- looking for buffer overflows, non thread safe code, or similar usual suspects. It is a relief to see I am not alone! -Erik -- Erik B. Andersen http://codepoet-consulting.com/ --This message was written using 73% post-consumer electrons-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [dm-devel] Re: [RFC][PATCH] dm-cache: block level disk cache target for device mapper
On Mon, 2006-11-27 at 13:55 -0600, Eric Van Hensbergen wrote: > On 11/27/06, bert hubert <[EMAIL PROTECTED]> wrote: > > On Mon, Nov 27, 2006 at 06:26:34PM +, Eric Van Hensbergen wrote: > > > This is the first cut of a device-mapper target which provides a > > > write-back > > > or write-through block cache. It is intended to be used in conjunction > > > with > > > remote block devices such as iSCSI or ATA-over-Ethernet, particularly in > > > cluster situations. > > > > How does this work in practice? In other words, what is a typical actual > > configuration? > > > > There is a remote block device, and a local one, and these are kept into > > sync in some way? > > > > That's the basic idea. In our testbed, we had a single iSCSI server > exporting block devices to several clients -- each maintaining their > own local disk cache of the server exported block devices. You can > configured either write-through or write-back policies -- write-back > has better performance, but somewhat obvious consistency issues in > failure cases. > > The original intent was to combine this with the dm-cow target (which > I posted a few hours before the dm-cache patch) to provide a scalable > cluster deployment system based on back-end iSCSI or ATA-over-Ethernet > storage. like to see this idea but any similarity with http://www.ele.uri.edu/Research/hpcl/STICS/stics.pdf? STICS is patent pending so not sure if kernel can be free to merge this dm-cache. > > -eric > > -- > dm-devel mailing list > [EMAIL PROTECTED] > https://www.redhat.com/mailman/listinfo/dm-devel - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: data corruption with nvidia chipsets and IDE/SATA drives // memory hole mapping related bug?!
Erik Andersen wrote: > Doh! I have a Tyan S2895 in my system, and I've been pulling my > hair out trying to track down the cause of a similar somewhat > rare failure for the pre-computer sha1 of a block of data to > actually match the calculated sha1. I'd been hunting in vain the > past few days trying to find a cause -- looking for buffer > overflows, non thread safe code, or similar usual suspects. > > It is a relief to see I am not alone! > ^^ You might read my email and all links in it, etc. throughly,.. than you can try what I did. Please inform me about all your results, and about your specific hardware (i.e. CPU type (with stepping and exact model), which harddisks and so on). Best wishes, Chris. begin:vcard fn:Mitterer, Christoph Anton n:Mitterer;Christoph Anton email;internet:[EMAIL PROTECTED] x-mozilla-html:TRUE version:2.1 end:vcard
[PATCH 2.6.19 1/3] sata_promise: PHYMODE4 fixup
This patch adds code to fix up the PHYMODE4 "align timing" register value on second-generation Promise SATA chips. Failure to correct this value on non-x86 machines makes drive detection prone to failure due to timeouts. (I've observed about 50% detection failure rates on SPARC64.) The HW boots with a bad value in this register, but on x86 machines the Promise BIOS corrects it to the value recommended by the manual, so most people have been unaffected by this issue. After developing the patch I checked Promise's SATAII driver, and discovered that it also corrects PHYMODE4 just like this patch does. This patch depends on the sata_promise SATAII updates patch I sent recently. Signed-off-by: Mikael Pettersson <[EMAIL PROTECTED]> diff -rupN linux-2.6.19.sata_promise-1-genII-fixes/drivers/ata/sata_promise.c linux-2.6.19.sata_promise-2-PHYMODE4-fixup/drivers/ata/sata_promise.c --- linux-2.6.19.sata_promise-1-genII-fixes/drivers/ata/sata_promise.c 2006-11-30 23:25:03.0 +0100 +++ linux-2.6.19.sata_promise-2-PHYMODE4-fixup/drivers/ata/sata_promise.c 2006-11-30 23:36:57.0 +0100 @@ -281,6 +281,7 @@ static struct pci_driver pdc_ata_pci_dri static int pdc_port_start(struct ata_port *ap) { struct device *dev = ap->host->dev; + struct pdc_host_priv *hp = ap->host->private_data; struct pdc_port_priv *pp; int rc; @@ -302,6 +303,16 @@ static int pdc_port_start(struct ata_por ap->private_data = pp; + /* fix up PHYMODE4 align timing */ + if ((hp->flags & PDC_FLAG_GEN_II) && sata_scr_valid(ap)) { + void __iomem *mmio = (void __iomem *) ap->ioaddr.scr_addr; + unsigned int tmp; + + tmp = readl(mmio + 0x014); + tmp = (tmp & ~3) | 1; /* set bits 1:0 = 0:1 */ + writel(tmp, mmio + 0x014); + } + return 0; err_out_kfree: - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2.6.19 2/3] sata_promise: new EH conversion
This patch converts sata_promise to use new-style libata error handling for its SATA ports. PATA is left unchanged. * ATA_FLAG_SRST is no longer set for SATA ports * ->phy_reset is no longer set as it is unused when ->error_handler is present, and pdc_sata_phy_reset() has been removed * pdc_freeze() masks interrupts and halts DMA via PDC_CTLSTAT * pdc_thaw() clears interrupt status in PDC_INT_SEQMASK and then unmasks interrupts in PDC_CTLSTAT * pdc_error_handler() simply freezes the port and then invokes ata_do_eh() with standard {s,}ata reset methods * pdc_post_internal_cmd() resets the port in case of errors The changes are primarily modelled after ahci and sata_sil24. These changes have been tested on Promise SATAII (205xx) chips. I strongly believe they should work on SATAI chips as well, and probably also on PATA chips (20619) and ports. However, since I have no documentation for the PATA-only 20619, I let the driver continue using old-style EH for it (easily changed). This patch is intended to be applied on top of the sata_promise SATAII updates patch I sent recently, but will apply and work even if that patch has not been applied. Signed-off-by: Mikael Pettersson <[EMAIL PROTECTED]> diff -rupN linux-2.6.19.sata_promise-2-PHYMODE4-fixup/drivers/ata/sata_promise.c linux-2.6.19.sata_promise-3-new_EH/drivers/ata/sata_promise.c --- linux-2.6.19.sata_promise-2-PHYMODE4-fixup/drivers/ata/sata_promise.c 2006-11-30 23:36:57.0 +0100 +++ linux-2.6.19.sata_promise-3-new_EH/drivers/ata/sata_promise.c 2006-11-30 23:56:32.0 +0100 @@ -73,9 +73,12 @@ enum { PDC_HAS_PATA= (1 << 1), /* PDC20375/20575 has PATA */ + /* PDC_CTLSTAT bit definitions */ + PDC_DMA_ENABLE = (1 << 7), + PDC_IRQ_DISABLE = (1 << 10), PDC_RESET = (1 << 11), /* HDMA reset */ - PDC_COMMON_FLAGS= ATA_FLAG_NO_LEGACY | ATA_FLAG_SRST | + PDC_COMMON_FLAGS= ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI | ATA_FLAG_PIO_POLLING, @@ -102,13 +105,16 @@ static void pdc_eng_timeout(struct ata_p static int pdc_port_start(struct ata_port *ap); static void pdc_port_stop(struct ata_port *ap); static void pdc_pata_phy_reset(struct ata_port *ap); -static void pdc_sata_phy_reset(struct ata_port *ap); static void pdc_qc_prep(struct ata_queued_cmd *qc); static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); static void pdc_irq_clear(struct ata_port *ap); static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc); static void pdc_host_stop(struct ata_host *host); +static void pdc_freeze(struct ata_port *ap); +static void pdc_thaw(struct ata_port *ap); +static void pdc_error_handler(struct ata_port *ap); +static void pdc_post_internal_cmd(struct ata_queued_cmd *qc); static struct scsi_host_template pdc_ata_sht = { @@ -137,11 +143,12 @@ static const struct ata_port_operations .exec_command = pdc_exec_command_mmio, .dev_select = ata_std_dev_select, - .phy_reset = pdc_sata_phy_reset, - .qc_prep= pdc_qc_prep, .qc_issue = pdc_qc_issue_prot, - .eng_timeout= pdc_eng_timeout, + .freeze = pdc_freeze, + .thaw = pdc_thaw, + .error_handler = pdc_error_handler, + .post_internal_cmd = pdc_post_internal_cmd, .data_xfer = ata_mmio_data_xfer, .irq_handler= pdc_interrupt, .irq_clear = pdc_irq_clear, @@ -199,7 +206,7 @@ static const struct ata_port_info pdc_po /* board_20619 */ { .sht= &pdc_ata_sht, - .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS, + .flags = PDC_COMMON_FLAGS | ATA_FLAG_SRST | ATA_FLAG_SLAVE_POSS, .pio_mask = 0x1f, /* pio0-4 */ .mwdma_mask = 0x07, /* mwdma0-2 */ .udma_mask = 0x7f, /* udma0-6 ; FIXME */ @@ -367,12 +374,6 @@ static void pdc_reset_port(struct ata_po readl(mmio);/* flush */ } -static void pdc_sata_phy_reset(struct ata_port *ap) -{ - pdc_reset_port(ap); - sata_phy_reset(ap); -} - static void pdc_pata_cbl_detect(struct ata_port *ap) { u8 tmp; @@ -440,6 +441,63 @@ static void pdc_qc_prep(struct ata_queue } } +static void pdc_freeze(struct ata_port *ap) +{ + void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr; + u32 tmp; + + tmp = readl(mmio + PDC_CTLSTAT); + tmp |= PDC_IRQ_DISABLE; + tmp &= ~PDC_DMA_ENABLE; + writel(tmp, mmio + PDC_CTLSTAT); + readl(mmio + PDC_CTLSTAT); /* flush *//* XXX: needed? sata
[PATCH 2.6.19 3/3] sata_promise: cleanups
This patch performs two simple cleanups of sata_promise. * Remove board_20771 and map device id 0x3577 to board_2057x. After the recent corrections for SATAII chips, board_20771 and board_2057x were equivalent in the driver. * Remove hp->hotplug_offset and use hp->flags & PDC_FLAG_GEN_II to compute hotplug_offset in pdc_host_init(). This patch depends on the sata_promise SATAII updates patch I sent recently. Signed-off-by: Mikael Pettersson <[EMAIL PROTECTED]> diff -rupN linux-2.6.19.sata_promise-3-new_EH/drivers/ata/sata_promise.c linux-2.6.19.sata_promise-4-cleanups/drivers/ata/sata_promise.c --- linux-2.6.19.sata_promise-3-new_EH/drivers/ata/sata_promise.c 2006-11-30 23:56:32.0 +0100 +++ linux-2.6.19.sata_promise-4-cleanups/drivers/ata/sata_promise.c 2006-12-01 00:16:09.0 +0100 @@ -67,9 +67,8 @@ enum { board_2037x = 0,/* FastTrak S150 TX2plus */ board_20319 = 1,/* FastTrak S150 TX4 */ board_20619 = 2,/* FastTrak TX4000 */ - board_20771 = 3,/* FastTrak TX2300 */ - board_2057x = 4,/* SATAII150 Tx2plus */ - board_40518 = 5,/* SATAII150 Tx4 */ + board_2057x = 3,/* SATAII150 Tx2plus */ + board_40518 = 4,/* SATAII150 Tx4 */ PDC_HAS_PATA= (1 << 1), /* PDC20375/20575 has PATA */ @@ -94,7 +93,6 @@ struct pdc_port_priv { struct pdc_host_priv { unsigned long flags; - int hotplug_offset; }; static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg); @@ -213,16 +211,6 @@ static const struct ata_port_info pdc_po .port_ops = &pdc_pata_ops, }, - /* board_20771 */ - { - .sht= &pdc_ata_sht, - .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA, - .pio_mask = 0x1f, /* pio0-4 */ - .mwdma_mask = 0x07, /* mwdma0-2 */ - .udma_mask = 0x7f, /* udma0-6 ; FIXME */ - .port_ops = &pdc_sata_ops, - }, - /* board_2057x */ { .sht= &pdc_ata_sht, @@ -252,6 +240,7 @@ static const struct pci_device_id pdc_at { PCI_VDEVICE(PROMISE, 0x3570), board_2057x }, { PCI_VDEVICE(PROMISE, 0x3571), board_2057x }, { PCI_VDEVICE(PROMISE, 0x3574), board_2057x }, + { PCI_VDEVICE(PROMISE, 0x3577), board_2057x }, { PCI_VDEVICE(PROMISE, 0x3d73), board_2057x }, { PCI_VDEVICE(PROMISE, 0x3d75), board_2057x }, @@ -264,15 +253,6 @@ static const struct pci_device_id pdc_at { PCI_VDEVICE(PROMISE, 0x6629), board_20619 }, -/* TODO: remove all associated board_20771 code, as it completely - * duplicates board_2037x code, unless reason for separation can be - * divined. - */ -#if 0 - { PCI_VDEVICE(PROMISE, 0x3570), board_20771 }, -#endif - { PCI_VDEVICE(PROMISE, 0x3577), board_20771 }, - { } /* terminate list */ }; @@ -704,7 +684,7 @@ static void pdc_host_init(unsigned int c { void __iomem *mmio = pe->mmio_base; struct pdc_host_priv *hp = pe->private_data; - int hotplug_offset = hp->hotplug_offset; + int hotplug_offset = (hp->flags & PDC_FLAG_GEN_II) ? PDC2_SATA_PLUG_CSR : PDC_SATA_PLUG_CSR; u32 tmp; /* @@ -801,8 +781,6 @@ static int pdc_ata_init_one (struct pci_ goto err_out_free_ent; } - /* Set default hotplug offset */ - hp->hotplug_offset = PDC_SATA_PLUG_CSR; probe_ent->private_data = hp; probe_ent->sht = pdc_port_info[board_idx].sht; @@ -826,8 +804,6 @@ static int pdc_ata_init_one (struct pci_ switch (board_idx) { case board_40518: hp->flags |= PDC_FLAG_GEN_II; - /* Override hotplug offset for SATAII150 */ - hp->hotplug_offset = PDC2_SATA_PLUG_CSR; /* Fall through */ case board_20319: probe_ent->n_ports = 4; @@ -839,10 +815,7 @@ static int pdc_ata_init_one (struct pci_ probe_ent->port[3].scr_addr = base + 0x700; break; case board_2057x: - case board_20771: hp->flags |= PDC_FLAG_GEN_II; - /* Override hotplug offset for SATAII150 */ - hp->hotplug_offset = PDC2_SATA_PLUG_CSR; /* Fall through */ case board_2037x: probe_ent->n_ports = 2; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH -mm] sata_nv: fix ATAPI in ADMA mode
On Tue, Nov 28, 2006 at 03:39:29AM -0500, Jeff Garzik wrote: >... > In the future, please use "---" not "--" as the separator your .sig, so > that it is not copied into the kernel changelog by git-applymbox. >... "-- " is the standard separator most MUAs can interpret - "---" would therefore be wrong. Perhaps git-applymbox should be fixed? cu Adrian -- "Is there not promise of rain?" Ling Tan asked suddenly out of the darkness. There had been need of rain for many days. "Only a promise," Lao Er said. Pearl S. Buck - Dragon Seed - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.18 - AHCI detection pauses excessively
Tejun Heo wrote: > Berck E. Nash wrote: >> [ 68.242305] ata2: SATA link up 3.0 Gbps (SStatus 123 SControl 300) >> [ 98.221334] ata2.00: qc timeout (cmd 0xec) >> [ 98.225467] ata2.00: failed to IDENTIFY (I/O error, err_mask=0x104) >> [ 108.063137] ata2: port is slow to respond, please be patient (Status 0x80) >> [ 131.003980] ata2: port failed to respond (30 secs, Status 0x80) >> [ 131.009930] ata2: COMRESET failed (device not ready) >> [ 131.014926] ata2: hardreset failed, retrying in 5 secs >> [ 138.308717] ata2: SATA link up 3.0 Gbps (SStatus 123 SControl 300) >> [ 138.319554] ata2.00: ATA-6, max UDMA/133, 640 sectors: LBA >> [ 138.325157] ata2.00: ata2: dev 0 multi count 1 >> [ 138.334245] ata2.00: configured for UDMA/133 > [--snip--] >> [ 143.191590] scsi 2:0:0:0: Direct-Access ATA Config Disk >> RGL1 PQ: 0 ANSI: 5 >> [ 143.199761] SCSI device sdd: 640 512-byte hdwr sectors (0 MB) >> [ 143.205550] sdd: Write Protect is off >> [ 143.209257] SCSI device sdd: write cache: disabled, read cache: enabled, >> doesn't support DPO or FUA >> [ 143.218356] SCSI device sdd: 640 512-byte hdwr sectors (0 MB) >> [ 143.224143] sdd: Write Protect is off >> [ 143.227847] SCSI device sdd: write cache: disabled, read cache: enabled, >> doesn't support DPO or FUA >> [ 143.236927] sdd: unknown partition table >> [ 143.241194] sd 2:0:0:0: Attached scsi disk sdd >> [ 143.245707] sd 2:0:0:0: Attached scsi generic sg3 type 0 > > Ahh.. I can't believe I missed this again. A Port Multiplier is > attached to your ata2 which is probably a sil3726 or 4726. Why this > device fails initial reset is unknown yet. Anyways, with proper PMP > support, this problem will go away. So, this isn't really a ahci issue > and there's nothing wrong with your disks either. I'll ask SIMG why > this happens with the PMP. Hrm. It's not a Silicon Image chip, or at least doesn't claim to be: 00:1f.2 SATA controller: Intel Corporation 82801GR/GH (ICH7 Family) Serial ATA Storage Controller AHCI (rev 01) (prog-if 01 [AHCI 1.0]) Subsystem: ASUSTeK Computer Inc. Unknown device 2606 Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- SERR- http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.18 - AHCI detection pauses excessively
Berck E. Nash wrote: > Hrm. It's not a Silicon Image chip, or at least doesn't claim to be: Yeap, the controller is ich ahci but I'm pretty sure there's a PMP chip connected to one of them. Look for 4723 in the following page. http://www.asus.com/products4.aspx?modelmenu=2&model=1198&l1=3&l2=11&l3=248 > 00:1f.2 SATA controller: Intel Corporation 82801GR/GH (ICH7 Family) > Serial ATA Storage Controller AHCI (rev 01) (prog-if 01 [AHCI 1.0]) > Subsystem: ASUSTeK Computer Inc. Unknown device 2606 > Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- > ParErr- Stepping- SERR- FastB2B- > Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- > SERR- Latency: 0 > Interrupt: pin B routed to IRQ 316 > Region 0: I/O ports at e400 [size=8] > Region 1: I/O ports at e080 [size=4] > Region 2: I/O ports at e000 [size=8] > Region 3: I/O ports at dc00 [size=4] > Region 4: I/O ports at d880 [size=16] > Region 5: Memory at febfb800 (32-bit, non-prefetchable) [size=1K] > Capabilities: [80] Message Signalled Interrupts: Mask- 64bit- > Queue=0/0 Enable+ > Address: fee0300c Data: 4179 > Capabilities: [70] Power Management version 2 > Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA > PME(D0-,D1-,D2-,D3hot+,D3cold-) > Status: D0 PME-Enable- DSel=0 DScale=0 PME- > > And, remember, this behavior started in 2.6.18 and didn't exist in > 2.6.17. Would it help if I narrowed down which patch caused it? Yeah, that's probably because we're now using IRQ-driven PIO for IDENTIFY, so we're often slower at detecting IDENTIFY failure. We're planning to go back to polling IDENTIFY. Anyways, the problem here is that the 4723 is emulating ATA device for configuration but it isn't doing it quite right. I'll ask SIMG about it. -- tejun - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC][PATCH] ensure i_ino uniqueness in filesystems without permanent inode numbers (via idr)
This patch is a proof of concept. It works, but still needs a bit of polish before it's ready for submission. First, the problems: 1) on filesystems w/o permanent inode numbers, i_ino values can be larger than 32 bits, which can cause problems for some 32 bit userspace programs on a 64 bit kernel. 2) many filesystems call new_inode and assume that the i_ino values they are given are unique. They are not guaranteed to be so, since the static counter can wrap. 3) after allocating a new inode, some filesystems call iunique to try to get a unique i_ino value, but they don't actually add their inodes to the hashtable, so they're still not guaranteed to be unique. This patch is a first step at correcting these problems. This adds 2 new functions, an idr_register and idr_unregister. Filesystems can call idr_register at inode creation time, and then at deletion time, we'll automatically unregister them. This patch also adds a new s_generation counter to the superblock. Because i_ino's can be reused so quickly, we don't want NFS getting confused when it happens. When iunique_register is called, we'll assign the s_generation value to the i_generation, and then increment it to help ensure that we get different filehandles. There are some things that need to be cleaned up, of course: - error handling for the idr calls - recheck all the possible places where the inode should be unhashed - don't attempt to remove inodes with values <100 - convert other filesystems - remove the static counter from new_inode and (maybe) eliminate iunique The patch also converts pipefs to use the new scheme as an example. Al Viro had expressed some concern with an earlier patch that this might slow down pipe creation. I've done some testing and I think the impact will be minimal. Timing a small program that creates and closes 100 million pipes in a loop: patched: - real8m8.623s user0m37.418s sys 7m31.196s unpatched: -- real8m7.150s user0m40.943s sys 7m26.204s As the number of pipes grows on the system, this time may grow somewhat but it doesn't seem like it would be terrible. Comments and suggestions appreciated. Signed-off-by: Jeff Layton <[EMAIL PROTECTED]> diff --git a/fs/inode.c b/fs/inode.c index 26cdb11..841e2fc 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -288,6 +288,8 @@ static void dispose_list(struct list_hea list_del_init(&inode->i_sb_list); spin_unlock(&inode_lock); + iunique_unregister(inode); + wake_up_inode(inode); destroy_inode(inode); nr_disposed++; @@ -706,6 +708,34 @@ retry: EXPORT_SYMBOL(iunique); +int iunique_register(struct inode *inode, int max_reserved) +{ + int rv; + + rv = idr_pre_get(&inode->i_sb->s_inode_ids, GFP_KERNEL); + if (! rv) + return -ENOMEM; + + spin_lock(&inode->i_sb->s_inode_ids_lock); + rv = idr_get_new_above(&inode->i_sb->s_inode_ids, inode, + max_reserved+1, (int *) &inode->i_ino); + inode->i_generation = inode->i_sb->s_generation++; + spin_unlock(&inode->i_sb->s_inode_ids_lock); + return rv; +} + +EXPORT_SYMBOL(iunique_register); + +void iunique_unregister(struct inode *inode) +{ + spin_lock(&inode->i_sb->s_inode_ids_lock); + if (idr_find(&inode->i_sb->s_inode_ids, (int) inode->i_ino)) + idr_remove(&inode->i_sb->s_inode_ids, (int) inode->i_ino); + spin_unlock(&inode->i_sb->s_inode_ids_lock); +} + +EXPORT_SYMBOL(iunique_unregister); + struct inode *igrab(struct inode *inode) { spin_lock(&inode_lock); @@ -1025,6 +1055,7 @@ void generic_delete_inode(struct inode * spin_lock(&inode_lock); hlist_del_init(&inode->i_hash); spin_unlock(&inode_lock); + iunique_unregister(inode); wake_up_inode(inode); BUG_ON(inode->i_state != I_CLEAR); destroy_inode(inode); @@ -1057,6 +1088,7 @@ static void generic_forget_inode(struct inode->i_state |= I_FREEING; inodes_stat.nr_inodes--; spin_unlock(&inode_lock); + iunique_unregister(inode); if (inode->i_data.nrpages) truncate_inode_pages(&inode->i_data, 0); clear_inode(inode); diff --git a/fs/pipe.c b/fs/pipe.c index b1626f2..d74ae65 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -845,6 +845,9 @@ static struct inode * get_pipe_inode(voi if (!inode) goto fail_inode; + if (iunique_register(inode, 0)) + goto fail_iput; + pipe = alloc_pipe_info(inode); if (!pipe) goto fail_iput; diff --git a/fs/super.c b/fs/super.c index 47e554c..d2dbdec 100644 --- a/fs/super.c +++ b/fs/super.c @@ -93,6 +93,8 @@ static struct super_block *alloc_super(s s->s_qcop = sb_quotactl_ops; s->s_op = &default_op; s->s_time_gran = 10; + idr_init(&s->s_inode_ids); + spin_lock_init(&s->s_inode_ids_lock); } out: return s; diff --git a/include/linux/fs.h b/include/linux/fs.h index 2fe6e3f..3ad12a6 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -278,6 +278,7 @@ #include #include #include #include +#include #include #include @@ -961,6 +962,12 @@ #endif /* Granularity of c/m/atime in ns. Cannot be worse than a second */