i386: work around miscompilation of alternatives code

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6041b57c6c99dcb59524f1bb0db0628c2689a464
Commit: 6041b57c6c99dcb59524f1bb0db0628c2689a464
Parent: 129a84de2347002f09721cda3155ccfd19fade40
Author: Joerg Roedel [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:14 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:32 2007 -0700

i386: work around miscompilation of alternatives code

A recent change makes my Dell 1501 hang on boot.  It's an AMD MK-36.  I use
an x86_64 kernel.  It is 100% reproducible.

I debugged this problem a bit and my compiler[1]interprets the =A constraint
as %rax instead of %edx:%eax on x86_64 which causes the problem.  The 
appended
patch provides a workaround for this and fixed the hang on my machine.

[1] gcc version 4.1.3 20070429 (prerelease) (Debian 4.1.2-5)

Signed-off-by: Joerg Roedel [EMAIL PROTECTED]
Cc: Andi Kleen [EMAIL PROTECTED]
Cc: Benny Halevy [EMAIL PROTECTED]
Cc: Pete Zaitcev [EMAIL PROTECTED]
Cc: Joerg Roedel [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 include/asm-i386/alternative.h   |6 ++
 include/asm-i386/tsc.h   |6 --
 include/asm-x86_64/alternative.h |6 ++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/include/asm-i386/alternative.h b/include/asm-i386/alternative.h
index 0f70b37..eb7da54 100644
--- a/include/asm-i386/alternative.h
+++ b/include/asm-i386/alternative.h
@@ -98,6 +98,12 @@ static inline void alternatives_smp_switch(int smp) {}
  .previous : output : [feat] i (feature), ##input)
 
 /*
+ * use this macro(s) if you need more than one output parameter
+ * in alternative_io
+ */
+#define ASM_OUTPUT2(a, b) a, b
+
+/*
  * Alternative inline assembly for SMP.
  *
  * The LOCK_PREFIX macro defined here replaces the LOCK and
diff --git a/include/asm-i386/tsc.h b/include/asm-i386/tsc.h
index 3f3c1fa..62c091f 100644
--- a/include/asm-i386/tsc.h
+++ b/include/asm-i386/tsc.h
@@ -35,14 +35,16 @@ static inline cycles_t get_cycles(void)
 static __always_inline cycles_t get_cycles_sync(void)
 {
unsigned long long ret;
-   unsigned eax;
+   unsigned eax, edx;
 
/*
 * Use RDTSCP if possible; it is guaranteed to be synchronous
 * and doesn't cause a VMEXIT on Hypervisors
 */
alternative_io(ASM_NOP3, .byte 0x0f,0x01,0xf9, X86_FEATURE_RDTSCP,
-=A (ret), 0 (0ULL) : ecx, memory);
+  ASM_OUTPUT2(=a (eax), =d (edx)),
+  a (0U), d (0U) : ecx, memory);
+   ret = (((unsigned long long)edx)  32) | ((unsigned long long)eax);
if (ret)
return ret;
 
diff --git a/include/asm-x86_64/alternative.h b/include/asm-x86_64/alternative.h
index a09fe85..a094276 100644
--- a/include/asm-x86_64/alternative.h
+++ b/include/asm-x86_64/alternative.h
@@ -103,6 +103,12 @@ static inline void alternatives_smp_switch(int smp) {}
  .previous : output : [feat] i (feature), ##input)
 
 /*
+ * use this macro(s) if you need more than one output parameter
+ * in alternative_io
+ */
+#define ASM_OUTPUT2(a, b) a, b
+
+/*
  * Alternative inline assembly for SMP.
  *
  * The LOCK_PREFIX macro defined here replaces the LOCK and
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86_64: display more intuitive error message if kernel is not 2MB aligned

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=069f11f9d66bc582fb40a37a7b92363f5d321969
Commit: 069f11f9d66bc582fb40a37a7b92363f5d321969
Parent: 6041b57c6c99dcb59524f1bb0db0628c2689a464
Author: Vivek Goyal [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:15 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:32 2007 -0700

x86_64: display more intuitive error message if kernel is not 2MB aligned

o x86_64 kernel needs to be compiled for 2MB aligned addresses. Currently
  we are using BUILD_BUG_ON() to warn the user if he has not done so. But
  looks like folks are not finding message very intutive and don't open
  the respective c file to find problem source. (Bug 8439)

arch/x86_64/kernel/head64.c: In function 'x86_64_start_kernel':
arch/x86_64/kernel/head64.c:70: error: size of array 'type name' is negative

o Using preprocessor directive #error to print a better message if
  CONFIG_PHYSICAL_START is not aligned to 2MB boundary.

Signed-off-by: Vivek Goyal [EMAIL PROTECTED]
Cc: Andi Kleen [EMAIL PROTECTED]
Cc: Eric W. Biederman [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/x86_64/kernel/head64.c |7 ---
 include/asm-x86_64/page.h   |9 +
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/arch/x86_64/kernel/head64.c b/arch/x86_64/kernel/head64.c
index 213d90e..6c34bdd 100644
--- a/arch/x86_64/kernel/head64.c
+++ b/arch/x86_64/kernel/head64.c
@@ -62,13 +62,6 @@ void __init x86_64_start_kernel(char * real_mode_data)
 {
int i;
 
-   /*
-* Make sure kernel is aligned to 2MB address. Catching it at compile
-* time is better. Change your config file and compile the kernel
-* for a 2MB aligned address (CONFIG_PHYSICAL_START)
-*/
-   BUILD_BUG_ON(CONFIG_PHYSICAL_START  (__KERNEL_ALIGN - 1));
-
/* clear bss before set_intr_gate with early_idt_handler */
clear_bss();
 
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h
index dee632f..e327c83 100644
--- a/include/asm-x86_64/page.h
+++ b/include/asm-x86_64/page.h
@@ -80,6 +80,15 @@ extern unsigned long phys_base;
 #define __PHYSICAL_START   CONFIG_PHYSICAL_START
 #define __KERNEL_ALIGN 0x20
 
+/*
+ * Make sure kernel is aligned to 2MB address. Catching it at compile
+ * time is better. Change your config file and compile the kernel
+ * for a 2MB aligned address (CONFIG_PHYSICAL_START)
+ */
+#if (CONFIG_PHYSICAL_START % __KERNEL_ALIGN) != 0
+#error CONFIG_PHYSICAL_START must be a multiple of 2MB
+#endif
+
 #define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START)
 #define __START_KERNEL_map _AC(0x8000, UL)
 #define __PAGE_OFFSET   _AC(0x8100, UL)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Bug in mm/thrash.c function grab_swap_token()

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7faaa5f0bf4db6ac4908038e2139adc46c165ff4
Commit: 7faaa5f0bf4db6ac4908038e2139adc46c165ff4
Parent: 069f11f9d66bc582fb40a37a7b92363f5d321969
Author: Mika Kukkonen [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:17 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:32 2007 -0700

Bug in mm/thrash.c function grab_swap_token()

Following bug was uncovered by compiling with '-W' flag:

  CC  mm/thrash.o
mm/thrash.c: In function ‘grab_swap_token’:
mm/thrash.c:52: warning: comparison of unsigned expression  0 is always 
false

Variable token_priority is unsigned, so decrementing first and then
checking the result does not work; fixed by reversing the test, patch
attached (compile tested only).

I am not sure if likely() makes much sense in this new situation, but
I'll let somebody else to make a decision on that.

Signed-off-by: Mika Kukkonen [EMAIL PROTECTED]
Cc: Rik van Riel [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 mm/thrash.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/mm/thrash.c b/mm/thrash.c
index 9ef9071..c4c5205 100644
--- a/mm/thrash.c
+++ b/mm/thrash.c
@@ -48,9 +48,8 @@ void grab_swap_token(void)
if (current_interval  current-mm-last_interval)
current-mm-token_priority++;
else {
-   current-mm-token_priority--;
-   if (unlikely(current-mm-token_priority  0))
-   current-mm-token_priority = 0;
+   if (likely(current-mm-token_priority  0))
+   current-mm-token_priority--;
}
/* Check if we deserve the token */
if (current-mm-token_priority 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Documentation/gpio.txt mentions GENERIC_GPIO

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=32993b793fb07784fd1380004f5b34f31f9105d5
Commit: 32993b793fb07784fd1380004f5b34f31f9105d5
Parent: 7faaa5f0bf4db6ac4908038e2139adc46c165ff4
Author: David Brownell [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:17 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:32 2007 -0700

Documentation/gpio.txt mentions GENERIC_GPIO

Documentation/gpio.txt should mention the Kconfig GENERIC_GPIO flag, for
platforms to declare when relevant.  This should help minimize goofs like
omitting it, or not depending on it when needed.

Signed-off-by: David Brownell [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 Documentation/gpio.txt |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt
index f8528db..e8be0ab 100644
--- a/Documentation/gpio.txt
+++ b/Documentation/gpio.txt
@@ -66,7 +66,9 @@ registers; another might implement it by delegating through 
abstractions
 used for several very different kinds of GPIO controller.
 
 That said, if the convention is supported on their platform, drivers should
-use it when possible:
+use it when possible.  Platforms should declare GENERIC_GPIO support in
+Kconfig (boolean true), which multi-platform drivers can depend on when
+using the include file:
 
#include asm/gpio.h
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


x86_64: new syscall

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9393e1dc8e394bd59217178b26b2476dc43e8667
Commit: 9393e1dc8e394bd59217178b26b2476dc43e8667
Parent: 32993b793fb07784fd1380004f5b34f31f9105d5
Author: Andi Kleen [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:18 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:32 2007 -0700

x86_64: new syscall

Add epoll_pwait()

(akpm: stolen from Andi's queue, because I want to send the signalfd patches
which also add syscalls.  Not sure what the __IGNORE_getcpu is for).

Signed-off-by: Andi Kleen [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 include/asm-x86_64/unistd.h |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
index 5957039..18a0b01 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -621,6 +621,9 @@ __SYSCALL(__NR_vmsplice, sys_vmsplice)
 __SYSCALL(__NR_move_pages, sys_move_pages)
 #define __NR_utimensat 280
 __SYSCALL(__NR_utimensat, sys_utimensat)
+#define __IGNORE_getcpu/* implemented as a vsyscall */
+#define __NR_epoll_pwait   281
+__SYSCALL(__NR_epoll_pwait, sys_epoll_pwait)
 
 #ifndef __NO_STUBS
 #define __ARCH_WANT_OLD_READDIR
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


AFS: fix a couple of problems with unlinking AFS files

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0f300ca9284caabdd2c07c7f91b90f1f530f614e
Commit: 0f300ca9284caabdd2c07c7f91b90f1f530f614e
Parent: 9d577b6a31a53a19d3b0fe414d645a61ef201846
Author: David Howells [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:20 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:32 2007 -0700

AFS: fix a couple of problems with unlinking AFS files

Fix a couple of problems with unlinking AFS files.

 (1) The parent directory wasn't being updated properly between unlink() and
 the following lookup().

 It seems that, for some reason, invalidate_remote_inode() wasn't
 discarding the directory contents correctly, so this patch calls
 invalidate_inode_pages2() instead on non-regular files.

 (2) afs_vnode_deleted_remotely() should handle vnodes that don't have a
 source server recorded without oopsing.

Signed-off-by: David Howells [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 fs/afs/file.c  |2 +-
 fs/afs/inode.c |   10 +++---
 fs/afs/super.c |3 ++-
 fs/afs/vnode.c |   33 +
 4 files changed, 31 insertions(+), 17 deletions(-)

diff --git a/fs/afs/file.c b/fs/afs/file.c
index 3e25795..9c0e721 100644
--- a/fs/afs/file.c
+++ b/fs/afs/file.c
@@ -236,7 +236,7 @@ static void afs_invalidatepage(struct page *page, unsigned 
long offset)
 {
int ret = 1;
 
-   kenter({%lu},%lu, page-index, offset);
+   _enter({%lu},%lu, page-index, offset);
 
BUG_ON(!PageLocked(page));
 
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 515a5d1..47f5fed 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -209,11 +209,15 @@ bad_inode:
  */
 void afs_zap_data(struct afs_vnode *vnode)
 {
-   _enter(zap data {%x:%u}, vnode-fid.vid, vnode-fid.vnode);
+   _enter({%x:%u}, vnode-fid.vid, vnode-fid.vnode);
 
/* nuke all the non-dirty pages that aren't locked, mapped or being
-* written back */
-   invalidate_remote_inode(vnode-vfs_inode);
+* written back in a regular file and completely discard the pages in a
+* directory or symlink */
+   if (S_ISREG(vnode-vfs_inode.i_mode))
+   invalidate_remote_inode(vnode-vfs_inode);
+   else
+   invalidate_inode_pages2(vnode-vfs_inode.i_mapping);
 }
 
 /*
diff --git a/fs/afs/super.c b/fs/afs/super.c
index d24be33..422f532 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -488,6 +488,7 @@ static struct inode *afs_alloc_inode(struct super_block *sb)
vnode-flags= 1  AFS_VNODE_UNSET;
vnode-cb_promised  = false;
 
+   _leave( = %p, vnode-vfs_inode);
return vnode-vfs_inode;
 }
 
@@ -498,7 +499,7 @@ static void afs_destroy_inode(struct inode *inode)
 {
struct afs_vnode *vnode = AFS_FS_I(inode);
 
-   _enter({%lu}, inode-i_ino);
+   _enter(%p{%x:%u}, inode, vnode-fid.vid, vnode-fid.vnode);
 
_debug(DESTROY INODE %p, inode);
 
diff --git a/fs/afs/vnode.c b/fs/afs/vnode.c
index ec81466..bea8bd9 100644
--- a/fs/afs/vnode.c
+++ b/fs/afs/vnode.c
@@ -175,24 +175,33 @@ static void afs_vnode_deleted_remotely(struct afs_vnode 
*vnode)
 {
struct afs_server *server;
 
+   _enter({%p}, vnode-server);
+
set_bit(AFS_VNODE_DELETED, vnode-flags);
 
server = vnode-server;
-   if (vnode-cb_promised) {
-   spin_lock(server-cb_lock);
+   if (server) {
if (vnode-cb_promised) {
-   rb_erase(vnode-cb_promise, server-cb_promises);
-   vnode-cb_promised = false;
+   spin_lock(server-cb_lock);
+   if (vnode-cb_promised) {
+   rb_erase(vnode-cb_promise,
+server-cb_promises);
+   vnode-cb_promised = false;
+   }
+   spin_unlock(server-cb_lock);
}
-   spin_unlock(server-cb_lock);
-   }
 
-   spin_lock(vnode-server-fs_lock);
-   rb_erase(vnode-server_rb, vnode-server-fs_vnodes);
-   spin_unlock(vnode-server-fs_lock);
+   spin_lock(server-fs_lock);
+   rb_erase(vnode-server_rb, server-fs_vnodes);
+   spin_unlock(server-fs_lock);
 
-   vnode-server = NULL;
-   afs_put_server(server);
+   vnode-server = NULL;
+   afs_put_server(server);
+   } else {
+   ASSERT(!vnode-cb_promised);
+   }
+
+   _leave();
 }
 
 /*
@@ -225,7 +234,7 @@ void afs_vnode_finalise_status_update(struct afs_vnode 
*vnode,
  */
 static void afs_vnode_status_update_failed(struct afs_vnode *vnode, int ret)
 {
-   _enter(%p,%d, vnode, ret);
+   _enter({%x:%u},%d, vnode-fid.vid, 

AFS: implement statfs

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=45222b9e02fb282eb0a8007a3d992dd229ec2410
Commit: 45222b9e02fb282eb0a8007a3d992dd229ec2410
Parent: 0f300ca9284caabdd2c07c7f91b90f1f530f614e
Author: David Howells [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:20 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:32 2007 -0700

AFS: implement statfs

Implement the statfs() op for AFS.

Signed-off-by: David Howells [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 fs/afs/afs.h  |   23 
 fs/afs/afs_fs.h   |3 +-
 fs/afs/dir.c  |   18 ++--
 fs/afs/fsclient.c |  298 +
 fs/afs/internal.h |6 +
 fs/afs/super.c|   41 +++-
 fs/afs/vnode.c|   52 +
 7 files changed, 426 insertions(+), 15 deletions(-)

diff --git a/fs/afs/afs.h b/fs/afs/afs.h
index 52d0752..2452579 100644
--- a/fs/afs/afs.h
+++ b/fs/afs/afs.h
@@ -16,6 +16,9 @@
 
 #define AFS_MAXCELLNAME64  /* maximum length of a cell 
name */
 #define AFS_MAXVOLNAME 64  /* maximum length of a volume name */
+#define AFSNAMEMAX 256 /* maximum length of a filename plus 
NUL */
+#define AFSPATHMAX 1024/* maximum length of a pathname plus 
NUL */
+#define AFSOPAQUEMAX   1024/* maximum length of an opaque field */
 
 typedef unsigned   afs_volid_t;
 typedef unsigned   afs_vnodeid_t;
@@ -143,4 +146,24 @@ struct afs_volsync {
time_t  creation;   /* volume creation time */
 };
 
+/*
+ * AFS volume status record
+ */
+struct afs_volume_status {
+   u32 vid;/* volume ID */
+   u32 parent_id;  /* parent volume ID */
+   u8  online; /* true if volume currently 
online and available */
+   u8  in_service; /* true if volume currently in 
service */
+   u8  blessed;/* same as in_service */
+   u8  needs_salvage;  /* true if consistency checking 
required */
+   u32 type;   /* volume type (afs_voltype_t) 
*/
+   u32 min_quota;  /* minimum space set aside 
(blocks) */
+   u32 max_quota;  /* maximum space this volume 
may occupy (blocks) */
+   u32 blocks_in_use;  /* space this volume currently 
occupies (blocks) */
+   u32 part_blocks_avail; /* space available in 
volume's partition */
+   u32 part_max_blocks; /* size of volume's partition 
*/
+};
+
+#define AFS_BLOCK_SIZE 1024
+
 #endif /* AFS_H */
diff --git a/fs/afs/afs_fs.h b/fs/afs/afs_fs.h
index d963ef4..a18c374 100644
--- a/fs/afs/afs_fs.h
+++ b/fs/afs/afs_fs.h
@@ -28,7 +28,8 @@ enum AFS_FS_Operations {
FSMAKEDIR   = 141,  /* AFS Create a directory */
FSREMOVEDIR = 142,  /* AFS Remove a directory */
FSGIVEUPCALLBACKS   = 147,  /* AFS Discard callback promises */
-   FSGETVOLUMEINFO = 148,  /* AFS Get root volume information */
+   FSGETVOLUMEINFO = 148,  /* AFS Get information about a volume */
+   FSGETVOLUMESTATUS   = 149,  /* AFS Get volume status information */
FSGETROOTVOLUME = 151,  /* AFS Get root volume name */
FSLOOKUP= 161,  /* AFS lookup file in directory */
FSFETCHDATA64   = 65537, /* AFS Fetch file data */
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index 2fb3127..719af4f 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -497,7 +497,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct 
dentry *dentry,
 
ASSERTCMP(dentry-d_inode, ==, NULL);
 
-   if (dentry-d_name.len  255) {
+   if (dentry-d_name.len = AFSNAMEMAX) {
_leave( = -ENAMETOOLONG);
return ERR_PTR(-ENAMETOOLONG);
}
@@ -736,7 +736,7 @@ static int afs_mkdir(struct inode *dir, struct dentry 
*dentry, int mode)
   dvnode-fid.vid, dvnode-fid.vnode, dentry-d_name.name, mode);
 
ret = -ENAMETOOLONG;
-   if (dentry-d_name.len  255)
+   if (dentry-d_name.len = AFSNAMEMAX)
goto error;
 
key = afs_request_key(dvnode-volume-cell);
@@ -801,7 +801,7 @@ static int afs_rmdir(struct inode *dir, struct dentry 
*dentry)
   dvnode-fid.vid, dvnode-fid.vnode, dentry-d_name.name);
 
ret = -ENAMETOOLONG;
-   if (dentry-d_name.len  255)
+   if (dentry-d_name.len = AFSNAMEMAX)
goto error;
 
key = afs_request_key(dvnode-volume-cell);
@@ -847,7 +847,7 @@ static int afs_unlink(struct inode *dir, struct dentry 
*dentry)
   

VM statistics: Make timer deferrable

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=39bf6270f524bbe2682b56f2a979703abf937dd1
Commit: 39bf6270f524bbe2682b56f2a979703abf937dd1
Parent: 45222b9e02fb282eb0a8007a3d992dd229ec2410
Author: Christoph Lameter [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:21 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:32 2007 -0700

VM statistics: Make timer deferrable

VM statistics updates do not matter if the kernel is in idle powersaving
mode.  So allow the timer to be deferred.

It would be better though if we could switch the timer between deferrable
and nondeferrable based on differentials present.  The timer would start
out nondeferrable and if we find that there were no updates in the last
statistics interval then we would switch the timer to deferrable.  If the
timer later finds again that there are differentials then go to
nondeferrable again.

And yet another way would be to run the timer shortly before going to idle?

The solution here means that the VM counters may be slightly off during
idle since differentials may be still pending while the timer is deferred.

Signed-off-by: Christoph Lameter [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 mm/vmstat.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index 9832d9a..8faf27e 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -698,7 +698,7 @@ static void __devinit start_cpu_timer(int cpu)
 {
struct delayed_work *vmstat_work = per_cpu(vmstat_work, cpu);
 
-   INIT_DELAYED_WORK(vmstat_work, vmstat_update);
+   INIT_DELAYED_WORK_DEFERRABLE(vmstat_work, vmstat_update);
schedule_delayed_work_on(cpu, vmstat_work, HZ + cpu);
 }
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


frv: gdb: use __maybe_unused

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0a9d6e7cb0d1e5acc61d481d7a1ea25c294c3dff
Commit: 0a9d6e7cb0d1e5acc61d481d7a1ea25c294c3dff
Parent: 39bf6270f524bbe2682b56f2a979703abf937dd1
Author: David Rientjes [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:22 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:33 2007 -0700

frv: gdb: use __maybe_unused

Replace function instances of __attribute__((unused)) with
__maybe_unused to suppress warnings.

Cc: David Howells [EMAIL PROTECTED]
Signed-off-by: David Rientjes [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/frv/kernel/gdb-stub.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/frv/kernel/gdb-stub.c b/arch/frv/kernel/gdb-stub.c
index 9550f37..1e7a101 100644
--- a/arch/frv/kernel/gdb-stub.c
+++ b/arch/frv/kernel/gdb-stub.c
@@ -1195,7 +1195,7 @@ static void gdbstub_check_breakpoint(void)
 /*
  *
  */
-static void __attribute__((unused)) gdbstub_show_regs(void)
+static void __maybe_unused gdbstub_show_regs(void)
 {
unsigned long *reg;
int loop;
@@ -1223,7 +1223,7 @@ static void __attribute__((unused)) 
gdbstub_show_regs(void)
 /*
  * dump debugging regs
  */
-static void __attribute__((unused)) gdbstub_dump_debugregs(void)
+static void __maybe_unused gdbstub_dump_debugregs(void)
 {
gdbstub_printk(DCR%08lx  , __debug_status.dcr);
gdbstub_printk(BRR%08lx\n, __debug_status.brr);
@@ -2079,25 +2079,25 @@ void gdbstub_exit(int status)
  * GDB wants to call malloc() and free() to allocate memory for calling kernel
  * functions directly from its command line
  */
-static void *malloc(size_t size) __attribute__((unused));
+static void *malloc(size_t size) __maybe_unused;
 static void *malloc(size_t size)
 {
return kmalloc(size, GFP_ATOMIC);
 }
 
-static void free(void *p) __attribute__((unused));
+static void free(void *p) __maybe_unused;
 static void free(void *p)
 {
kfree(p);
 }
 
-static uint32_t ___get_HSR0(void) __attribute__((unused));
+static uint32_t ___get_HSR0(void) __maybe_unused;
 static uint32_t ___get_HSR0(void)
 {
return __get_HSR(0);
 }
 
-static uint32_t ___set_HSR0(uint32_t x) __attribute__((unused));
+static uint32_t ___set_HSR0(uint32_t x) __maybe_unused;
 static uint32_t ___set_HSR0(uint32_t x)
 {
__set_HSR(0, x);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


h8300 syscall update

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=44316634460a6b368ad3160da6cba3b4725a1433
Commit: 44316634460a6b368ad3160da6cba3b4725a1433
Parent: 0a9d6e7cb0d1e5acc61d481d7a1ea25c294c3dff
Author: Yoshinori Sato [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:23 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:33 2007 -0700

h8300 syscall update

h8300 systemcall entry table update.

Signed-off-by: Yoshinori Sato [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/h8300/kernel/syscalls.S |   78 --
 include/asm-h8300/unistd.h   |   66 +++
 2 files changed, 102 insertions(+), 42 deletions(-)

diff --git a/arch/h8300/kernel/syscalls.S b/arch/h8300/kernel/syscalls.S
index dab98fd..54e21c3 100644
--- a/arch/h8300/kernel/syscalls.S
+++ b/arch/h8300/kernel/syscalls.S
@@ -31,7 +31,7 @@ SYMBOL_NAME_LABEL(sys_call_table)
.long SYMBOL_NAME(sys_mknod)
.long SYMBOL_NAME(sys_chmod)/* 15 */
.long SYMBOL_NAME(sys_chown16)
-   .long SYMBOL_NAME(sys_ni_syscall)   /* old 
break syscall holder */
+   .long SYMBOL_NAME(sys_ni_syscall)   /* old break syscall holder */
.long SYMBOL_NAME(sys_stat)
.long SYMBOL_NAME(sys_lseek)
.long SYMBOL_NAME(sys_getpid)   /* 20 */
@@ -45,11 +45,11 @@ SYMBOL_NAME_LABEL(sys_call_table)
.long SYMBOL_NAME(sys_fstat)
.long SYMBOL_NAME(sys_pause)
.long SYMBOL_NAME(sys_utime)/* 30 */
-   .long SYMBOL_NAME(sys_ni_syscall)   /* old 
stty syscall holder */
-   .long SYMBOL_NAME(sys_ni_syscall)   /* old 
gtty syscall holder */
+   .long SYMBOL_NAME(sys_ni_syscall)   /* old stty syscall holder */
+   .long SYMBOL_NAME(sys_ni_syscall)   /* old gtty syscall holder */
.long SYMBOL_NAME(sys_access)
.long SYMBOL_NAME(sys_nice)
-   .long SYMBOL_NAME(sys_ni_syscall)   /* 35 *//* old 
ftime syscall holder */
+   .long SYMBOL_NAME(sys_ni_syscall)   /* 35 old ftime syscall holder 
*/
.long SYMBOL_NAME(sys_sync)
.long SYMBOL_NAME(sys_kill)
.long SYMBOL_NAME(sys_rename)
@@ -58,7 +58,7 @@ SYMBOL_NAME_LABEL(sys_call_table)
.long SYMBOL_NAME(sys_dup)
.long SYMBOL_NAME(sys_pipe)
.long SYMBOL_NAME(sys_times)
-   .long SYMBOL_NAME(sys_ni_syscall)   /* old 
prof syscall holder */
+   .long SYMBOL_NAME(sys_ni_syscall)   /* old prof syscall holder */
.long SYMBOL_NAME(sys_brk)  /* 45 */
.long SYMBOL_NAME(sys_setgid16)
.long SYMBOL_NAME(sys_getgid16)
@@ -66,13 +66,13 @@ SYMBOL_NAME_LABEL(sys_call_table)
.long SYMBOL_NAME(sys_geteuid16)
.long SYMBOL_NAME(sys_getegid16)/* 50 */
.long SYMBOL_NAME(sys_acct)
-   .long SYMBOL_NAME(sys_umount)   /* 
recycled never used phys() */
-   .long SYMBOL_NAME(sys_ni_syscall)   /* old 
lock syscall holder */
+   .long SYMBOL_NAME(sys_umount)   /* recycled never used phys() */
+   .long SYMBOL_NAME(sys_ni_syscall)   /* old lock syscall holder */
.long SYMBOL_NAME(sys_ioctl)
.long SYMBOL_NAME(sys_fcntl)/* 55 */
-   .long SYMBOL_NAME(sys_ni_syscall)   /* old 
mpx syscall holder */
+   .long SYMBOL_NAME(sys_ni_syscall)   /* old mpx syscall holder */
.long SYMBOL_NAME(sys_setpgid)
-   .long SYMBOL_NAME(sys_ni_syscall)   /* old 
ulimit syscall holder */
+   .long SYMBOL_NAME(sys_ni_syscall)   /* old ulimit syscall holder */
.long SYMBOL_NAME(sys_ni_syscall)
.long SYMBOL_NAME(sys_umask)/* 60 */
.long SYMBOL_NAME(sys_chroot)
@@ -112,7 +112,7 @@ SYMBOL_NAME_LABEL(sys_call_table)
.long SYMBOL_NAME(sys_fchown16) /* 95 */
.long SYMBOL_NAME(sys_getpriority)
.long SYMBOL_NAME(sys_setpriority)
-   .long SYMBOL_NAME(sys_ni_syscall)   /* old 
profil syscall holder */
+   .long SYMBOL_NAME(sys_ni_syscall)   /* old profil syscall holder */
.long SYMBOL_NAME(sys_statfs)
.long SYMBOL_NAME(sys_fstatfs)  /* 100 */
.long SYMBOL_NAME(sys_ni_syscall)   /* ioperm for i386 */
@@ -202,8 +202,8 @@ SYMBOL_NAME_LABEL(sys_call_table)
.long SYMBOL_NAME(sys_capset)   /* 185 */
.long SYMBOL_NAME(sys_sigaltstack)
.long SYMBOL_NAME(sys_sendfile)
-   .long SYMBOL_NAME(sys_ni_syscall)   /* streams1 */
-   .long SYMBOL_NAME(sys_ni_syscall)   /* streams2 

m32r: fix switch_to macro to push/pop frame pointer if needed

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=43c09ce7927912c7867617cba0a265beea38a154
Commit: 43c09ce7927912c7867617cba0a265beea38a154
Parent: 44316634460a6b368ad3160da6cba3b4725a1433
Author: Hirokazu Takata [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:25 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:33 2007 -0700

m32r: fix switch_to macro to push/pop frame pointer if needed

This patch fixes a rarely-happened but severe scheduling problem of
the recent m32r kernel of 2.6.17-rc3 or later.

In the following previous m32r patch, the switch_to macro was
modified not to do unnecessary push/pop operations for tuning.
 [PATCH] m32r: update switch_to macro for tuning
 4127272c38619c56f0c1aa01d01c7bd757db70a1

In this modification, only 'lr' and 'sp' registers are push/pop'ed,
assuming that the m32r kernel is always compiled with
-fomit-frame-pointer option.

However, in 2.6 kernel, kernel/sched.c is irregularly compiled
with -fno-omit-frame-pointer if CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER
is not defined.

 -- kernel/Makefile --
   :
 ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y)
 # According to Alan Modra [EMAIL PROTECTED], the -fno-omit-frame-pointer 
is
 # needed for x86 only.  Why this used to be enabled for all architectures 
is beyond
 # me.  I suspect most platforms don't need this, but until we know that 
for sure
 # I turn this off for IA-64 only.  Andreas Schwab says it's also needed on 
m68k
 # to get a correct value for the wait-channel (WCHAN in ps). --davidm
 CFLAGS_sched.o := $(PROFILING) -fno-omit-frame-pointer
 endif
   :
 ---

Therefore, for the recent m32r kernel, we have to push/pop 'fp'
(frame pointer) if CONFIG_FRAME_POINTER is defined or
CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER is not defined.

Signed-off-by: Hitoshi Yamamoto [EMAIL PROTECTED]
Signed-off-by: Hirokazu Takata [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/m32r/Kconfig |4 
 include/asm-m32r/system.h |   11 +++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index 9740d6b..c3bb8a7 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -241,6 +241,10 @@ config GENERIC_CALIBRATE_DELAY
bool
default y
 
+config SCHED_NO_NO_OMIT_FRAME_POINTER
+bool
+default y
+
 config PREEMPT
bool Preemptible Kernel
help
diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h
index f62f5c9..b291b2f 100644
--- a/include/asm-m32r/system.h
+++ b/include/asm-m32r/system.h
@@ -21,12 +21,22 @@
  * `next' and `prev' should be struct task_struct, but it isn't always defined
  */
 
+#if defined(CONFIG_FRAME_POINTER) || \
+   !defined(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER)
+#define M32R_PUSH_FP  push fp\n
+#define M32R_POP_FP   pop  fp\n
+#else
+#define M32R_PUSH_FP 
+#define M32R_POP_FP  
+#endif
+
 #define switch_to(prev, next, last)  do { \
__asm__ __volatile__ ( \
   sethlr, #high(1f)   \n \
   or3 lr, lr, #low(1f)\n \
   st  lr, @%4  ; store old LR \n \
   ld  lr, @%5  ; load new LR  \n \
+   M32R_PUSH_FP \
   st  sp, @%2  ; store old SP \n \
   ld  sp, @%3  ; load new SP  \n \
   push%1  ; store `prev' on new stack \n \
@@ -34,6 +44,7 @@
   .fillinsn   \n \
1: \n \
   pop %0  ; restore `__last' from new stack   \n \
+   M32R_POP_FP \
: =r (last) \
: 0 (prev), \
  r ((prev-thread.sp)), r ((next-thread.sp)), \
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


m32r: fix tme_handler to check _PAGE_PRESENT bit

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0d4f64681695b0e389f7121eb647b27c602990bc
Commit: 0d4f64681695b0e389f7121eb647b27c602990bc
Parent: 43c09ce7927912c7867617cba0a265beea38a154
Author: Hirokazu Takata [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:26 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:33 2007 -0700

m32r: fix tme_handler to check _PAGE_PRESENT bit

Fix the tlb-miss handler (tme_handler) to check _PAGE_PRESENT bit
in order to handle file-mapped or swapped-out pages correctly.

This patch is required to fix unexpected page errors for m32r.

Signed-off-by: Hitoshi Yamamoto [EMAIL PROTECTED]
Signed-off-by: Hirokazu Takata [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/m32r/mm/mmu.S |   22 +-
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/arch/m32r/mm/mmu.S b/arch/m32r/mm/mmu.S
index 8bb74b1..49a6d16 100644
--- a/arch/m32r/mm/mmu.S
+++ b/arch/m32r/mm/mmu.S
@@ -163,7 +163,8 @@ ENTRY(tme_handler)
 
; pte_data = (unsigned long)pte_val(*pte);
ld  r2, @r3 ; r2: pte data
-   or3 r2, r2, #2  ; _PAGE_PRESENT(=2)
+   and3r3, r2, #2  ; _PAGE_PRESENT(=2) check
+   beqzr3, 3f
 
.fillinsn
 5:
@@ -264,11 +265,8 @@ ENTRY(tme_handler)
 ;
and3r1, r1, #0xeff
ldi r4, #611; _KERNPG_TABLE(=611)
-   beq r1, r4, 4f  ; !pmd_bad(*pmd) ?
-   .fillinsn
-3:
-   ldi r1, #0  ; r1: pte_data = 0
-   bra 5f
+   bne r1, r4, 3f  ; !pmd_bad(*pmd) ?
+
.fillinsn
 4:
; pte = pte_offset(pmd, address);
@@ -282,8 +280,10 @@ ENTRY(tme_handler)
add r4, r3  ; r4: pte
; pte_data = (unsigned long)pte_val(*pte);
ld  r1, @r4 ; r1: pte_data
-   .fillinsn
+   and3r3, r1, #2  ; _PAGE_PRESENT(=2) check
+   beqzr3, 3f
 
+   .fillinsn
 ;; set tlb
 ; r0: address, r1: pte_data, r2: entry
 ; r3,r4: (free)
@@ -295,8 +295,7 @@ ENTRY(tme_handler)
and3r4, r4, #(MMU_CONTEXT_ASID_MASK)
or  r3, r4
st  r3, @r2
-   or3 r4, r1, #2  ; _PAGE_PRESENT(=2)
-   st  r4, @(4,r2) ; set_tlb_data(entry, pte_data);
+   st  r1, @(4,r2) ; set_tlb_data(entry, pte_data);
 
ld  r4, @sp+
ld  r3, @sp+
@@ -306,6 +305,11 @@ ENTRY(tme_handler)
ld  sp, @sp+
rte
 
+   .fillinsn
+3:
+   ldi r1, #2  ; r1: pte_data = 0 | _PAGE_PRESENT(=2)
+   bra 5b
+
 #else
 #error unknown isa configuration
 #endif
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


m32r: fix pte_to_pgoff(), pgoff_to_pte() and __swp_type() macros

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=23c9bbbac57ae50dceadfda37b49785ec04dd42f
Commit: 23c9bbbac57ae50dceadfda37b49785ec04dd42f
Parent: 0d4f64681695b0e389f7121eb647b27c602990bc
Author: Hirokazu Takata [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:28 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:33 2007 -0700

m32r: fix pte_to_pgoff(), pgoff_to_pte() and __swp_type() macros

This patch is required to handle file-mapped or swapped-out pages
correctly.

- Fix pte_to_pgoff() and pgoff_to_pte() macros not to include
  _PAGE_PROTNONE bit of PTE.
  Mask value for { ACCESSED, N, (R, W, X), L, G } is not 0xef but 0x7f.
- Fix __swp_type() macro for MAX_SWAPFILES_SHIFT(=5), which is defined
  in include/linux/swap.h.

* M32R TLB format

 [0][1:19]   [20:23]   [24:31]
 +---++-+
 |  VPN  ||ASID |
 +---++-+
 +-+-++-+---+-+-+-+-+
 |0 PPN  ||N|AC |L|G|V| |
 +-+-++-+---+-+-+-+-+
||   RWX | |
* software bits in PTE  ||   | +-- _PAGE_FILE | _PAGE_DIRTY
||   + _PAGE_PRESENT
|+ _PAGE_ACCESSED
+- _PAGE_PROTNONE

Signed-off-by: Hitoshi Yamamoto [EMAIL PROTECTED]
Signed-off-by: Hirokazu Takata [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 include/asm-m32r/pgtable-2level.h |4 ++--
 include/asm-m32r/pgtable.h|2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/asm-m32r/pgtable-2level.h 
b/include/asm-m32r/pgtable-2level.h
index 7509257..bca3475 100644
--- a/include/asm-m32r/pgtable-2level.h
+++ b/include/asm-m32r/pgtable-2level.h
@@ -71,8 +71,8 @@ static inline pmd_t *pmd_offset(pgd_t * dir, unsigned long 
address)
 #define pfn_pmd(pfn, prot) __pmd(((pfn)  PAGE_SHIFT) | pgprot_val(prot))
 
 #define PTE_FILE_MAX_BITS  29
-#define pte_to_pgoff(pte)  (((pte_val(pte)  2)  0xef) | (((pte_val(pte) 
 10))  7))
-#define pgoff_to_pte(off)  ((pte_t) { (((off)  0xef)  2) | (((off)  
7)  10) | _PAGE_FILE })
+#define pte_to_pgoff(pte)  (((pte_val(pte)  2)  0x7f) | (((pte_val(pte) 
 10))  7))
+#define pgoff_to_pte(off)  ((pte_t) { (((off)  0x7f)  2) | (((off)  
7)  10) | _PAGE_FILE })
 
 #endif /* __KERNEL__ */
 #endif /* _ASM_M32R_PGTABLE_2LEVEL_H */
diff --git a/include/asm-m32r/pgtable.h b/include/asm-m32r/pgtable.h
index 8b2a2f1..6604303 100644
--- a/include/asm-m32r/pgtable.h
+++ b/include/asm-m32r/pgtable.h
@@ -366,7 +366,7 @@ static inline void pmd_set(pmd_t * pmdp, pte_t * ptep)
 #define pte_unmap_nested(pte)  do { } while (0)
 
 /* Encode and de-code a swap entry */
-#define __swp_type(x)  (((x).val  2)  0x3f)
+#define __swp_type(x)  (((x).val  2)  0x1f)
 #define __swp_offset(x)((x).val  10)
 #define __swp_entry(type, offset)  \
((swp_entry_t) { ((type)  2) | ((offset)  10) })
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Let SYSV68_PARTITION default to yes on VME only

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=22258d406f91d7f7ee8e58f18b3722d0647f6a9a
Commit: 22258d406f91d7f7ee8e58f18b3722d0647f6a9a
Parent: 23c9bbbac57ae50dceadfda37b49785ec04dd42f
Author: Geert Uytterhoeven [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:28 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:33 2007 -0700

Let SYSV68_PARTITION default to yes on VME only

Don't enable SYSV68 partition table support on all m68k boxes by default,
only on Motorola VME boards.

Signed-off-by: Geert Uytterhoeven [EMAIL PROTECTED]
Cc: Philippe De Muyter [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 fs/partitions/Kconfig |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/partitions/Kconfig b/fs/partitions/Kconfig
index 0120704..7638a1c 100644
--- a/fs/partitions/Kconfig
+++ b/fs/partitions/Kconfig
@@ -239,7 +239,7 @@ config EFI_PARTITION
 
 config SYSV68_PARTITION
bool SYSV68 partition table support if PARTITION_ADVANCED
-   default y if M68K
+   default y if VME
help
  Say Y here if you would like to be able to read the hard disk
  partition table format used by Motorola Delta machines (using
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


uml: remove task_protections

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=57598fd7b31f6437874308a79ca23e51c74da59b
Commit: 57598fd7b31f6437874308a79ca23e51c74da59b
Parent: 22258d406f91d7f7ee8e58f18b3722d0647f6a9a
Author: Jeff Dike [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:30 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:33 2007 -0700

uml: remove task_protections

Replaced task_protections with stack_protections since they do the same
thing, and task_protections was misnamed anyway.

This needs THREAD_SIZE, so that's imported via common-offsets.h

Also tidied up the code in the vicinity.

Signed-off-by: Jeff Dike [EMAIL PROTECTED]
Cc: Paolo 'Blaisorblade' Giarrusso [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/um/include/common-offsets.h |2 ++
 arch/um/include/os.h |1 -
 arch/um/kernel/tt/exec_kern.c|2 +-
 arch/um/kernel/tt/process_kern.c |2 +-
 arch/um/kernel/um_arch.c |2 +-
 arch/um/os-Linux/util.c  |   23 +++
 6 files changed, 8 insertions(+), 24 deletions(-)

diff --git a/arch/um/include/common-offsets.h b/arch/um/include/common-offsets.h
index 5593a80..541f4a8 100644
--- a/arch/um/include/common-offsets.h
+++ b/arch/um/include/common-offsets.h
@@ -28,3 +28,5 @@ DEFINE(UM_NR_CPUS, NR_CPUS);
 
 /* For crypto assembler code. */
 DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
+
+DEFINE(UM_THREAD_SIZE, THREAD_SIZE);
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index 688d181..4d9fb26 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -272,7 +272,6 @@ extern void do_longjmp(void *p, int val);
 
 /* util.c */
 extern void stack_protections(unsigned long address);
-extern void task_protections(unsigned long address);
 extern int raw(int fd);
 extern void setup_machinename(char *machine_out);
 extern void setup_hostinfo(char *buf, int len);
diff --git a/arch/um/kernel/tt/exec_kern.c b/arch/um/kernel/tt/exec_kern.c
index 98e2174..40126cb 100644
--- a/arch/um/kernel/tt/exec_kern.c
+++ b/arch/um/kernel/tt/exec_kern.c
@@ -57,7 +57,7 @@ void flush_thread_tt(void)
enable_timer();
free_page(stack);
protect_memory(uml_reserved, high_physmem - uml_reserved, 1, 1, 0, 1);
-   task_protections((unsigned long) current_thread);
+   stack_protections((unsigned long) current_thread);
force_flush_all();
unblock_signals();
 }
diff --git a/arch/um/kernel/tt/process_kern.c b/arch/um/kernel/tt/process_kern.c
index c631303..74347ad 100644
--- a/arch/um/kernel/tt/process_kern.c
+++ b/arch/um/kernel/tt/process_kern.c
@@ -209,7 +209,7 @@ void finish_fork_handler(int sig)
if(current-mm != current-parent-mm)
protect_memory(uml_reserved, high_physmem - uml_reserved, 1, 
   1, 0, 1);
-   task_protections((unsigned long) current_thread);
+   stack_protections((unsigned long) current_thread);
 
free_page(current-thread.temp_stack);
local_irq_disable();
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 1cf954a..ecc458f 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -459,7 +459,7 @@ int __init linux_main(int argc, char **argv)
 
uml_postsetup();
 
-   task_protections((unsigned long) init_thread_info);
+   stack_protections((unsigned long) init_thread_info);
os_flush_stdout();
 
return CHOOSE_MODE(start_uml_tt(), start_uml_skas());
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c
index c307a89..7cbcf48 100644
--- a/arch/um/os-Linux/util.c
+++ b/arch/um/os-Linux/util.c
@@ -33,25 +33,8 @@
 
 void stack_protections(unsigned long address)
 {
-   int prot = PROT_READ | PROT_WRITE | PROT_EXEC;
-
-   if(mprotect((void *) address, UM_KERN_PAGE_SIZE, prot)  0)
-   panic(protecting stack failed, errno = %d, errno);
-}
-
-void task_protections(unsigned long address)
-{
-   unsigned long guard = address + UM_KERN_PAGE_SIZE;
-   unsigned long stack = guard + UM_KERN_PAGE_SIZE;
-   int prot = 0, pages;
-
-#ifdef notdef
-   if(mprotect((void *) stack, UM_KERN_PAGE_SIZE, prot)  0)
-   panic(protecting guard page failed, errno = %d, errno);
-#endif
-   pages = (1  UML_CONFIG_KERNEL_STACK_ORDER) - 2;
-   prot = PROT_READ | PROT_WRITE | PROT_EXEC;
-   if(mprotect((void *) stack, pages * UM_KERN_PAGE_SIZE, prot)  0)
+   if(mprotect((void *) address, UM_THREAD_SIZE,
+   PROT_READ | PROT_WRITE | PROT_EXEC)  0)
panic(protecting stack failed, errno = %d, errno);
 }
 
@@ -72,7 +55,7 @@ int raw(int fd)
 
/* XXX tcsetattr could have applied only some changes
 * (and cfmakeraw() is a set of changes) */
-   return(0);
+   

uml: use UM_THREAD_SIZE in userspace code

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e1a79c400a86f2f6a6735480e31f6ee159e76fa2
Commit: e1a79c400a86f2f6a6735480e31f6ee159e76fa2
Parent: 57598fd7b31f6437874308a79ca23e51c74da59b
Author: Jeff Dike [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:31 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:33 2007 -0700

uml: use UM_THREAD_SIZE in userspace code

Now that we have UM_THREAD_SIZE, we can replace the calculations in
user-space code (an earlier patch took care of the kernel side of the
house).

Signed-off-by: Jeff Dike [EMAIL PROTECTED]
Cc: Paolo 'Blaisorblade' Giarrusso [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/um/kernel/init_task.c  |3 +--
 arch/um/os-Linux/skas/process.c |7 +++
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/um/kernel/init_task.c b/arch/um/kernel/init_task.c
index cda91aa..4506c7f 100644
--- a/arch/um/kernel/init_task.c
+++ b/arch/um/kernel/init_task.c
@@ -44,8 +44,7 @@ __attribute__((__section__(.data.init_task))) =
 
 void unprotect_stack(unsigned long stack)
 {
-   os_protect_memory((void *) stack, (1  CONFIG_KERNEL_STACK_ORDER) * 
PAGE_SIZE,
-  1, 1, 0);
+   os_protect_memory((void *) stack, THREAD_SIZE, 1, 1, 0);
 }
 
 /*
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 6a0e466..3492886 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -490,8 +490,8 @@ void map_stub_pages(int fd, unsigned long code,
 void new_thread(void *stack, jmp_buf *buf, void (*handler)(void))
 {
(*buf)[0].JB_IP = (unsigned long) handler;
-   (*buf)[0].JB_SP = (unsigned long) stack +
-   (PAGE_SIZE  UML_CONFIG_KERNEL_STACK_ORDER) - sizeof(void *);
+   (*buf)[0].JB_SP = (unsigned long) stack + UM_THREAD_SIZE -
+   sizeof(void *);
 }
 
 #define INIT_JMP_NEW_THREAD 0
@@ -533,8 +533,7 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf)
case INIT_JMP_NEW_THREAD:
(*switch_buf)[0].JB_IP = (unsigned long) new_thread_handler;
(*switch_buf)[0].JB_SP = (unsigned long) stack +
-   (PAGE_SIZE  UML_CONFIG_KERNEL_STACK_ORDER) -
-   sizeof(void *);
+   UM_THREAD_SIZE - sizeof(void *);
break;
case INIT_JMP_CALLBACK:
(*cb_proc)(cb_arg);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


uml: tidy IRQ code

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2ea5bc5e5bb51492f189bba44045e0de7decf4a0
Commit: 2ea5bc5e5bb51492f189bba44045e0de7decf4a0
Parent: e1a79c400a86f2f6a6735480e31f6ee159e76fa2
Author: Jeff Dike [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:32 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:33 2007 -0700

uml: tidy IRQ code

Some tidying of the irq code before introducing irq stacks.  Mostly
style fixes, but the timer handler calls the timer code directly
rather than going through the generic sig_handler_common_skas.

Signed-off-by: Jeff Dike [EMAIL PROTECTED]
Cc: Paolo 'Blaisorblade' Giarrusso [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/um/kernel/init_task.c  |   11 ---
 arch/um/kernel/irq.c|4 ++--
 arch/um/os-Linux/signal.c   |   10 +++---
 arch/um/os-Linux/skas/process.c |6 --
 4 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/arch/um/kernel/init_task.c b/arch/um/kernel/init_task.c
index 4506c7f..f5385a3 100644
--- a/arch/um/kernel/init_task.c
+++ b/arch/um/kernel/init_task.c
@@ -46,14 +46,3 @@ void unprotect_stack(unsigned long stack)
 {
os_protect_memory((void *) stack, THREAD_SIZE, 1, 1, 0);
 }
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---
- * Local variables:
- * c-file-style: linux
- * End:
- */
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index 8f2ed36..a9651a1 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright (C) 2000 Jeff Dike ([EMAIL PROTECTED])
  * Licensed under the GPL
  * Derived (i.e. mostly copied) from arch/i386/kernel/irq.c:
@@ -53,7 +53,7 @@ int show_interrupts(struct seq_file *p, void *v)
if (i  NR_IRQS) {
spin_lock_irqsave(irq_desc[i].lock, flags);
action = irq_desc[i].action;
-   if (!action) 
+   if (!action)
goto skip;
seq_printf(p, %3d: ,i);
 #ifndef CONFIG_SMP
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index 48d4934..420ee86 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -61,15 +61,19 @@ void sig_handler(int sig, struct sigcontext *sc)
 
 static void real_alarm_handler(int sig, struct sigcontext *sc)
 {
+   union uml_pt_regs regs;
+
if(sig == SIGALRM)
switch_timers(0);
 
-   CHOOSE_MODE_PROC(sig_handler_common_tt, sig_handler_common_skas,
-sig, sc);
+   if(sc != NULL)
+   copy_sc(regs, sc);
+   regs.skas.is_user = 0;
+   unblock_signals();
+   timer_handler(sig, regs);
 
if(sig == SIGALRM)
switch_timers(1);
-
 }
 
 void alarm_handler(int sig, struct sigcontext *sc)
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 3492886..f9d2f85 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -288,7 +288,8 @@ int start_userspace(unsigned long stub_stack)
 void userspace(union uml_pt_regs *regs)
 {
int err, status, op, pid = userspace_pid[0];
-   int local_using_sysemu; /*To prevent races if using_sysemu changes 
under us.*/
+   /* To prevent races if using_sysemu changes under us.*/
+   int local_using_sysemu;
 
while(1){
restore_registers(pid, regs);
@@ -296,7 +297,8 @@ void userspace(union uml_pt_regs *regs)
/* Now we set local_using_sysemu to be used for one loop */
local_using_sysemu = get_using_sysemu();
 
-   op = SELECT_PTRACE_OPERATION(local_using_sysemu, 
singlestepping(NULL));
+   op = SELECT_PTRACE_OPERATION(local_using_sysemu,
+singlestepping(NULL));
 
err = ptrace(op, pid, 0, 0);
if(err)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


uml: iRQ stacks

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c14b84949e127560084c7c56b365931c71c60768
Commit: c14b84949e127560084c7c56b365931c71c60768
Parent: 2ea5bc5e5bb51492f189bba44045e0de7decf4a0
Author: Jeff Dike [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:34 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:34 2007 -0700

uml: iRQ stacks

Add a separate IRQ stack.  This differs from i386 in having the entire
interrupt run on a separate stack rather than starting on the normal kernel
stack and switching over once some preparation has been done.  The 
underlying
mechanism, is of course, sigaltstack.

Another difference is that interrupts that happen in userspace are handled 
on
the normal kernel stack.  These cause a wait wakeup instead of a signal
delivery so there is no point in trying to switch stacks for these.  There's
no other stuff on the stack, so there is no extra stack consumption.

This quirk makes it possible to have the entire interrupt run on a separate
stack - process preemption (and calls to schedule()) happens on a normal
kernel stack.  If we enable CONFIG_PREEMPT, this will need to be rethought.

The IRQ stack for CPU 0 is declared in the same way as the initial kernel
stack.  IRQ stacks for other CPUs will be allocated dynamically.

An extra field was added to the thread_info structure.  When the active
thread_info is copied to the IRQ stack, the real_thread field points back to
the original stack.  This makes it easy to tell where to copy the 
thread_info
struct back to when the interrupt is finished.  It also serves as a marker 
of
a nested interrupt.  It is NULL for the first interrupt on the stack, and
non-NULL for any nested interrupts.

Care is taken to behave correctly if a second interrupt comes in when the
thread_info structure is being set up or taken down.  I could just disable
interrupts here, but I don't feel like giving up any of the performance 
gained
by not flipping signals on and off.

If an interrupt comes in during these critical periods, the handler can't 
run
because it has no idea what shape the stack is in.  So, it sets a bit for 
its
signal in a global mask and returns.  The outer handler will deal with this
signal itself.

Atomicity is had with xchg.  A nested interrupt that needs to bail out will
xchg its signal mask into pending_mask and repeat in case yet another
interrupt hit at the same time, until the mask stabilizes.

The outermost interrupt will set up the thread_info and xchg a zero into
pending_mask when it is done.  At this point, nested interrupts will look at
-real_thread and see that no setup needs to be done.  They can just 
continue
normally.

Similar care needs to be taken when exiting the outer handler.  If another
interrupt comes in while it is copying the thread_info, it will drop a bit
into pending_mask.  The outer handler will check this and if it is non-zero,
will loop, set up the stack again, and handle the interrupt.

Signed-off-by: Jeff Dike [EMAIL PROTECTED]
Cc: Paolo 'Blaisorblade' Giarrusso [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/um/include/kern_util.h  |3 +
 arch/um/kernel/dyn.lds.S |2 +
 arch/um/kernel/init_task.c   |   16 +++--
 arch/um/kernel/irq.c |  111 ++
 arch/um/kernel/skas/process.c|4 +
 arch/um/kernel/uml.lds.S |2 +
 arch/um/os-Linux/signal.c|   40 
 arch/um/os-Linux/sys-i386/signal.c   |8 +--
 arch/um/os-Linux/sys-x86_64/signal.c |6 +-
 include/asm-um/thread_info.h |2 +
 10 files changed, 180 insertions(+), 14 deletions(-)

diff --git a/arch/um/include/kern_util.h b/arch/um/include/kern_util.h
index 50a4969..8d7f7c1 100644
--- a/arch/um/include/kern_util.h
+++ b/arch/um/include/kern_util.h
@@ -117,4 +117,7 @@ extern void sigio_handler(int sig, union uml_pt_regs *regs);
 
 extern void copy_sc(union uml_pt_regs *regs, void *from);
 
+unsigned long to_irq_stack(int sig, unsigned long *mask_out);
+unsigned long from_irq_stack(int nested);
+
 #endif
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index e36f92b..87a4e44 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -97,6 +97,8 @@ SECTIONS
   .data   : {
 . = ALIGN(KERNEL_STACK_SIZE);  /* init_task */
 *(.data.init_task)
+. = ALIGN(KERNEL_STACK_SIZE);
+*(.data.init_irqstack)
 *(.data .data.* .gnu.linkonce.d.*)
 SORT(CONSTRUCTORS)
   }
diff --git a/arch/um/kernel/init_task.c b/arch/um/kernel/init_task.c
index f5385a3..d4f1d1a 100644
--- 

uml: shrink kernel stacks

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=02239c29967418284c05d58971894d658575e78c
Commit: 02239c29967418284c05d58971894d658575e78c
Parent: c14b84949e127560084c7c56b365931c71c60768
Author: Jeff Dike [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:35 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:34 2007 -0700

uml: shrink kernel stacks

Make kernel stacks be 1 page on i386 and 2 pages on x86_64.  These match the
host values.

Signed-off-by: Jeff Dike [EMAIL PROTECTED]
Cc: Paolo 'Blaisorblade' Giarrusso [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/um/Kconfig   |3 ++-
 arch/um/defconfig |2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index b9c0f30..c504312 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -277,7 +277,8 @@ config HIGHMEM
 
 config KERNEL_STACK_ORDER
int Kernel stack size order
-   default 2
+   default 1 if 64BIT
+   default 0 if !64BIT
help
This option determines the size of UML kernel stacks.  They will
be 1  order pages.  The default is OK unless you're running Valgrind
diff --git a/arch/um/defconfig b/arch/um/defconfig
index f938fa8..a54d0ef 100644
--- a/arch/um/defconfig
+++ b/arch/um/defconfig
@@ -86,7 +86,7 @@ CONFIG_MCONSOLE=y
 # CONFIG_MAGIC_SYSRQ is not set
 CONFIG_NEST_LEVEL=0
 # CONFIG_HIGHMEM is not set
-CONFIG_KERNEL_STACK_ORDER=2
+CONFIG_KERNEL_STACK_ORDER=0
 CONFIG_UML_REAL_TIME_CLOCK=y
 
 #
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


getrusage(): fill ru_inblock and ru_oublock fields if possible

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6eaeeaba39e5fa3d52a0bb8de15e995516ae251a
Commit: 6eaeeaba39e5fa3d52a0bb8de15e995516ae251a
Parent: 02239c29967418284c05d58971894d658575e78c
Author: Eric Dumazet [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:37 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:34 2007 -0700

getrusage(): fill ru_inblock and ru_oublock fields if possible

If CONFIG_TASK_IO_ACCOUNTING is defined, we update io accounting counters 
for
each task.

This patch permits reporting of values using the well known getrusage()
syscall, filling ru_inblock and ru_oublock instead of null values.

As TASK_IO_ACCOUNTING currently counts bytes counts, we approximate blocks
count doing : nr_blocks = nr_bytes / 512

Example of use :
--
After patch is applied, /usr/bin/time command can now give a good
approximation of IO that the process had to do.

$ /usr/bin/time grep tototo /usr/include/*
Command exited with non-zero status 1
0.00user 0.02system 0:02.11elapsed 1%CPU (0avgtext+0avgdata 0maxresident)k
24288inputs+0outputs (0major+259minor)pagefaults 0swaps

$ /usr/bin/time dd if=/dev/zero of=/tmp/testfile count=1000
1000+0 enregistrements lus
1000+0 enregistrements écrits
512000 octets (512 kB) copiés, 0,00326601 seconde, 157 MB/s
0.00user 0.00system 0:00.00elapsed 80%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+3000outputs (0major+299minor)pagefaults 0swaps

Signed-off-by: Eric Dumazet [EMAIL PROTECTED]
Cc: Oleg Nesterov [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 include/linux/sched.h  |1 +
 include/linux/task_io_accounting_ops.h |   28 
 kernel/exit.c  |9 +
 kernel/fork.c  |1 +
 kernel/sys.c   |7 +++
 5 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 17b72d8..75f4437 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -469,6 +469,7 @@ struct signal_struct {
cputime_t utime, stime, cutime, cstime;
unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
+   unsigned long inblock, oublock, cinblock, coublock;
 
/*
 * Cumulative ns of scheduled CPU time for dead threads in the
diff --git a/include/linux/task_io_accounting_ops.h 
b/include/linux/task_io_accounting_ops.h
index df2a319..1218733 100644
--- a/include/linux/task_io_accounting_ops.h
+++ b/include/linux/task_io_accounting_ops.h
@@ -10,11 +10,29 @@ static inline void task_io_account_read(size_t bytes)
current-ioac.read_bytes += bytes;
 }
 
+/*
+ * We approximate number of blocks, because we account bytes only.
+ * A 'block' is 512 bytes
+ */
+static inline unsigned long task_io_get_inblock(const struct task_struct *p)
+{
+   return p-ioac.read_bytes  9;
+}
+
 static inline void task_io_account_write(size_t bytes)
 {
current-ioac.write_bytes += bytes;
 }
 
+/*
+ * We approximate number of blocks, because we account bytes only.
+ * A 'block' is 512 bytes
+ */
+static inline unsigned long task_io_get_oublock(const struct task_struct *p)
+{
+   return p-ioac.write_bytes  9;
+}
+
 static inline void task_io_account_cancelled_write(size_t bytes)
 {
current-ioac.cancelled_write_bytes += bytes;
@@ -31,10 +49,20 @@ static inline void task_io_account_read(size_t bytes)
 {
 }
 
+static inline unsigned long task_io_get_inblock(const struct task_struct *p)
+{
+   return 0;
+}
+
 static inline void task_io_account_write(size_t bytes)
 {
 }
 
+static inline unsigned long task_io_get_oublock(const struct task_struct *p)
+{
+   return 0;
+}
+
 static inline void task_io_account_cancelled_write(size_t bytes)
 {
 }
diff --git a/kernel/exit.c b/kernel/exit.c
index b0c6f0c..7a5fd77 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -42,6 +42,7 @@
 #include linux/audit.h /* for audit_free() */
 #include linux/resource.h
 #include linux/blkdev.h
+#include linux/task_io_accounting_ops.h
 
 #include asm/uaccess.h
 #include asm/unistd.h
@@ -113,6 +114,8 @@ static void __exit_signal(struct task_struct *tsk)
sig-nvcsw += tsk-nvcsw;
sig-nivcsw += tsk-nivcsw;
sig-sched_time += tsk-sched_time;
+   sig-inblock += task_io_get_inblock(tsk);
+   sig-oublock += task_io_get_oublock(tsk);
sig = NULL; /* Marker for below. */
}
 
@@ -1193,6 +1196,12 @@ static int wait_task_zombie(struct task_struct *p, int 
noreap,
p-nvcsw + sig-nvcsw + sig-cnvcsw;
psig-cnivcsw +=

lib/hexdump

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=99eaf3c45fe806c4a7f39b9be4a1bd0dfc617699
Commit: 99eaf3c45fe806c4a7f39b9be4a1bd0dfc617699
Parent: 6eaeeaba39e5fa3d52a0bb8de15e995516ae251a
Author: Randy Dunlap [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:39 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:34 2007 -0700

lib/hexdump

Based on ace_dump_mem() from Grant Likely for the Xilinx SystemACE
CompactFlash interface.

Add print_hex_dump()  hex_dumper() to lib/hexdump.c and linux/kernel.h.

This patch adds the functions print_hex_dump()  hex_dumper().
print_hex_dump() can be used to perform a hex + ASCII dump of data to
syslog, in an easily viewable format, thus providing a common text hex dump
format.

hex_dumper() provides a dump-to-memory function.  It converts one line of
output (16 bytes of input) at a time.

Example usages:
print_hex_dump(KERN_DEBUG, DUMP_PREFIX_ADDRESS, frame-data, 
frame-len);
hex_dumper(frame-data, frame-len, linebuf, sizeof(linebuf));

Example output using %DUMP_PREFIX_OFFSET:
0009ab42: 40414243 44454647 48494a4b [EMAIL PROTECTED] HIJKLMNO
Example output using %DUMP_PREFIX_ADDRESS:
88089af0: 70717273 74757677 78797a7b 7c7d7e7f-pqrstuvw xyz{|}~.

[EMAIL PROTECTED]: cleanups, add export]
Signed-off-by: Randy Dunlap [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 include/linux/kernel.h |   11 +
 lib/Makefile   |2 +-
 lib/hexdump.c  |  104 
 3 files changed, 116 insertions(+), 1 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 8645181..eec0d13 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -213,6 +213,17 @@ extern enum system_states {
 
 extern void dump_stack(void);
 
+enum {
+   DUMP_PREFIX_NONE,
+   DUMP_PREFIX_ADDRESS,
+   DUMP_PREFIX_OFFSET
+};
+extern void hex_dump_to_buffer(const void *buf, size_t len, char *linebuf,
+   size_t linebuflen);
+extern void print_hex_dump(const char *level, int prefix_type,
+   void *buf, size_t len);
+#define hex_asc(x) 0123456789abcdef[x]
+
 #ifdef DEBUG
 /* If you are writing a driver, please use dev_dbg instead */
 #define pr_debug(fmt,arg...) \
diff --git a/lib/Makefile b/lib/Makefile
index 1f65b46..c8c8e20 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -13,7 +13,7 @@ lib-$(CONFIG_SMP) += cpumask.o
 lib-y  += kobject.o kref.o kobject_uevent.o klist.o
 
 obj-y += div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \
-bust_spinlocks.o
+bust_spinlocks.o hexdump.o
 
 ifeq ($(CONFIG_DEBUG_KOBJECT),y)
 CFLAGS_kobject.o += -DDEBUG
diff --git a/lib/hexdump.c b/lib/hexdump.c
new file mode 100644
index 000..e6da5b7
--- /dev/null
+++ b/lib/hexdump.c
@@ -0,0 +1,104 @@
+/*
+ * lib/hexdump.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation. See README and COPYING for
+ * more details.
+ */
+
+#include linux/types.h
+#include linux/ctype.h
+#include linux/kernel.h
+#include linux/module.h
+
+/**
+ * hex_dump_to_buffer - convert a blob of data to hex ASCII in memory
+ * @buf: data blob to dump
+ * @len: number of bytes in the @buf
+ * @linebuf: where to put the converted data
+ * @linebuflen: total size of @linebuf, including space for terminating NUL
+ *
+ * hex_dump_to_buffer() works on one line of output at a time, i.e.,
+ * 16 bytes of input data converted to hex + ASCII output.
+ *
+ * Given a buffer of u8 data, hex_dump_to_buffer() converts the input data
+ * to a hex + ASCII dump at the supplied memory location.
+ * The converted output is always NUL-terminated.
+ *
+ * E.g.:
+ * hex_dump_to_buffer(frame-data, frame-len, linebuf, sizeof(linebuf));
+ *
+ * example output buffer:
+ * 40414243 44454647 48494a4b 4c4d4e4f  @ABCDEFGHIJKLMNO
+ */
+void hex_dump_to_buffer(const void *buf, size_t len, char *linebuf,
+   size_t linebuflen)
+{
+   const u8 *ptr = buf;
+   u8 ch;
+   int j, lx = 0;
+
+   for (j = 0; (j  16)  (j  len)  (lx + 3)  linebuflen; j++) {
+   if (j  !(j % 4))
+   linebuf[lx++] = ' ';
+   ch = ptr[j];
+   linebuf[lx++] = hex_asc(ch  4);
+   linebuf[lx++] = hex_asc(ch  0x0f);
+   }
+   if ((lx + 2)  linebuflen) {
+   linebuf[lx++] = ' ';
+   linebuf[lx++] = ' ';
+   }
+   for (j = 0; (j  16)  (j  len)  (lx + 2)  linebuflen; j++)
+   linebuf[lx++] = isprint(ptr[j]) ? ptr[j] : '.';
+   linebuf[lx++] = '\0';
+}

Consolidate asm/poll.h

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=04dd08b45be863f016df648a149ade1411608d00
Commit: 04dd08b45be863f016df648a149ade1411608d00
Parent: 99eaf3c45fe806c4a7f39b9be4a1bd0dfc617699
Author: Stephen Rothwell [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:40 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:34 2007 -0700

Consolidate asm/poll.h

These files are almost all the same.

This patch could be made even simpler if we don't mind POLLREMOVE turning
up in a few architectures that didn't have it previously (which should be
OK as POLLREMOVE is not used anywhere in the current tree).

Signed-off-by: Stephen Rothwell [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 include/asm-alpha/poll.h   |   26 +-
 include/asm-arm/poll.h |   28 +---
 include/asm-arm26/poll.h   |   22 ++
 include/asm-avr32/poll.h   |   28 +---
 include/asm-cris/poll.h|   27 +--
 include/asm-frv/poll.h |   18 +++---
 include/asm-generic/Kbuild |1 +
 include/asm-generic/poll.h |   37 +
 include/asm-h8300/poll.h   |   18 +++---
 include/asm-i386/poll.h|   28 +---
 include/asm-ia64/poll.h|   33 +
 include/asm-m32r/poll.h|   33 +
 include/asm-m68k/poll.h|   17 +
 include/asm-mips/poll.h|   21 +
 include/asm-parisc/poll.h  |   28 +---
 include/asm-powerpc/poll.h |   25 +
 include/asm-s390/poll.h|   36 +---
 include/asm-sh/poll.h  |   28 +---
 include/asm-sh64/poll.h|   33 ++---
 include/asm-sparc/poll.h   |   14 +-
 include/asm-sparc64/poll.h |   14 +-
 include/asm-v850/poll.h|   17 +
 include/asm-x86_64/poll.h  |   28 +---
 include/asm-xtensa/poll.h  |   20 +---
 24 files changed, 66 insertions(+), 514 deletions(-)

diff --git a/include/asm-alpha/poll.h b/include/asm-alpha/poll.h
index 76f8935..c98509d 100644
--- a/include/asm-alpha/poll.h
+++ b/include/asm-alpha/poll.h
@@ -1,25 +1 @@
-#ifndef __ALPHA_POLL_H
-#define __ALPHA_POLL_H
-
-#define POLLIN (1  0)
-#define POLLPRI(1  1)
-#define POLLOUT(1  2)
-#define POLLERR(1  3)
-#define POLLHUP(1  4)
-#define POLLNVAL   (1  5)
-#define POLLRDNORM (1  6)
-#define POLLRDBAND (1  7)
-#define POLLWRNORM (1  8)
-#define POLLWRBAND (1  9)
-#define POLLMSG(1  10)
-#define POLLREMOVE (1  12)
-#define POLLRDHUP   (1  13)
-
-
-struct pollfd {
-   int fd;
-   short events;
-   short revents;
-};
-
-#endif
+#include asm-generic/poll.h
diff --git a/include/asm-arm/poll.h b/include/asm-arm/poll.h
index 5030b2b..c98509d 100644
--- a/include/asm-arm/poll.h
+++ b/include/asm-arm/poll.h
@@ -1,27 +1 @@
-#ifndef __ASMARM_POLL_H
-#define __ASMARM_POLL_H
-
-/* These are specified by iBCS2 */
-#define POLLIN 0x0001
-#define POLLPRI0x0002
-#define POLLOUT0x0004
-#define POLLERR0x0008
-#define POLLHUP0x0010
-#define POLLNVAL   0x0020
-
-/* The rest seem to be more-or-less nonstandard. Check them! */
-#define POLLRDNORM 0x0040
-#define POLLRDBAND 0x0080
-#define POLLWRNORM 0x0100
-#define POLLWRBAND 0x0200
-#define POLLMSG0x0400
-#define POLLREMOVE 0x1000
-#define POLLRDHUP   0x2000
-
-struct pollfd {
-   int fd;
-   short events;
-   short revents;
-};
-
-#endif
+#include asm-generic/poll.h
diff --git a/include/asm-arm26/poll.h b/include/asm-arm26/poll.h
index 9ccb7f4..1170e70 100644
--- a/include/asm-arm26/poll.h
+++ b/include/asm-arm26/poll.h
@@ -1,26 +1,8 @@
 #ifndef __ASMARM_POLL_H
 #define __ASMARM_POLL_H
 
-/* These are specified by iBCS2 */
-#define POLLIN 0x0001
-#define POLLPRI0x0002
-#define POLLOUT0x0004
-#define POLLERR0x0008
-#define POLLHUP0x0010
-#define POLLNVAL   0x0020
+#include asm-generic/poll.h
 
-/* The rest seem to be more-or-less nonstandard. Check them! */
-#define POLLRDNORM 0x0040
-#define POLLRDBAND 0x0080
-#define POLLWRNORM 0x0100
-#define POLLWRBAND 0x0200
-#define POLLMSG0x0400
-#define POLLRDHUP   0x2000
-
-struct pollfd {
-   int fd;
-   short events;
-   short revents;
-};
+#undef POLLREMOVE
 
 #endif
diff --git 

small cleanup in gpt partition handling

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4c64c30a5c96bb798cbd6097d4996205b5359fa2
Commit: 4c64c30a5c96bb798cbd6097d4996205b5359fa2
Parent: 04dd08b45be863f016df648a149ade1411608d00
Author: Olaf Hering [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:42 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:34 2007 -0700

small cleanup in gpt partition handling

Remove unused argument in is_pmbr_valid()
Remove unneeded initialization of local variable legacy_mbr

Signed-off-by: Olaf Hering [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 fs/partitions/efi.c |   12 +---
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c
index 1bea610..e7b0700 100644
--- a/fs/partitions/efi.c
+++ b/fs/partitions/efi.c
@@ -152,7 +152,7 @@ last_lba(struct block_device *bdev)
 }
 
 static inline int
-pmbr_part_valid(struct partition *part, u64 lastlba)
+pmbr_part_valid(struct partition *part)
 {
 if (part-sys_ind == EFI_PMBR_OSTYPE_EFI_GPT 
 le32_to_cpu(part-start_sect) == 1UL)
@@ -163,7 +163,6 @@ pmbr_part_valid(struct partition *part, u64 lastlba)
 /**
  * is_pmbr_valid(): test Protective MBR for validity
  * @mbr: pointer to a legacy mbr structure
- * @lastlba: last_lba for the whole device
  *
  * Description: Returns 1 if PMBR is valid, 0 otherwise.
  * Validity depends on two things:
@@ -171,13 +170,13 @@ pmbr_part_valid(struct partition *part, u64 lastlba)
  *  2) One partition of type 0xEE is found
  */
 static int
-is_pmbr_valid(legacy_mbr *mbr, u64 lastlba)
+is_pmbr_valid(legacy_mbr *mbr)
 {
int i;
if (!mbr || le16_to_cpu(mbr-signature) != MSDOS_MBR_SIGNATURE)
 return 0;
for (i = 0; i  4; i++)
-   if (pmbr_part_valid(mbr-partition_record[i], lastlba))
+   if (pmbr_part_valid(mbr-partition_record[i]))
 return 1;
return 0;
 }
@@ -516,7 +515,7 @@ find_valid_gpt(struct block_device *bdev, gpt_header **gpt, 
gpt_entry **ptes)
int good_pgpt = 0, good_agpt = 0, good_pmbr = 0;
gpt_header *pgpt = NULL, *agpt = NULL;
gpt_entry *pptes = NULL, *aptes = NULL;
-   legacy_mbr *legacymbr = NULL;
+   legacy_mbr *legacymbr;
u64 lastlba;
if (!bdev || !gpt || !ptes)
return 0;
@@ -528,9 +527,8 @@ find_valid_gpt(struct block_device *bdev, gpt_header **gpt, 
gpt_entry **ptes)
 if (legacymbr) {
 read_lba(bdev, 0, (u8 *) legacymbr,
  sizeof (*legacymbr));
-good_pmbr = is_pmbr_valid(legacymbr, lastlba);
+good_pmbr = is_pmbr_valid(legacymbr);
 kfree(legacymbr);
-legacymbr=NULL;
 }
 if (!good_pmbr)
 goto fail;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


synclink_gt: add compat_ioctl

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2acdb1694494eb6f17b44b2b3065879af32d0d46
Commit: 2acdb1694494eb6f17b44b2b3065879af32d0d46
Parent: 4c64c30a5c96bb798cbd6097d4996205b5359fa2
Author: Paul Fulghum [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:43 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:34 2007 -0700

synclink_gt: add compat_ioctl

Add support for 32 bit ioctl on 64 bit systems for synclink_gt

Cc: Arnd Bergmann [EMAIL PROTECTED]
Signed-off-by: Paul Fulghum [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/char/synclink_gt.c |  107 
 include/linux/Kbuild   |2 +-
 include/linux/synclink.h   |   24 ++
 3 files changed, 132 insertions(+), 1 deletions(-)

diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 2a7736b..02b49bc 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -1171,6 +1171,112 @@ static int ioctl(struct tty_struct *tty, struct file 
*file,
 }
 
 /*
+ * support for 32 bit ioctl calls on 64 bit systems
+ */
+#ifdef CONFIG_COMPAT
+static long get_params32(struct slgt_info *info, struct MGSL_PARAMS32 __user 
*user_params)
+{
+   struct MGSL_PARAMS32 tmp_params;
+
+   DBGINFO((%s get_params32\n, info-device_name));
+   tmp_params.mode= (compat_ulong_t)info-params.mode;
+   tmp_params.loopback= info-params.loopback;
+   tmp_params.flags   = info-params.flags;
+   tmp_params.encoding= info-params.encoding;
+   tmp_params.clock_speed = (compat_ulong_t)info-params.clock_speed;
+   tmp_params.addr_filter = info-params.addr_filter;
+   tmp_params.crc_type= info-params.crc_type;
+   tmp_params.preamble_length = info-params.preamble_length;
+   tmp_params.preamble= info-params.preamble;
+   tmp_params.data_rate   = (compat_ulong_t)info-params.data_rate;
+   tmp_params.data_bits   = info-params.data_bits;
+   tmp_params.stop_bits   = info-params.stop_bits;
+   tmp_params.parity  = info-params.parity;
+   if (copy_to_user(user_params, tmp_params, sizeof(struct 
MGSL_PARAMS32)))
+   return -EFAULT;
+   return 0;
+}
+
+static long set_params32(struct slgt_info *info, struct MGSL_PARAMS32 __user 
*new_params)
+{
+   struct MGSL_PARAMS32 tmp_params;
+
+   DBGINFO((%s set_params32\n, info-device_name));
+   if (copy_from_user(tmp_params, new_params, sizeof(struct 
MGSL_PARAMS32)))
+   return -EFAULT;
+
+   spin_lock(info-lock);
+   info-params.mode= tmp_params.mode;
+   info-params.loopback= tmp_params.loopback;
+   info-params.flags   = tmp_params.flags;
+   info-params.encoding= tmp_params.encoding;
+   info-params.clock_speed = tmp_params.clock_speed;
+   info-params.addr_filter = tmp_params.addr_filter;
+   info-params.crc_type= tmp_params.crc_type;
+   info-params.preamble_length = tmp_params.preamble_length;
+   info-params.preamble= tmp_params.preamble;
+   info-params.data_rate   = tmp_params.data_rate;
+   info-params.data_bits   = tmp_params.data_bits;
+   info-params.stop_bits   = tmp_params.stop_bits;
+   info-params.parity  = tmp_params.parity;
+   spin_unlock(info-lock);
+
+   change_params(info);
+
+   return 0;
+}
+
+static long slgt_compat_ioctl(struct tty_struct *tty, struct file *file,
+unsigned int cmd, unsigned long arg)
+{
+   struct slgt_info *info = tty-driver_data;
+   int rc = -ENOIOCTLCMD;
+
+   if (sanity_check(info, tty-name, compat_ioctl))
+   return -ENODEV;
+   DBGINFO((%s compat_ioctl() cmd=%08X\n, info-device_name, cmd));
+
+   switch (cmd) {
+
+   case MGSL_IOCSPARAMS32:
+   rc = set_params32(info, compat_ptr(arg));
+   break;
+
+   case MGSL_IOCGPARAMS32:
+   rc = get_params32(info, compat_ptr(arg));
+   break;
+
+   case MGSL_IOCGPARAMS:
+   case MGSL_IOCSPARAMS:
+   case MGSL_IOCGTXIDLE:
+   case MGSL_IOCGSTATS:
+   case MGSL_IOCWAITEVENT:
+   case MGSL_IOCGIF:
+   case MGSL_IOCSGPIO:
+   case MGSL_IOCGGPIO:
+   case MGSL_IOCWAITGPIO:
+   case TIOCGICOUNT:
+   rc = ioctl(tty, file, cmd, (unsigned long)(compat_ptr(arg)));
+   break;
+
+   case MGSL_IOCSTXIDLE:
+   case MGSL_IOCTXENABLE:
+   case MGSL_IOCRXENABLE:
+   case MGSL_IOCTXABORT:
+   case TIOCMIWAIT:
+   case MGSL_IOCSIF:
+   rc = ioctl(tty, file, cmd, arg);
+   break;
+   }
+
+   DBGINFO((%s compat_ioctl() cmd=%08X rc=%d\n, info-device_name, 

powerpc: fixup hard_irq_disable semantics

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e1fa2e136ff64a3814a98c03d46320b9e80d29c8
Commit: e1fa2e136ff64a3814a98c03d46320b9e80d29c8
Parent: 2acdb1694494eb6f17b44b2b3065879af32d0d46
Author: Benjamin Herrenschmidt [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:45 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:34 2007 -0700

powerpc: fixup hard_irq_disable semantics

This patch renames the raw hard_irq_{enable,disable} into
__hard_irq_{enable,disable} and introduces a higher level hard_irq_disable()
function that can be used by any code to enforce that IRQs are fully 
disabled,
not only lazy disabled.

The difference with the __ versions is that it will update some 
per-processor
fields so that the kernel keeps track and properly re-enables them in the 
next
local_irq_disable();

This prepares powerpc for my next patch that introduces hard_irq_disable()
generically.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
Cc: Rusty Russell [EMAIL PROTECTED]
Cc: Paul Mackerras [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/powerpc/kernel/irq.c   |2 +-
 arch/powerpc/kernel/swsusp.c|4 
 arch/powerpc/platforms/cell/pervasive.c |6 ++
 include/asm-powerpc/hw_irq.h|   11 +--
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 9ed4931..068377a 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -173,7 +173,7 @@ void local_irq_restore(unsigned long en)
lv1_get_version_info(tmp);
}
 
-   hard_irq_enable();
+   __hard_irq_enable();
 }
 #endif /* CONFIG_PPC64 */
 
diff --git a/arch/powerpc/kernel/swsusp.c b/arch/powerpc/kernel/swsusp.c
index 064a7ba..77b7b34 100644
--- a/arch/powerpc/kernel/swsusp.c
+++ b/arch/powerpc/kernel/swsusp.c
@@ -36,8 +36,4 @@ void restore_processor_state(void)
 #ifdef CONFIG_PPC32
set_context(current-active_mm-context.id, current-active_mm-pgd);
 #endif
-
-#ifdef CONFIG_PPC64
-   hard_irq_enable();
-#endif
 }
diff --git a/arch/powerpc/platforms/cell/pervasive.c 
b/arch/powerpc/platforms/cell/pervasive.c
index 8c20f0f..812bf56 100644
--- a/arch/powerpc/platforms/cell/pervasive.c
+++ b/arch/powerpc/platforms/cell/pervasive.c
@@ -43,12 +43,10 @@ static void cbe_power_save(void)
unsigned long ctrl, thread_switch_control;
 
/*
-* We need to hard disable interrupts, but we also need to mark them
-* hard disabled in the PACA so that the local_irq_enable() done by
-* our caller upon return propertly hard enables.
+* We need to hard disable interrupts, the local_irq_enable() done by
+* our caller upon return will hard re-enable.
 */
hard_irq_disable();
-   get_paca()-hard_enabled = 0;
 
ctrl = mfspr(SPRN_CTRLF);
 
diff --git a/include/asm-powerpc/hw_irq.h b/include/asm-powerpc/hw_irq.h
index 9e4dd98..a7b60bf 100644
--- a/include/asm-powerpc/hw_irq.h
+++ b/include/asm-powerpc/hw_irq.h
@@ -48,8 +48,15 @@ extern void iseries_handle_interrupts(void);
 
 #define irqs_disabled()(local_get_flags() == 0)
 
-#define hard_irq_enable()  __mtmsrd(mfmsr() | MSR_EE, 1)
-#define hard_irq_disable() __mtmsrd(mfmsr()  ~MSR_EE, 1)
+#define __hard_irq_enable()__mtmsrd(mfmsr() | MSR_EE, 1)
+#define __hard_irq_disable()   __mtmsrd(mfmsr()  ~MSR_EE, 1)
+
+#define  hard_irq_disable()\
+   do {\
+   __hard_irq_disable();   \
+   get_paca()-soft_enabled = 0;   \
+   get_paca()-hard_enabled = 0;   \
+   } while(0)
 
 #else
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Add hard_irq_disable()

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2d3fbbb391e280724f7f7804ab00ff61cf1b6a4c
Commit: 2d3fbbb391e280724f7f7804ab00ff61cf1b6a4c
Parent: e1fa2e136ff64a3814a98c03d46320b9e80d29c8
Author: Benjamin Herrenschmidt [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:46 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:34 2007 -0700

Add hard_irq_disable()

Some architectures, like powerpc, implement lazy disabling of interrupts.
That means that on those, local_irq_disable() doesn't actually disable
interrupts on the CPU, but only sets some per CPU flag which cause them to 
be
disabled only if an interrupt actually occurs.

However, in some cases, such as stop_machine, we really want interrupts to 
be
fully disabled.  For example, I have code using stop machine to do ECC error
injection, used to verify operations of the ECC hardware, that sort of 
thing.
It really needs to make sure that nothing is actually writing to memory 
while
the injection happens.  Similar examples can be found in other low level 
bits
and pieces.

This patch implements a generic hard_irq_disable() function which is meant 
to
be called -after- local_irq_disable() and ensures that interrupts are fully
disabled on that CPU.  The default implementation is a nop, though powerpc
does already provide an appropriate one.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
Cc: Rusty Russell [EMAIL PROTECTED]
Cc: Paul Mackerras [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 include/linux/interrupt.h |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index f7b01b9..5323f62 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -241,6 +241,16 @@ static inline void __deprecated save_and_cli(unsigned long 
*x)
 #define save_and_cli(x)save_and_cli(x)
 #endif /* CONFIG_SMP */
 
+/* Some architectures might implement lazy enabling/disabling of
+ * interrupts. In some cases, such as stop_machine, we might want
+ * to ensure that after a local_irq_disable(), interrupts have
+ * really been disabled in hardware. Such architectures need to
+ * implement the following hook.
+ */
+#ifndef hard_irq_disable
+#define hard_irq_disable() do { } while(0)
+#endif
+
 /* PLEASE, avoid to allocate new softirqs, if you need not _really_ high
frequency threaded job scheduling. For almost all the purposes
tasklets are more than enough. F.e. all serial device BHs et
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


stop_machine() now uses hard_irq_disable

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a12bb44471b819c7f33d8a83044e7116c124e3d5
Commit: a12bb44471b819c7f33d8a83044e7116c124e3d5
Parent: 2d3fbbb391e280724f7f7804ab00ff61cf1b6a4c
Author: Benjamin Herrenschmidt [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:47 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:34 2007 -0700

stop_machine() now uses hard_irq_disable

Add a call to hard_irq_disable() to stop_machine so that we make sure IRQs 
are
really disabled and not only lazy-disabled on archs like powerpc as some 
users
of stop_machine() may rely on that.

[EMAIL PROTECTED]: build fix]
Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
Acked-by: Rusty Russell [EMAIL PROTECTED]
Cc: Paul Mackerras [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 kernel/stop_machine.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index daabb74..fcee2a8 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -8,6 +8,8 @@
 #include linux/sched.h
 #include linux/stop_machine.h
 #include linux/syscalls.h
+#include linux/interrupt.h
+
 #include asm/atomic.h
 #include asm/semaphore.h
 #include asm/uaccess.h
@@ -45,6 +47,7 @@ static int stopmachine(void *cpu)
if (stopmachine_state == STOPMACHINE_DISABLE_IRQ 
 !irqs_disabled) {
local_irq_disable();
+   hard_irq_disable();
irqs_disabled = 1;
/* Ack: irqs disabled. */
smp_mb(); /* Must read state first. */
@@ -124,6 +127,7 @@ static int stop_machine(void)
 
/* Make them disable irqs. */
local_irq_disable();
+   hard_irq_disable();
stopmachine_set_state(STOPMACHINE_DISABLE_IRQ);
 
return 0;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Overrun in drivers/char/rio/riocmd.c

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=84ea77635b91a6ca1c0c592ee5ddc0c780856b97
Commit: 84ea77635b91a6ca1c0c592ee5ddc0c780856b97
Parent: a12bb44471b819c7f33d8a83044e7116c124e3d5
Author: Eric Sesterhenn / Snakebyte [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:48 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:34 2007 -0700

Overrun in drivers/char/rio/riocmd.c

This got somehow lost in the noise.  This fixes coverity bug id #1025, if
Rup is greater or equal to MAX_RUP, we run past the Mapping Array.

Signed-off-by: Eric Sesterhenn [EMAIL PROTECTED]
Cc: Jiri Slaby [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/char/rio/riocmd.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c
index 245f031..8cc60b6 100644
--- a/drivers/char/rio/riocmd.c
+++ b/drivers/char/rio/riocmd.c
@@ -402,7 +402,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, 
struct Host *HostP, struc
rio_dprintk(RIO_DEBUG_CMD, CONTROL information: Host number 
%Zd, name ``%s''\n, HostP - p-RIOHosts, HostP-Name);
rio_dprintk(RIO_DEBUG_CMD, CONTROL information: Rup number  
0x%x\n, rup);
 
-   if (Rup = (unsigned short) MAX_RUP) {
+   if (Rup  (unsigned short) MAX_RUP) {
rio_dprintk(RIO_DEBUG_CMD, CONTROL information: This 
is the RUP for RTA ``%s''\n, HostP-Mapping[Rup].Name);
} else
rio_dprintk(RIO_DEBUG_CMD, CONTROL information: This 
is the RUP for link ``%c'' of host ``%s''\n, ('A' + Rup - MAX_RUP), 
HostP-Name);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


SubmitChecklist: add -W help

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=98091696653e8ac32a2653589923acd8198777ac
Commit: 98091696653e8ac32a2653589923acd8198777ac
Parent: 84ea77635b91a6ca1c0c592ee5ddc0c780856b97
Author: Andrew Morton [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:49 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:35 2007 -0700

SubmitChecklist: add -W help

Help people to work out how to use `gcc -W'.

Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 Documentation/SubmitChecklist |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/SubmitChecklist b/Documentation/SubmitChecklist
index 6491b2c..3af3e65 100644
--- a/Documentation/SubmitChecklist
+++ b/Documentation/SubmitChecklist
@@ -73,9 +73,9 @@ kernel patches.
 If the new code is substantial, addition of subsystem-specific fault
 injection might be appropriate.
 
-22: Newly-added code has been compiled with `gcc -W'.  This will generate
-lots of noise, but is good for finding bugs like warning: comparison
-between signed and unsigned.
+22: Newly-added code has been compiled with `gcc -W' (use make
+EXTRA_CFLAGS=-W).  This will generate lots of noise, but is good for
+finding bugs like warning: comparison between signed and unsigned.
 
 23: Tested after it has been merged into the -mm patchset to make sure
 that it still works with all of the other queued patches and various
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


module_author: don't advise putting in an email address

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=108f39a1b3b1e4b28ca8cc156f06171445499d21
Commit: 108f39a1b3b1e4b28ca8cc156f06171445499d21
Parent: 98091696653e8ac32a2653589923acd8198777ac
Author: Rene Herman [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:50 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:35 2007 -0700

module_author: don't advise putting in an email address

module_author: don't advise putting in an email address

It's information that's easily outdated and easily mistaken for a driver
contact which is a problem especially for modules with multiple current and
non-current authors as well as for modules with a maintainer who may not
even be a module author.

Signed-off-by: Rene Herman [EMAIL PROTECTED]
Cc: Rusty Russell [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 include/linux/module.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index 792d483..e6e0f86 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -124,7 +124,7 @@ extern struct module __this_module;
  */
 #define MODULE_LICENSE(_license) MODULE_INFO(license, _license)
 
-/* Author, ideally of form NAME EMAIL[, NAME EMAIL]*[ and NAME EMAIL] */
+/* Author, ideally of form NAME[, NAME]*[ and NAME] */
 #define MODULE_AUTHOR(_author) MODULE_INFO(author, _author)
   
 /* What your module does. */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


tty: add compat_ioctl

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e10cc1df1d2014f68a4bdcf73f6dd122c4561f94
Commit: e10cc1df1d2014f68a4bdcf73f6dd122c4561f94
Parent: 108f39a1b3b1e4b28ca8cc156f06171445499d21
Author: Paul Fulghum [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:50 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:35 2007 -0700

tty: add compat_ioctl

Add compat_ioctl method for tty code to allow processing of 32 bit ioctl
calls on 64 bit systems by tty core, tty drivers, and line disciplines.

Based on patch by Arnd Bergmann:
http://www.uwsg.iu.edu/hypermail/linux/kernel/0511.0/1732.html

[EMAIL PROTECTED]: make things static]
Signed-off-by: Paul Fulghum [EMAIL PROTECTED]
Acked-by: Arnd Bergmann [EMAIL PROTECTED]
Cc: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/char/n_tty.c   |   29 +
 drivers/char/tty_io.c  |   43 ---
 include/linux/tty_driver.h |9 +
 include/linux/tty_ldisc.h  |7 +++
 4 files changed, 69 insertions(+), 19 deletions(-)

diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index 6ac3ca4..b3d4ccc 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -1544,21 +1544,18 @@ static unsigned int normal_poll(struct tty_struct * 
tty, struct file * file, pol
 }
 
 struct tty_ldisc tty_ldisc_N_TTY = {
-   TTY_LDISC_MAGIC,/* magic */
-   n_tty,/* name */
-   0,  /* num */
-   0,  /* flags */
-   n_tty_open, /* open */
-   n_tty_close,/* close */
-   n_tty_flush_buffer, /* flush_buffer */
-   n_tty_chars_in_buffer,  /* chars_in_buffer */
-   read_chan,  /* read */
-   write_chan, /* write */
-   n_tty_ioctl,/* ioctl */
-   n_tty_set_termios,  /* set_termios */
-   normal_poll,/* poll */
-   NULL,   /* hangup */
-   n_tty_receive_buf,  /* receive_buf */
-   n_tty_write_wakeup  /* write_wakeup */
+   .magic   = TTY_LDISC_MAGIC,
+   .name= n_tty,
+   .open= n_tty_open,
+   .close   = n_tty_close,
+   .flush_buffer= n_tty_flush_buffer,
+   .chars_in_buffer = n_tty_chars_in_buffer,
+   .read= read_chan,
+   .write   = write_chan,
+   .ioctl   = n_tty_ioctl,
+   .set_termios = n_tty_set_termios,
+   .poll= normal_poll,
+   .receive_buf = n_tty_receive_buf,
+   .write_wakeup= n_tty_write_wakeup
 };
 
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index fc662e4..fe62c21 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -151,6 +151,12 @@ static int tty_open(struct inode *, struct file *);
 static int tty_release(struct inode *, struct file *);
 int tty_ioctl(struct inode * inode, struct file * file,
  unsigned int cmd, unsigned long arg);
+#ifdef CONFIG_COMPAT
+static long tty_compat_ioctl(struct file * file, unsigned int cmd,
+   unsigned long arg);
+#else
+#define tty_compat_ioctl NULL
+#endif
 static int tty_fasync(int fd, struct file * filp, int on);
 static void release_tty(struct tty_struct *tty, int idx);
 static void __proc_set_tty(struct task_struct *tsk, struct tty_struct *tty);
@@ -1143,8 +1149,8 @@ static unsigned int hung_up_tty_poll(struct file * filp, 
poll_table * wait)
return POLLIN | POLLOUT | POLLERR | POLLHUP | POLLRDNORM | POLLWRNORM;
 }
 
-static int hung_up_tty_ioctl(struct inode * inode, struct file * file,
-unsigned int cmd, unsigned long arg)
+static long hung_up_tty_ioctl(struct file * file,
+ unsigned int cmd, unsigned long arg)
 {
return cmd == TIOCSPGRP ? -ENOTTY : -EIO;
 }
@@ -1155,6 +1161,7 @@ static const struct file_operations tty_fops = {
.write  = tty_write,
.poll   = tty_poll,
.ioctl  = tty_ioctl,
+   .compat_ioctl   = tty_compat_ioctl,
.open   = tty_open,
.release= tty_release,
.fasync = tty_fasync,
@@ -1167,6 +1174,7 @@ static const struct file_operations ptmx_fops = {
.write  = tty_write,
.poll   = tty_poll,
.ioctl  = tty_ioctl,
+   .compat_ioctl   = tty_compat_ioctl,
.open   = ptmx_open,
.release= tty_release,
.fasync = tty_fasync,
@@ -1179,6 +1187,7 @@ static const struct file_operations console_fops = {
.write  = redirected_tty_write,
.poll   = tty_poll,
.ioctl  = tty_ioctl,
+

consolidate generic_writepages and mpage_writepages

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0ea971801625184a91a6d80ea85e53875caa0bf5
Commit: 0ea971801625184a91a6d80ea85e53875caa0bf5
Parent: e10cc1df1d2014f68a4bdcf73f6dd122c4561f94
Author: Miklos Szeredi [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:51 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:35 2007 -0700

consolidate generic_writepages and mpage_writepages

Clean up massive code duplication between mpage_writepages() and
generic_writepages().

The new generic function, write_cache_pages() takes a function pointer
argument, which will be called for each page to be written.

Maybe cifs_writepages() too can use this infrastructure, but I'm not
touching that with a ten-foot pole.

The upcoming page writeback support in fuse will also want this.

Signed-off-by: Miklos Szeredi [EMAIL PROTECTED]
Acked-by: Christoph Hellwig [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 fs/mpage.c|  174 -
 include/linux/mpage.h |1 -
 include/linux/writeback.h |   10 ++-
 mm/page-writeback.c   |   59 ++-
 4 files changed, 93 insertions(+), 151 deletions(-)

diff --git a/fs/mpage.c b/fs/mpage.c
index 0fb914f..c1698f2 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -454,11 +454,18 @@ EXPORT_SYMBOL(mpage_readpage);
  * written, so it can intelligently allocate a suitably-sized BIO.  For now,
  * just allocate full-size (16-page) BIOs.
  */
-static struct bio *
-__mpage_writepage(struct bio *bio, struct page *page, get_block_t get_block,
-   sector_t *last_block_in_bio, int *ret, struct writeback_control *wbc,
-   writepage_t writepage_fn)
+struct mpage_data {
+   struct bio *bio;
+   sector_t last_block_in_bio;
+   get_block_t *get_block;
+   unsigned use_writepage;
+};
+
+static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
+void *data)
 {
+   struct mpage_data *mpd = data;
+   struct bio *bio = mpd-bio;
struct address_space *mapping = page-mapping;
struct inode *inode = page-mapping-host;
const unsigned blkbits = inode-i_blkbits;
@@ -476,6 +483,7 @@ __mpage_writepage(struct bio *bio, struct page *page, 
get_block_t get_block,
int length;
struct buffer_head map_bh;
loff_t i_size = i_size_read(inode);
+   int ret = 0;
 
if (page_has_buffers(page)) {
struct buffer_head *head = page_buffers(page);
@@ -538,7 +546,7 @@ __mpage_writepage(struct bio *bio, struct page *page, 
get_block_t get_block,
 
map_bh.b_state = 0;
map_bh.b_size = 1  blkbits;
-   if (get_block(inode, block_in_file, map_bh, 1))
+   if (mpd-get_block(inode, block_in_file, map_bh, 1))
goto confused;
if (buffer_new(map_bh))
unmap_underlying_metadata(map_bh.b_bdev,
@@ -584,7 +592,7 @@ page_is_mapped:
/*
 * This page will go to BIO.  Do we need to send this BIO off first?
 */
-   if (bio  *last_block_in_bio != blocks[0] - 1)
+   if (bio  mpd-last_block_in_bio != blocks[0] - 1)
bio = mpage_bio_submit(WRITE, bio);
 
 alloc_new:
@@ -641,7 +649,7 @@ alloc_new:
boundary_block, 1  blkbits);
}
} else {
-   *last_block_in_bio = blocks[blocks_per_page - 1];
+   mpd-last_block_in_bio = blocks[blocks_per_page - 1];
}
goto out;
 
@@ -649,18 +657,19 @@ confused:
if (bio)
bio = mpage_bio_submit(WRITE, bio);
 
-   if (writepage_fn) {
-   *ret = (*writepage_fn)(page, wbc);
+   if (mpd-use_writepage) {
+   ret = mapping-a_ops-writepage(page, wbc);
} else {
-   *ret = -EAGAIN;
+   ret = -EAGAIN;
goto out;
}
/*
 * The caller has a ref on the inode, so *mapping is stable
 */
-   mapping_set_error(mapping, *ret);
+   mapping_set_error(mapping, ret);
 out:
-   return bio;
+   mpd-bio = bio;
+   return ret;
 }
 
 /**
@@ -683,120 +692,27 @@ out:
  * the call was made get new I/O started against them.  If wbc-sync_mode is
  * WB_SYNC_ALL then we were called for data integrity and we must wait for
  * existing IO to complete.
- *
- * If you fix this you should check generic_writepages() also!
  */
 int
 mpage_writepages(struct address_space *mapping,
struct writeback_control *wbc, get_block_t get_block)
 {
-   struct backing_dev_info *bdi = mapping-backing_dev_info;
-   struct bio *bio = NULL;
-   sector_t last_block_in_bio = 0;
-   int ret = 0;
-   int done = 0;

MPC52xx PSC SPI master driver

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=00b8fd236764e3d5bc1d30dc65e256e283de4c3d
Commit: 00b8fd236764e3d5bc1d30dc65e256e283de4c3d
Parent: 0ea971801625184a91a6d80ea85e53875caa0bf5
Author: Dragos Carp [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:52 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:35 2007 -0700

MPC52xx PSC SPI master driver

SPI master driver for MPC52xx using its Programmable Serial Controller.

Signed-off-by: David Brownell [EMAIL PROTECTED]
Signed-off-by: Dragos Carp [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/spi/Kconfig   |7 +
 drivers/spi/Makefile  |1 +
 drivers/spi/mpc52xx_psc_spi.c |  654 +
 3 files changed, 662 insertions(+), 0 deletions(-)

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 7c9d37f..5e3f748 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -107,6 +107,13 @@ config SPI_IMX
  This enables using the Freescale iMX SPI controller in master
  mode.
 
+config SPI_MPC52xx_PSC
+   tristate Freescale MPC52xx PSC SPI controller
+   depends on SPI_MASTER  PPC_MPC52xx  EXPERIMENTAL
+   help
+ This enables using the Freescale MPC52xx Programmable Serial
+ Controller in master SPI mode.
+
 config SPI_MPC83xx
tristate Freescale MPC83xx SPI controller
depends on SPI_MASTER  PPC_83xx  EXPERIMENTAL
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 624b636..5788d86 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_SPI_BUTTERFLY)   += spi_butterfly.o
 obj-$(CONFIG_SPI_IMX)  += spi_imx.o
 obj-$(CONFIG_SPI_PXA2XX)   += pxa2xx_spi.o
 obj-$(CONFIG_SPI_OMAP_UWIRE)   += omap_uwire.o
+obj-$(CONFIG_SPI_MPC52xx_PSC)  += mpc52xx_psc_spi.o
 obj-$(CONFIG_SPI_MPC83xx)  += spi_mpc83xx.o
 obj-$(CONFIG_SPI_S3C24XX_GPIO) += spi_s3c24xx_gpio.o
 obj-$(CONFIG_SPI_S3C24XX)  += spi_s3c24xx.o
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
new file mode 100644
index 000..052359f
--- /dev/null
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -0,0 +1,654 @@
+/*
+ * MPC52xx SPC in SPI mode driver.
+ *
+ * Maintainer: Dragos Carp
+ *
+ * Copyright (C) 2006 TOPTICA Photonics AG.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include linux/module.h
+#include linux/init.h
+#include linux/errno.h
+#include linux/interrupt.h
+
+#if defined(CONFIG_PPC_MERGE)
+#include asm/of_platform.h
+#else
+#include linux/platform_device.h
+#endif
+
+#include linux/workqueue.h
+#include linux/completion.h
+#include linux/io.h
+#include linux/delay.h
+#include linux/spi/spi.h
+#include linux/fsl_devices.h
+
+#include asm/mpc52xx.h
+#include asm/mpc52xx_psc.h
+
+#define MCLK 2000 /* PSC port MClk in hz */
+
+struct mpc52xx_psc_spi {
+   /* fsl_spi_platform data */
+   void (*activate_cs)(u8, u8);
+   void (*deactivate_cs)(u8, u8);
+   u32 sysclk;
+
+   /* driver internal data */
+   struct mpc52xx_psc __iomem *psc;
+   unsigned int irq;
+   u8 bits_per_word;
+   u8 busy;
+
+   struct workqueue_struct *workqueue;
+   struct work_struct work;
+
+   struct list_head queue;
+   spinlock_t lock;
+
+   struct completion done;
+};
+
+/* controller state */
+struct mpc52xx_psc_spi_cs {
+   int bits_per_word;
+   int speed_hz;
+};
+
+/* set clock freq, clock ramp, bits per work
+ * if t is NULL then reset the values to the default values
+ */
+static int mpc52xx_psc_spi_transfer_setup(struct spi_device *spi,
+   struct spi_transfer *t)
+{
+   struct mpc52xx_psc_spi_cs *cs = spi-controller_state;
+
+   cs-speed_hz = (t  t-speed_hz)
+   ? t-speed_hz : spi-max_speed_hz;
+   cs-bits_per_word = (t  t-bits_per_word)
+   ? t-bits_per_word : spi-bits_per_word;
+   cs-bits_per_word = ((cs-bits_per_word + 7) / 8) * 8;
+   return 0;
+}
+
+static void mpc52xx_psc_spi_activate_cs(struct spi_device *spi)
+{
+   struct mpc52xx_psc_spi_cs *cs = spi-controller_state;
+   struct mpc52xx_psc_spi *mps = spi_master_get_devdata(spi-master);
+   struct mpc52xx_psc __iomem *psc = mps-psc;
+   u32 sicr;
+   u16 ccr;
+
+   sicr = in_be32(psc-sicr);
+
+   /* Set clock phase and polarity */
+   if (spi-mode  SPI_CPHA)
+   sicr |= 0x1000;
+   else
+   sicr = ~0x1000;
+   if (spi-mode  SPI_CPOL)
+   sicr |= 

use defines in sys_getpriority/sys_setpriority

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3e88c553db938ad016026375f0545304b9030b42
Commit: 3e88c553db938ad016026375f0545304b9030b42
Parent: 00b8fd236764e3d5bc1d30dc65e256e283de4c3d
Author: Daniel Walker [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:53 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:35 2007 -0700

use defines in sys_getpriority/sys_setpriority

Switch to the defines for these two checks, instead of hard coding the
values.

[EMAIL PROTECTED]: add missing include]
Signed-off-by: Daniel Walker [EMAIL PROTECTED]
Cc: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 kernel/sys.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/sys.c b/kernel/sys.c
index ec319bb..df4c3a8 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -14,6 +14,7 @@
 #include linux/prctl.h
 #include linux/highuid.h
 #include linux/fs.h
+#include linux/resource.h
 #include linux/kernel.h
 #include linux/kexec.h
 #include linux/workqueue.h
@@ -659,7 +660,7 @@ asmlinkage long sys_setpriority(int which, int who, int 
niceval)
int error = -EINVAL;
struct pid *pgrp;
 
-   if (which  2 || which  0)
+   if (which  PRIO_USER || which  PRIO_PROCESS)
goto out;
 
/* normalize: avoid signed division (rounding problems) */
@@ -723,7 +724,7 @@ asmlinkage long sys_getpriority(int which, int who)
long niceval, retval = -ESRCH;
struct pid *pgrp;
 
-   if (which  2 || which  0)
+   if (which  PRIO_USER || which  PRIO_PROCESS)
return -EINVAL;
 
read_lock(tasklist_lock);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


rtc-rs5c313.c: error and warning are fixed

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9a3f1d53dbf112d2387f8b80682afc1084f9dfc3
Commit: 9a3f1d53dbf112d2387f8b80682afc1084f9dfc3
Parent: 3e88c553db938ad016026375f0545304b9030b42
Author: kogiidena [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:54 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:35 2007 -0700

rtc-rs5c313.c: error and warning are fixed

Correct a compile error and warning.

Signed-off-by: kogiidena [EMAIL PROTECTED]
Cc: Alessandro Zummo [EMAIL PROTECTED]
Cc: David Brownell [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/rtc/Kconfig   |2 +-
 drivers/rtc/rtc-rs5c313.c |6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 1759baa..ad445d5 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -397,7 +397,7 @@ config RTC_DRV_BFIN
 
 config RTC_DRV_RS5C313
tristate Ricoh RS5C313
-   depends on RTC_CLASS  BROKEN
+   depends on RTC_CLASS  SH_LANDISK
help
  If you say yes here you get support for the Ricoh RS5C313 RTC chips.
 
diff --git a/drivers/rtc/rtc-rs5c313.c b/drivers/rtc/rtc-rs5c313.c
index 9d6de37..79ee371 100644
--- a/drivers/rtc/rtc-rs5c313.c
+++ b/drivers/rtc/rtc-rs5c313.c
@@ -126,7 +126,7 @@ static void rs5c313_write_data(unsigned char data)
 static unsigned char rs5c313_read_data(void)
 {
int i;
-   unsigned char data;
+   unsigned char data = 0;
 
for (i = 0; i  8; i++) {
ndelay(700);
@@ -194,7 +194,7 @@ static void rs5c313_write_reg(unsigned char addr, unsigned 
char data)
return;
 }
 
-static inline unsigned char rs5c313_read_cntreg(unsigned char addr)
+static inline unsigned char rs5c313_read_cntreg(void)
 {
return rs5c313_read_reg(RS5C313_ADDR_CNTREG);
 }
@@ -356,7 +356,7 @@ static int rs5c313_rtc_probe(struct platform_device *pdev)
 
platform_set_drvdata(pdev, rtc);
 
-   return err;
+   return 0;
 }
 
 static int __devexit rs5c313_rtc_remove(struct platform_device *pdev)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


rtc-rs5c313.c: rtc_time value are fixed

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5a6a078950d769ff211c1cbd9468e31162481f8d
Commit: 5a6a078950d769ff211c1cbd9468e31162481f8d
Parent: 9a3f1d53dbf112d2387f8b80682afc1084f9dfc3
Author: kogiidena [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:56 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:35 2007 -0700

rtc-rs5c313.c: rtc_time value are fixed

Correct an initial value of suruct rtc_ time.

Signed-off-by: kogiidena [EMAIL PROTECTED]
Cc: Alessandro Zummo [EMAIL PROTECTED]
Cc: David Brownell [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/rtc/rtc-rs5c313.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/rtc/rtc-rs5c313.c b/drivers/rtc/rtc-rs5c313.c
index 79ee371..f964d1d 100644
--- a/drivers/rtc/rtc-rs5c313.c
+++ b/drivers/rtc/rtc-rs5c313.c
@@ -331,7 +331,8 @@ static void rs5c313_check_xstp_bit(void)
 
memset(tm, 0, sizeof(struct rtc_time));
tm.tm_mday  = 1;
-   tm.tm_mon   = 1;
+   tm.tm_mon   = 1 - 1;
+   tm.tm_year  = 2000 - 1900;
 
rs5c313_rtc_set_time(NULL, tm);
printk(KERN_ERR RICHO RS5C313: invalid value, resetting to 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


rtc-rs5c313.c: add error handling to avoid hardware hangup

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4ac24b3ba9016881b11646114bb5cd12cf23edd9
Commit: 4ac24b3ba9016881b11646114bb5cd12cf23edd9
Parent: 5a6a078950d769ff211c1cbd9468e31162481f8d
Author: kogiidena [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:57 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:35 2007 -0700

rtc-rs5c313.c: add error handling to avoid hardware hangup

Add error processing.  Hanging up by an infinite loop is evaded.

Signed-off-by: kogiidena [EMAIL PROTECTED]
Cc: Alessandro Zummo [EMAIL PROTECTED]
Cc: David Brownell [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/rtc/rtc-rs5c313.c |   19 ++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/drivers/rtc/rtc-rs5c313.c b/drivers/rtc/rtc-rs5c313.c
index f964d1d..66eb133 100644
--- a/drivers/rtc/rtc-rs5c313.c
+++ b/drivers/rtc/rtc-rs5c313.c
@@ -212,7 +212,9 @@ static inline void rs5c313_write_intintvreg(unsigned char 
data)
 static int rs5c313_rtc_read_time(struct device *dev, struct rtc_time *tm)
 {
int data;
+   int cnt;
 
+   cnt = 0;
while (1) {
RS5C313_CEENABLE;   /* CE:H */
 
@@ -225,6 +227,10 @@ static int rs5c313_rtc_read_time(struct device *dev, 
struct rtc_time *tm)
RS5C313_CEDISABLE;
ndelay(700);/* CE:L */
 
+   if (cnt++  100) {
+   dev_err(dev, %s: timeout error\n, __FUNCTION__);
+   return -EIO;
+   }
}
 
data = rs5c313_read_reg(RS5C313_ADDR_SEC);
@@ -266,7 +272,9 @@ static int rs5c313_rtc_read_time(struct device *dev, struct 
rtc_time *tm)
 static int rs5c313_rtc_set_time(struct device *dev, struct rtc_time *tm)
 {
int data;
+   int cnt;
 
+   cnt = 0;
/* busy check. */
while (1) {
RS5C313_CEENABLE;   /* CE:H */
@@ -279,6 +287,11 @@ static int rs5c313_rtc_set_time(struct device *dev, struct 
rtc_time *tm)
RS5C313_MISCOP;
RS5C313_CEDISABLE;
ndelay(700);/* CE:L */
+
+   if (cnt++  100) {
+   dev_err(dev, %s: timeout error\n, __FUNCTION__);
+   return -EIO;
+   }
}
 
data = BIN2BCD(tm-tm_sec);
@@ -317,6 +330,7 @@ static int rs5c313_rtc_set_time(struct device *dev, struct 
rtc_time *tm)
 static void rs5c313_check_xstp_bit(void)
 {
struct rtc_time tm;
+   int cnt;
 
RS5C313_CEENABLE;   /* CE:H */
if (rs5c313_read_cntreg()  RS5C313_CNTREG_WTEN_XSTP) {
@@ -326,8 +340,11 @@ static void rs5c313_check_xstp_bit(void)
rs5c313_write_cntreg(0x07);
 
/* busy check. */
-   while (rs5c313_read_cntreg()  RS5C313_CNTREG_ADJ_BSY)
+   for (cnt = 0; cnt  100; cnt++) {
+   if (!(rs5c313_read_cntreg()  RS5C313_CNTREG_ADJ_BSY))
+   break;
RS5C313_MISCOP;
+   }
 
memset(tm, 0, sizeof(struct rtc_time));
tm.tm_mday  = 1;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


attach_pid() with struct pid parameter

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e713d0dab21a68500720e222fa02567fc7dfb14b
Commit: e713d0dab21a68500720e222fa02567fc7dfb14b
Parent: 4ac24b3ba9016881b11646114bb5cd12cf23edd9
Author: Sukadev Bhattiprolu [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:22:58 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:35 2007 -0700

attach_pid() with struct pid parameter

attach_pid() currently takes a pid_t and then uses find_pid() to find the
corresponding struct pid.  Sometimes we already have the struct pid.  We can
then skip find_pid() if attach_pid() were to take a struct pid parameter.

Signed-off-by: Sukadev Bhattiprolu [EMAIL PROTECTED]
Cc: Cedric Le Goater [EMAIL PROTECTED]
Cc: Dave Hansen [EMAIL PROTECTED]
Cc: Serge Hallyn [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 fs/exec.c   |2 +-
 include/linux/pid.h |3 +--
 kernel/exit.c   |4 ++--
 kernel/fork.c   |   11 +++
 kernel/pid.c|9 ++---
 kernel/sys.c|2 +-
 6 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index 1ba85c7..2255dc7 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -702,7 +702,7 @@ static int de_thread(struct task_struct *tsk)
 */
detach_pid(tsk, PIDTYPE_PID);
tsk-pid = leader-pid;
-   attach_pid(tsk, PIDTYPE_PID,  tsk-pid);
+   attach_pid(tsk, PIDTYPE_PID,  find_pid(tsk-pid));
transfer_pid(leader, tsk, PIDTYPE_PGID);
transfer_pid(leader, tsk, PIDTYPE_SID);
list_replace_rcu(leader-tasks, tsk-tasks);
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 2ac27f9..33d3438 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -76,8 +76,7 @@ extern struct pid *get_task_pid(struct task_struct *task, 
enum pid_type type);
  * write-held.
  */
 extern int FASTCALL(attach_pid(struct task_struct *task,
-   enum pid_type type, int nr));
-
+   enum pid_type type, struct pid *pid));
 extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type));
 extern void FASTCALL(transfer_pid(struct task_struct *old,
  struct task_struct *new, enum pid_type));
diff --git a/kernel/exit.c b/kernel/exit.c
index 7a5fd77..e93691e 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -302,12 +302,12 @@ void __set_special_pids(pid_t session, pid_t pgrp)
if (process_session(curr) != session) {
detach_pid(curr, PIDTYPE_SID);
set_signal_session(curr-signal, session);
-   attach_pid(curr, PIDTYPE_SID, session);
+   attach_pid(curr, PIDTYPE_SID, find_pid(session));
}
if (process_group(curr) != pgrp) {
detach_pid(curr, PIDTYPE_PGID);
curr-signal-pgrp = pgrp;
-   attach_pid(curr, PIDTYPE_PGID, pgrp);
+   attach_pid(curr, PIDTYPE_PGID, find_pid(pgrp));
}
 }
 
diff --git a/kernel/fork.c b/kernel/fork.c
index da92e01..6031800 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1249,16 +1249,19 @@ static struct task_struct *copy_process(unsigned long 
clone_flags,
__ptrace_link(p, current-parent);
 
if (thread_group_leader(p)) {
+   pid_t pgid = process_group(current);
+   pid_t sid = process_session(current);
+
p-signal-tty = current-signal-tty;
-   p-signal-pgrp = process_group(current);
+   p-signal-pgrp = pgid;
set_signal_session(p-signal, process_session(current));
-   attach_pid(p, PIDTYPE_PGID, process_group(p));
-   attach_pid(p, PIDTYPE_SID, process_session(p));
+   attach_pid(p, PIDTYPE_PGID, find_pid(pgid));
+   attach_pid(p, PIDTYPE_SID, find_pid(sid));
 
list_add_tail_rcu(p-tasks, init_task.tasks);
__get_cpu_var(process_counts)++;
}
-   attach_pid(p, PIDTYPE_PID, p-pid);
+   attach_pid(p, PIDTYPE_PID, find_pid(p-pid));
nr_threads++;
}
 
diff --git a/kernel/pid.c b/kernel/pid.c
index d3ad724..d76f593 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -247,13 +247,16 @@ struct pid * fastcall find_pid(int nr)
 }
 EXPORT_SYMBOL_GPL(find_pid);
 
-int fastcall attach_pid(struct task_struct *task, enum pid_type type, int nr)
+/*
+ * attach_pid() must be called with the tasklist_lock write-held.
+ */
+int fastcall attach_pid(struct task_struct *task, enum pid_type type,
+   struct pid *pid)
 {
struct pid_link 

statically initialize struct pid for swapper

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=820e45db2380eb1545fa2bc5d34b8b2f2933faeb
Commit: 820e45db2380eb1545fa2bc5d34b8b2f2933faeb
Parent: e713d0dab21a68500720e222fa02567fc7dfb14b
Author: Sukadev Bhattiprolu [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:00 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:35 2007 -0700

statically initialize struct pid for swapper

Statically initialize a struct pid for the swapper process (pid_t == 0) and
attach it to init_task.  This is needed so task_pid(), task_pgrp() and
task_session() interfaces work on the swapper process also.

Signed-off-by: Sukadev Bhattiprolu [EMAIL PROTECTED]
Cc: Cedric Le Goater [EMAIL PROTECTED]
Cc: Dave Hansen [EMAIL PROTECTED]
Cc: Serge Hallyn [EMAIL PROTECTED]
Cc: Eric Biederman [EMAIL PROTECTED]
Cc: Herbert Poetzl [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Acked-by: Eric W. Biederman [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 include/linux/init_task.h |   27 +++
 include/linux/pid.h   |2 ++
 kernel/pid.c  |2 ++
 3 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 45170b2..a68835f 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -88,6 +88,28 @@ extern struct nsproxy init_nsproxy;
 
 extern struct group_info init_groups;
 
+#define INIT_STRUCT_PID {  \
+   .count  = ATOMIC_INIT(1),   \
+   .nr = 0,\
+   /* Don't put this struct pid in pid_hash */ \
+   .pid_chain  = { .next = NULL, .pprev = NULL },  \
+   .tasks  = { \
+   { .first = init_task.pids[PIDTYPE_PID].node }, \
+   { .first = init_task.pids[PIDTYPE_PGID].node },\
+   { .first = init_task.pids[PIDTYPE_SID].node }, \
+   },  \
+   .rcu= RCU_HEAD_INIT,\
+}
+
+#define INIT_PID_LINK(type)\
+{  \
+   .node = {   \
+   .next = NULL,   \
+   .pprev = init_struct_pid.tasks[type].first,\
+   },  \
+   .pid = init_struct_pid,\
+}
+
 /*
  *  INIT_TASK is used to set up the first task table, touch at
  * your own risk!. Base=0, limit=0x1f (=2MB)
@@ -139,6 +161,11 @@ extern struct group_info init_groups;
.cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers),  \
.fs_excl= ATOMIC_INIT(0),   \
.pi_lock= __SPIN_LOCK_UNLOCKED(tsk.pi_lock),\
+   .pids = {   \
+   [PIDTYPE_PID]  = INIT_PID_LINK(PIDTYPE_PID),\
+   [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID),   \
+   [PIDTYPE_SID]  = INIT_PID_LINK(PIDTYPE_SID),\
+   },  \
INIT_TRACE_IRQFLAGS \
INIT_LOCKDEP\
 }
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 33d3438..1e0e4e3 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -51,6 +51,8 @@ struct pid
struct rcu_head rcu;
 };
 
+extern struct pid init_struct_pid;
+
 struct pid_link
 {
struct hlist_node node;
diff --git a/kernel/pid.c b/kernel/pid.c
index d76f593..eb66bd2 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -27,11 +27,13 @@
 #include linux/bootmem.h
 #include linux/hash.h
 #include linux/pid_namespace.h
+#include linux/init_task.h
 
 #define pid_hashfn(nr) hash_long((unsigned long)nr, pidhash_shift)
 static struct hlist_head *pid_hash;
 static int pidhash_shift;
 static struct kmem_cache *pid_cachep;
+struct pid init_struct_pid = INIT_STRUCT_PID;
 
 int pid_max = PID_MAX_DEFAULT;
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Explicitly set pgid and sid of init process

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0e29b24aa6b3eb6c161cbb9e42fc20b47e67a7c6
Commit: 0e29b24aa6b3eb6c161cbb9e42fc20b47e67a7c6
Parent: 820e45db2380eb1545fa2bc5d34b8b2f2933faeb
Author: Sukadev Bhattiprolu [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:01 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:35 2007 -0700

Explicitly set pgid and sid of init process

Explicitly set pgid and sid of init process to 1.

Signed-off-by: Sukadev Bhattiprolu [EMAIL PROTECTED]
Cc: Cedric Le Goater [EMAIL PROTECTED]
Cc: Dave Hansen [EMAIL PROTECTED]
Cc: Serge Hallyn [EMAIL PROTECTED]
Cc: Eric Biederman [EMAIL PROTECTED]
Cc: Herbert Poetzl [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Acked-by: Eric W. Biederman [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 init/main.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/init/main.c b/init/main.c
index e8d080c..1940fa7 100644
--- a/init/main.c
+++ b/init/main.c
@@ -801,6 +801,7 @@ static int __init kernel_init(void * unused)
 */
init_pid_ns.child_reaper = current;
 
+   __set_special_pids(1, 1);
cad_pid = task_pid(current);
 
smp_prepare_cpus(max_cpus);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Use struct pid parameter in copy_process()

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=85868995d9d82de5b0de38d695559daddffef893
Commit: 85868995d9d82de5b0de38d695559daddffef893
Parent: 0e29b24aa6b3eb6c161cbb9e42fc20b47e67a7c6
Author: Sukadev Bhattiprolu [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:03 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:35 2007 -0700

Use struct pid parameter in copy_process()

Modify copy_process() to take a struct pid * parameter instead of a pid_t.
This simplifies the code a bit and also avoids having to call find_pid() to
convert the pid_t to a struct pid.

Changelog:
- Fixed Badari Pulavarty's comments and passed in init_struct_pid
  from fork_idle().
- Fixed Eric Biederman's comments and simplified this patch and
  used a new patch to remove the likely(pid) check.

Signed-off-by: Sukadev Bhattiprolu [EMAIL PROTECTED]
Cc: Cedric Le Goater [EMAIL PROTECTED]
Cc: Dave Hansen [EMAIL PROTECTED]
Cc: Serge Hallyn [EMAIL PROTECTED]
Cc: Eric Biederman [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Acked-by: Eric W. Biederman [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 kernel/fork.c |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 6031800..cf13c44 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -956,7 +956,7 @@ static struct task_struct *copy_process(unsigned long 
clone_flags,
unsigned long stack_size,
int __user *parent_tidptr,
int __user *child_tidptr,
-   int pid)
+   struct pid *pid)
 {
int retval;
struct task_struct *p = NULL;
@@ -1023,7 +1023,7 @@ static struct task_struct *copy_process(unsigned long 
clone_flags,
p-did_exec = 0;
delayacct_tsk_init(p);  /* Must remain after dup_task_struct() */
copy_flags(clone_flags, p);
-   p-pid = pid;
+   p-pid = pid_nr(pid);
retval = -EFAULT;
if (clone_flags  CLONE_PARENT_SETTID)
if (put_user(p-pid, parent_tidptr))
@@ -1261,7 +1261,7 @@ static struct task_struct *copy_process(unsigned long 
clone_flags,
list_add_tail_rcu(p-tasks, init_task.tasks);
__get_cpu_var(process_counts)++;
}
-   attach_pid(p, PIDTYPE_PID, find_pid(p-pid));
+   attach_pid(p, PIDTYPE_PID, pid);
nr_threads++;
}
 
@@ -1325,7 +1325,8 @@ struct task_struct * __cpuinit fork_idle(int cpu)
struct task_struct *task;
struct pt_regs regs;
 
-   task = copy_process(CLONE_VM, 0, idle_regs(regs), 0, NULL, NULL, 0);
+   task = copy_process(CLONE_VM, 0, idle_regs(regs), 0, NULL, NULL,
+   init_struct_pid);
if (!IS_ERR(task))
init_idle(task, cpu);
 
@@ -1375,7 +1376,7 @@ long do_fork(unsigned long clone_flags,
clone_flags |= CLONE_PTRACE;
}
 
-   p = copy_process(clone_flags, stack_start, regs, stack_size, 
parent_tidptr, child_tidptr, nr);
+   p = copy_process(clone_flags, stack_start, regs, stack_size, 
parent_tidptr, child_tidptr, pid);
/*
 * Do this prior waking up the new thread - the thread pointer
 * might get invalid after that point, if the thread exits quickly.
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Use task_pgrp() task_session() in copy_process()

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0800d30832ddecf2d9dc40068fed9df95930a8f1
Commit: 0800d30832ddecf2d9dc40068fed9df95930a8f1
Parent: 85868995d9d82de5b0de38d695559daddffef893
Author: Sukadev Bhattiprolu [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:04 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:36 2007 -0700

Use task_pgrp() task_session() in copy_process()

Use task_pgrp() and task_session() in copy_process(), and avoid find_pid()
call when attaching the task to its process group and session.

Signed-off-by: Sukadev Bhattiprolu [EMAIL PROTECTED]
Cc: Cedric Le Goater [EMAIL PROTECTED]
Cc: Dave Hansen [EMAIL PROTECTED]
Cc: Serge Hallyn [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Acked-by: Eric W. Biederman [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 kernel/fork.c |9 +++--
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index cf13c44..083bf89 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1249,14 +1249,11 @@ static struct task_struct *copy_process(unsigned long 
clone_flags,
__ptrace_link(p, current-parent);
 
if (thread_group_leader(p)) {
-   pid_t pgid = process_group(current);
-   pid_t sid = process_session(current);
-
p-signal-tty = current-signal-tty;
-   p-signal-pgrp = pgid;
+   p-signal-pgrp = process_group(current);
set_signal_session(p-signal, process_session(current));
-   attach_pid(p, PIDTYPE_PGID, find_pid(pgid));
-   attach_pid(p, PIDTYPE_SID, find_pid(sid));
+   attach_pid(p, PIDTYPE_PGID, task_pgrp(current));
+   attach_pid(p, PIDTYPE_SID, task_session(current));
 
list_add_tail_rcu(p-tasks, init_task.tasks);
__get_cpu_var(process_counts)++;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Kill unused sesssion and group values in rocket driver

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=93ba0881176ace057bc3111c8bdd717a23cb75ed
Commit: 93ba0881176ace057bc3111c8bdd717a23cb75ed
Parent: 0800d30832ddecf2d9dc40068fed9df95930a8f1
Author: Sukadev Bhattiprolu [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:05 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:36 2007 -0700

Kill unused sesssion and group values in rocket driver

The process_session() and process_group() values are not really used by the
driver.

Signed-off-by: Sukadev Bhattiprolu [EMAIL PROTECTED]
Cc: Cedric Le Goater [EMAIL PROTECTED]
Cc: Dave Hansen [EMAIL PROTECTED]
Cc: Serge Hallyn [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Cc: Eric W. Biederman [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/char/rocket.c |3 ---
 drivers/char/rocket_int.h |2 --
 2 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
index 61a63da..a3fd7e7 100644
--- a/drivers/char/rocket.c
+++ b/drivers/char/rocket.c
@@ -1014,9 +1014,6 @@ static int rp_open(struct tty_struct *tty, struct file 
*filp)
/*
 * Info-count is now 1; so it's safe to sleep now.
 */
-   info-session = process_session(current);
-   info-pgrp = process_group(current);
-
if ((info-flags  ROCKET_INITIALIZED) == 0) {
cp = info-channel;
sSetRxTrigger(cp, TRIG_1);
diff --git a/drivers/char/rocket_int.h b/drivers/char/rocket_int.h
index 89b4d7b..b4c53df 100644
--- a/drivers/char/rocket_int.h
+++ b/drivers/char/rocket_int.h
@@ -1158,8 +1158,6 @@ struct r_port {
int xmit_head;
int xmit_tail;
int xmit_cnt;
-   int session;
-   int pgrp;
int cd_status;
int ignore_status_mask;
int read_status_mask;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Don't init pgrp and __session in INIT_SIGNALS

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=325aa33da784e5997c756a151bc46e9cc9b79db2
Commit: 325aa33da784e5997c756a151bc46e9cc9b79db2
Parent: fa0334f19f0e1a1e570fc2a160dfe53536599ade
Author: Sukadev Bhattiprolu [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:10 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:36 2007 -0700

Don't init pgrp and __session in INIT_SIGNALS

Remove initialization of pgrp and __session in INIT_SIGNALS, as these are
later set by the call to __set_special_pids() in init/main.c by the patch:

explicitly-set-pgid-and-sid-of-init-process.patch

Signed-off-by: Sukadev Bhattiprolu [EMAIL PROTECTED]
Cc: Cedric Le Goater [EMAIL PROTECTED]
Cc: Dave Hansen [EMAIL PROTECTED]
Cc: Serge Hallyn [EMAIL PROTECTED]
Cc: Eric Biederman [EMAIL PROTECTED]
Cc: Oleg Nesterov [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 include/linux/init_task.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index a68835f..66e2f0a 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -65,9 +65,9 @@
.posix_timers= LIST_HEAD_INIT(sig.posix_timers),\
.cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers),  \
.rlim   = INIT_RLIMITS, \
-   .pgrp   = 1,\
+   .pgrp   = 0,\
.tty_old_pgrp   = NULL, \
-   { .__session  = 1}, \
+   { .__session  = 0}, \
 }
 
 extern struct nsproxy init_nsproxy;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


signal/timer/event fds: anonymous inode source

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5dc8bf8132d59c03fe2562bce165c2f03f021687
Commit: 5dc8bf8132d59c03fe2562bce165c2f03f021687
Parent: 325aa33da784e5997c756a151bc46e9cc9b79db2
Author: Davide Libenzi [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:11 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:36 2007 -0700

signal/timer/event fds: anonymous inode source

This patch add an anonymous inode source, to be used for files that need
and inode only in order to create a file*. We do not care of having an
inode for each file, and we do not even care of having different names in
the associated dentries (dentry names will be same for classes of file*).
This allow code reuse, and will be used by epoll, signalfd and timerfd
(and whatever else there'll be).

Signed-off-by: Davide Libenzi [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 fs/Makefile |1 +
 fs/anon_inodes.c|  200 +++
 include/linux/anon_inodes.h |   16 
 include/linux/magic.h   |1 +
 init/Kconfig|   10 ++
 5 files changed, 228 insertions(+), 0 deletions(-)

diff --git a/fs/Makefile b/fs/Makefile
index 9edf411..b5cd46a 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -22,6 +22,7 @@ endif
 obj-$(CONFIG_INOTIFY)  += inotify.o
 obj-$(CONFIG_INOTIFY_USER) += inotify_user.o
 obj-$(CONFIG_EPOLL)+= eventpoll.o
+obj-$(CONFIG_ANON_INODES)  += anon_inodes.o
 obj-$(CONFIG_COMPAT)   += compat.o compat_ioctl.o
 
 nfsd-$(CONFIG_NFSD):= nfsctl.o
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
new file mode 100644
index 000..40fe3a3
--- /dev/null
+++ b/fs/anon_inodes.c
@@ -0,0 +1,200 @@
+/*
+ *  fs/anon_inodes.c
+ *
+ *  Copyright (C) 2007  Davide Libenzi [EMAIL PROTECTED]
+ *
+ *  Thanks to Arnd Bergmann for code review and suggestions.
+ *  More changes for Thomas Gleixner suggestions.
+ *
+ */
+
+#include linux/file.h
+#include linux/poll.h
+#include linux/slab.h
+#include linux/init.h
+#include linux/fs.h
+#include linux/mount.h
+#include linux/module.h
+#include linux/kernel.h
+#include linux/magic.h
+#include linux/anon_inodes.h
+
+#include asm/uaccess.h
+
+static struct vfsmount *anon_inode_mnt __read_mostly;
+static struct inode *anon_inode_inode;
+static const struct file_operations anon_inode_fops;
+
+static int anon_inodefs_get_sb(struct file_system_type *fs_type, int flags,
+  const char *dev_name, void *data,
+  struct vfsmount *mnt)
+{
+   return get_sb_pseudo(fs_type, anon_inode:, NULL, ANON_INODE_FS_MAGIC,
+mnt);
+}
+
+static int anon_inodefs_delete_dentry(struct dentry *dentry)
+{
+   /*
+* We faked vfs to believe the dentry was hashed when we created it.
+* Now we restore the flag so that dput() will work correctly.
+*/
+   dentry-d_flags |= DCACHE_UNHASHED;
+   return 1;
+}
+
+static struct file_system_type anon_inode_fs_type = {
+   .name   = anon_inodefs,
+   .get_sb = anon_inodefs_get_sb,
+   .kill_sb= kill_anon_super,
+};
+static struct dentry_operations anon_inodefs_dentry_operations = {
+   .d_delete   = anon_inodefs_delete_dentry,
+};
+
+/**
+ * anon_inode_getfd - creates a new file instance by hooking it up to and
+ *anonymous inode, and a dentry that describe the class
+ *of the file
+ *
+ * @pfd: [out]   pointer to the file descriptor
+ * @dpinode: [out]   pointer to the inode
+ * @pfile:   [out]   pointer to the file struct
+ * @name:[in]name of the class of the new file
+ * @fops [in]file operations for the new file
+ * @priv [in]private data for the new file (will be file's 
private_data)
+ *
+ * Creates a new file by hooking it on a single inode. This is useful for files
+ * that do not need to have a full-fledged inode in order to operate correctly.
+ * All the files created with anon_inode_getfd() will share a single inode, by
+ * hence saving memory and avoiding code duplication for the file/inode/dentry
+ * setup.
+ */
+int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile,
+const char *name, const struct file_operations *fops,
+void *priv)
+{
+   struct qstr this;
+   struct dentry *dentry;
+   struct inode *inode;
+   struct file *file;
+   int error, fd;
+
+   if (IS_ERR(anon_inode_inode))
+   return -ENODEV;
+   file = get_empty_filp();
+   if (!file)
+   return -ENFILE;
+
+   inode = igrab(anon_inode_inode);
+   if (IS_ERR(inode)) {
+   error = PTR_ERR(inode);
+   goto err_put_filp;
+ 

signal/timer/event: signalfd wire up x86 arches

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2121e24bd8dd16b4e3f8d995428e2a748d5180cc
Commit: 2121e24bd8dd16b4e3f8d995428e2a748d5180cc
Parent: fba2afaaec790dc5ab4ae8827972f342211bbb86
Author: Davide Libenzi [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:14 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:36 2007 -0700

signal/timer/event: signalfd wire up x86 arches

This patch wires the signalfd system call to the x86 architectures.

Signed-off-by: Davide Libenzi [EMAIL PROTECTED]
Cc: Michael Kerrisk [EMAIL PROTECTED]
Cc: Andi Kleen [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/i386/kernel/syscall_table.S |1 +
 arch/x86_64/ia32/ia32entry.S |1 +
 include/asm-i386/unistd.h|3 ++-
 include/asm-x86_64/unistd.h  |2 ++
 4 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S
index 0772678..d91a5f5 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -320,3 +320,4 @@ ENTRY(sys_call_table)
.long sys_getcpu
.long sys_epoll_pwait
.long sys_utimensat /* 320 */
+   .long sys_signalfd
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index f210683..bf8552d 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -716,4 +716,5 @@ ia32_sys_call_table:
.quad sys_getcpu
.quad sys_epoll_pwait
.quad compat_sys_utimensat  /* 320 */
+   .quad sys_signalfd
 ia32_syscall_end:  
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index bd21e79..d8383b6 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -326,10 +326,11 @@
 #define __NR_getcpu318
 #define __NR_epoll_pwait   319
 #define __NR_utimensat 320
+#define __NR_signalfd  321
 
 #ifdef __KERNEL__
 
-#define NR_syscalls 321
+#define NR_syscalls 322
 
 #define __ARCH_WANT_IPC_PARSE_VERSION
 #define __ARCH_WANT_OLD_READDIR
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
index 18a0b01..e12fb1a 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -624,6 +624,8 @@ __SYSCALL(__NR_utimensat, sys_utimensat)
 #define __IGNORE_getcpu/* implemented as a vsyscall */
 #define __NR_epoll_pwait   281
 __SYSCALL(__NR_epoll_pwait, sys_epoll_pwait)
+#define __NR_signalfd  282
+__SYSCALL(__NR_signalfd, sys_signalfd)
 
 #ifndef __NO_STUBS
 #define __ARCH_WANT_OLD_READDIR
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


signal/timer/event: signalfd compat code

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6d18c9220965b437287c3a7e803725c24992ceac
Commit: 6d18c9220965b437287c3a7e803725c24992ceac
Parent: 2121e24bd8dd16b4e3f8d995428e2a748d5180cc
Author: Davide Libenzi [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:15 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:36 2007 -0700

signal/timer/event: signalfd compat code

This patch implements the necessary compat code for the signalfd system 
call.

Signed-off-by: Davide Libenzi [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 fs/compat.c |   26 ++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/fs/compat.c b/fs/compat.c
index 9cf75df..2487b83 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -46,6 +46,7 @@
 #include linux/tsacct_kern.h
 #include linux/security.h
 #include linux/highmem.h
+#include linux/signal.h
 #include linux/poll.h
 #include linux/mm.h
 #include linux/eventpoll.h
@@ -2199,3 +2200,28 @@ asmlinkage long compat_sys_epoll_pwait(int epfd,
 #endif /* TIF_RESTORE_SIGMASK */
 
 #endif /* CONFIG_EPOLL */
+
+#ifdef CONFIG_SIGNALFD
+
+asmlinkage long compat_sys_signalfd(int ufd,
+   const compat_sigset_t __user *sigmask,
+   compat_size_t sigsetsize)
+{
+   compat_sigset_t ss32;
+   sigset_t tmp;
+   sigset_t __user *ksigmask;
+
+   if (sigsetsize != sizeof(compat_sigset_t))
+   return -EINVAL;
+   if (copy_from_user(ss32, sigmask, sizeof(ss32)))
+   return -EFAULT;
+   sigset_from_compat(tmp, ss32);
+   ksigmask = compat_alloc_user_space(sizeof(sigset_t));
+   if (copy_to_user(ksigmask, tmp, sizeof(sigset_t)))
+   return -EFAULT;
+
+   return sys_signalfd(ufd, ksigmask, sizeof(sigset_t));
+}
+
+#endif /* CONFIG_SIGNALFD */
+
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


signal/timer/event: timerfd core

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b215e283992899650c4271e7385c79e26fb9a88e
Commit: b215e283992899650c4271e7385c79e26fb9a88e
Parent: 6d18c9220965b437287c3a7e803725c24992ceac
Author: Davide Libenzi [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:16 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:36 2007 -0700

signal/timer/event: timerfd core

This patch introduces a new system call for timers events delivered though
file descriptors.  This allows timer event to be used with standard POSIX
poll(2), select(2) and read(2).  As a consequence of supporting the Linux
f_op-poll subsystem, they can be used with epoll(2) too.

The system call is defined as:

int timerfd(int ufd, int clockid, int flags, const struct itimerspec *utmr);

The ufd parameter allows for re-use (re-programming) of an existing 
timerfd
w/out going through the close/open cycle (same as signalfd).  If ufd is 
-1,
s new file descriptor will be created, otherwise the existing ufd will be
re-programmed.

The clockid parameter is either CLOCK_MONOTONIC or CLOCK_REALTIME.  The 
time
specified in the utmr-it_value parameter is the expiry time for the 
timer.

If the TFD_TIMER_ABSTIME flag is set in flags, this is an absolute time,
otherwise it's a relative time.

If the time specified in the utmr-it_interval is not zero (.tv_sec == 0,
tv_nsec == 0), this is the period at which the following ticks should be
generated.

The utmr-it_interval should be set to zero if only one tick is requested.
Setting the utmr-it_value to zero will disable the timer, or will create 
a
timerfd without the timer enabled.

The function returns the new (or same, in case ufd is a valid timerfd
descriptor) file, or -1 in case of error.

As stated before, the timerfd file descriptor supports poll(2), select(2) 
and
epoll(2).  When a timer event happened on the timerfd, a POLLIN mask will be
returned.

The read(2) call can be used, and it will return a u32 variable holding the
number of ticks that happened on the interface since the last call to
read(2).  The read(2) call supportes the O_NONBLOCK flag too, and EAGAIN 
will
be returned if no ticks happened.

A quick test program, shows timerfd working correctly on my amd64 box:

http://www.xmailserver.org/timerfd-test.c

[EMAIL PROTECTED]: add sys_timerfd to sys_ni.c]
Signed-off-by: Davide Libenzi [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 fs/Makefile  |1 +
 fs/timerfd.c |  227 ++
 include/linux/syscalls.h |2 +
 include/linux/timerfd.h  |   17 
 init/Kconfig |   10 ++
 kernel/sys_ni.c  |1 +
 6 files changed, 258 insertions(+), 0 deletions(-)

diff --git a/fs/Makefile b/fs/Makefile
index cd8a57a..39625da 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -24,6 +24,7 @@ obj-$(CONFIG_INOTIFY_USER)+= inotify_user.o
 obj-$(CONFIG_EPOLL)+= eventpoll.o
 obj-$(CONFIG_ANON_INODES)  += anon_inodes.o
 obj-$(CONFIG_SIGNALFD) += signalfd.o
+obj-$(CONFIG_TIMERFD)  += timerfd.o
 obj-$(CONFIG_COMPAT)   += compat.o compat_ioctl.o
 
 nfsd-$(CONFIG_NFSD):= nfsctl.o
diff --git a/fs/timerfd.c b/fs/timerfd.c
new file mode 100644
index 000..e329e37
--- /dev/null
+++ b/fs/timerfd.c
@@ -0,0 +1,227 @@
+/*
+ *  fs/timerfd.c
+ *
+ *  Copyright (C) 2007  Davide Libenzi [EMAIL PROTECTED]
+ *
+ *
+ *  Thanks to Thomas Gleixner for code reviews and useful comments.
+ *
+ */
+
+#include linux/file.h
+#include linux/poll.h
+#include linux/init.h
+#include linux/fs.h
+#include linux/sched.h
+#include linux/kernel.h
+#include linux/list.h
+#include linux/spinlock.h
+#include linux/time.h
+#include linux/hrtimer.h
+#include linux/anon_inodes.h
+#include linux/timerfd.h
+
+struct timerfd_ctx {
+   struct hrtimer tmr;
+   ktime_t tintv;
+   spinlock_t lock;
+   wait_queue_head_t wqh;
+   int expired;
+};
+
+/*
+ * This gets called when the timer event triggers. We set the expired
+ * flag, but we do not re-arm the timer (in case it's necessary,
+ * tintv.tv64 != 0) until the timer is read.
+ */
+static enum hrtimer_restart timerfd_tmrproc(struct hrtimer *htmr)
+{
+   struct timerfd_ctx *ctx = container_of(htmr, struct timerfd_ctx, tmr);
+   unsigned long flags;
+
+   spin_lock_irqsave(ctx-lock, flags);
+   ctx-expired = 1;
+   wake_up_locked(ctx-wqh);
+   spin_unlock_irqrestore(ctx-lock, flags);
+
+   return HRTIMER_NORESTART;
+}
+
+static void timerfd_setup(struct timerfd_ctx *ctx, int clockid, int flags,
+ const struct itimerspec *ktmr)
+{
+   enum 

signal/timer/event: timerfd wire up x86 arches

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=57ac8898508638ca6d15ecd8b911a431d673ff30
Commit: 57ac8898508638ca6d15ecd8b911a431d673ff30
Parent: b215e283992899650c4271e7385c79e26fb9a88e
Author: Davide Libenzi [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:17 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:36 2007 -0700

signal/timer/event: timerfd wire up x86 arches

This patch wires the timerfd system call to the x86 architectures.

Signed-off-by: Davide Libenzi [EMAIL PROTECTED]
Cc: Andi Kleen [EMAIL PROTECTED]
Cc: Michael Kerrisk [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/i386/kernel/syscall_table.S |1 +
 arch/x86_64/ia32/ia32entry.S |1 +
 include/asm-i386/unistd.h|3 ++-
 include/asm-x86_64/unistd.h  |2 ++
 4 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S
index d91a5f5..d50634c 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -321,3 +321,4 @@ ENTRY(sys_call_table)
.long sys_epoll_pwait
.long sys_utimensat /* 320 */
.long sys_signalfd
+   .long sys_timerfd
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index bf8552d..bdbed0a 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -717,4 +717,5 @@ ia32_sys_call_table:
.quad sys_epoll_pwait
.quad compat_sys_utimensat  /* 320 */
.quad sys_signalfd
+   .quad sys_timerfd
 ia32_syscall_end:  
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index d8383b6..1c8076a 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -327,10 +327,11 @@
 #define __NR_epoll_pwait   319
 #define __NR_utimensat 320
 #define __NR_signalfd  321
+#define __NR_timerfd   322
 
 #ifdef __KERNEL__
 
-#define NR_syscalls 322
+#define NR_syscalls 323
 
 #define __ARCH_WANT_IPC_PARSE_VERSION
 #define __ARCH_WANT_OLD_READDIR
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
index e12fb1a..3e273b0 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -626,6 +626,8 @@ __SYSCALL(__NR_utimensat, sys_utimensat)
 __SYSCALL(__NR_epoll_pwait, sys_epoll_pwait)
 #define __NR_signalfd  282
 __SYSCALL(__NR_signalfd, sys_signalfd)
+#define __NR_timerfd   282
+__SYSCALL(__NR_timerfd, sys_timerfd)
 
 #ifndef __NO_STUBS
 #define __ARCH_WANT_OLD_READDIR
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


signal/timer/event: timerfd compat code

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=83f5d1266926c75890f1bc4678e49d79483cb573
Commit: 83f5d1266926c75890f1bc4678e49d79483cb573
Parent: 57ac8898508638ca6d15ecd8b911a431d673ff30
Author: Davide Libenzi [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:18 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:36 2007 -0700

signal/timer/event: timerfd compat code

This patch implements the necessary compat code for the timerfd system call.

Signed-off-by: Davide Libenzi [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 fs/compat.c|   23 +++
 include/linux/compat.h |5 +
 kernel/compat.c|8 
 3 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/fs/compat.c b/fs/compat.c
index 2487b83..7b21b0a 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -2225,3 +2225,26 @@ asmlinkage long compat_sys_signalfd(int ufd,
 
 #endif /* CONFIG_SIGNALFD */
 
+#ifdef CONFIG_TIMERFD
+
+asmlinkage long compat_sys_timerfd(int ufd, int clockid, int flags,
+  const struct compat_itimerspec __user *utmr)
+{
+   long res;
+   struct itimerspec t;
+   struct itimerspec __user *ut;
+
+   res = -EFAULT;
+   if (get_compat_itimerspec(t, utmr))
+   goto err_exit;
+   ut = compat_alloc_user_space(sizeof(*ut));
+   if (copy_to_user(ut, t, sizeof(t)) )
+   goto err_exit;
+
+   res = sys_timerfd(ufd, clockid, flags, ut);
+err_exit:
+   return res;
+}
+
+#endif /* CONFIG_TIMERFD */
+
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 70a157a..636502c 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -225,6 +225,11 @@ static inline int compat_timespec_compare(struct 
compat_timespec *lhs,
return lhs-tv_nsec - rhs-tv_nsec;
 }
 
+extern int get_compat_itimerspec(struct itimerspec *dst,
+const struct compat_itimerspec __user *src);
+extern int put_compat_itimerspec(struct compat_itimerspec __user *dst,
+const struct itimerspec *src);
+
 asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
 
 extern int compat_printk(const char *fmt, ...);
diff --git a/kernel/compat.c b/kernel/compat.c
index cebb4c2..3bae374 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -475,8 +475,8 @@ asmlinkage long compat_sys_sched_getaffinity(compat_pid_t 
pid, unsigned int len,
return min_length;
 }
 
-static int get_compat_itimerspec(struct itimerspec *dst, 
-struct compat_itimerspec __user *src)
+int get_compat_itimerspec(struct itimerspec *dst,
+ const struct compat_itimerspec __user *src)
 { 
if (get_compat_timespec(dst-it_interval, src-it_interval) ||
get_compat_timespec(dst-it_value, src-it_value))
@@ -484,8 +484,8 @@ static int get_compat_itimerspec(struct itimerspec *dst,
return 0;
 } 
 
-static int put_compat_itimerspec(struct compat_itimerspec __user *dst, 
-struct itimerspec *src)
+int put_compat_itimerspec(struct compat_itimerspec __user *dst,
+ const struct itimerspec *src)
 { 
if (put_compat_timespec(src-it_interval, dst-it_interval) ||
put_compat_timespec(src-it_value, dst-it_value))
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


signal/timer/event: eventfd core

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e1ad7468c77ddb94b0615d5f50fa255525fde0f0
Commit: e1ad7468c77ddb94b0615d5f50fa255525fde0f0
Parent: 83f5d1266926c75890f1bc4678e49d79483cb573
Author: Davide Libenzi [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:19 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:36 2007 -0700

signal/timer/event: eventfd core

This is a very simple and light file descriptor, that can be used as event
wait/dispatch by userspace (both wait and dispatch) and by the kernel
(dispatch only).  It can be used instead of pipe(2) in all cases where those
would simply be used to signal events.  Their kernel overhead is much lower
than pipes, and they do not consume two fds.  When used in the kernel, it 
can
offer an fd-bridge to enable, for example, functionalities like KAIO or
syslets/threadlets to signal to an fd the completion of certain operations.
But more in general, an eventfd can be used by the kernel to signal 
readiness,
in a POSIX poll/select way, of interfaces that would otherwise be 
incompatible
with it.  The API is:

int eventfd(unsigned int count);

The eventfd API accepts an initial count parameter, and returns an eventfd
fd.  It supports poll(2) (POLLIN, POLLOUT, POLLERR), read(2) and write(2).

The POLLIN flag is raised when the internal counter is greater than zero.

The POLLOUT flag is raised when at least a value of 1 can be written to 
the
internal counter.

The POLLERR flag is raised when an overflow in the counter value is 
detected.

The write(2) operation can never overflow the counter, since it blocks 
(unless
O_NONBLOCK is set, in which case -EAGAIN is returned).

But the eventfd_signal() function can do it, since it's supposed to not 
sleep
during its operation.

The read(2) function reads the __u64 counter value, and reset the internal
value to zero.  If the value read is equal to (__u64) -1, an overflow 
happened
on the internal counter (due to 2^64 eventfd_signal() posts that has never
been retired - unlickely, but possible).

The write(2) call writes an __u64 count value, and adds it to the current
counter.  The eventfd fd supports O_NONBLOCK also.

On the kernel side, we have:

struct file *eventfd_fget(int fd);
int eventfd_signal(struct file *file, unsigned int n);

The eventfd_fget() should be called to get a struct file* from an eventfd fd
(this is an fget() + check of f_op being an eventfd fops pointer).

The kernel can then call eventfd_signal() every time it wants to post an 
event
to userspace.  The eventfd_signal() function can be called from any context.
An eventfd() simple test and bench is available here:

http://www.xmailserver.org/eventfd-bench.c

This is the eventfd-based version of pipetest-4 (pipe(2) based):

http://www.xmailserver.org/pipetest-4.c

Not that performance matters much in the eventfd case, but eventfd-bench
shows almost as double as performance than pipetest-4.

[EMAIL PROTECTED]: fix i386 build]
[EMAIL PROTECTED]: add sys_eventfd to sys_ni.c]
Signed-off-by: Davide Libenzi [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 fs/Makefile  |1 +
 fs/eventfd.c |  228 ++
 include/linux/eventfd.h  |   29 ++
 include/linux/syscalls.h |1 +
 init/Kconfig |   10 ++
 kernel/sys_ni.c  |1 +
 6 files changed, 270 insertions(+), 0 deletions(-)

diff --git a/fs/Makefile b/fs/Makefile
index 39625da..720c29d 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_EPOLL)   += eventpoll.o
 obj-$(CONFIG_ANON_INODES)  += anon_inodes.o
 obj-$(CONFIG_SIGNALFD) += signalfd.o
 obj-$(CONFIG_TIMERFD)  += timerfd.o
+obj-$(CONFIG_EVENTFD)  += eventfd.o
 obj-$(CONFIG_COMPAT)   += compat.o compat_ioctl.o
 
 nfsd-$(CONFIG_NFSD):= nfsctl.o
diff --git a/fs/eventfd.c b/fs/eventfd.c
new file mode 100644
index 000..480e2b3
--- /dev/null
+++ b/fs/eventfd.c
@@ -0,0 +1,228 @@
+/*
+ *  fs/eventfd.c
+ *
+ *  Copyright (C) 2007  Davide Libenzi [EMAIL PROTECTED]
+ *
+ */
+
+#include linux/file.h
+#include linux/poll.h
+#include linux/init.h
+#include linux/fs.h
+#include linux/sched.h
+#include linux/kernel.h
+#include linux/list.h
+#include linux/spinlock.h
+#include linux/anon_inodes.h
+#include linux/eventfd.h
+
+struct eventfd_ctx {
+   spinlock_t lock;
+   wait_queue_head_t wqh;
+   /*
+* Every time that a write(2) is performed on an eventfd, the
+* value of the __u64 being written is added to count and a
+* wakeup is performed on wqh. A 

signal/timer/event: KAIO eventfd support example

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9c3060bedd84144653a2ad7bea32389f65598d40
Commit: 9c3060bedd84144653a2ad7bea32389f65598d40
Parent: fdb902b1225e1668315f38e96d2f439452c03a15
Author: Davide Libenzi [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:21 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:37 2007 -0700

signal/timer/event: KAIO eventfd support example

This is an example about how to add eventfd support to the current KAIO 
code,
in order to enable KAIO to post readiness events to a pollable fd (hence
compatible with POSIX select/poll).  The KAIO code simply signals the 
eventfd
fd when events are ready, and this triggers a POLLIN in the fd.  This patch
uses a reserved for future use member of the struct iocb to pass an eventfd
file descriptor, that KAIO will use to post events every time a request
completes.  At that point, an aio_getevents() will return the completed 
result
to a struct io_event.  I made a quick test program to verify the patch, and 
it
runs fine here:

http://www.xmailserver.org/eventfd-aio-test.c

The test program uses poll(2), but it'd, of course, work with select and 
epoll
too.

This can allow to schedule both block I/O and other poll-able devices
requests, and wait for results using select/poll/epoll.  In a typical
scenario, an application would submit KAIO request using aio_submit(), and
will also use epoll_ctl() on the whole other class of devices (that with the
addition of signals, timers and user events, now it's pretty much complete),
and then would:

epoll_wait(...);
for_each_event {
if (curr_event_is_kaiofd) {
aio_getevents();
dispatch_aio_events();
} else {
dispatch_epoll_event();
}
}

Signed-off-by: Davide Libenzi [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 fs/aio.c|   28 ++--
 include/linux/aio.h |6 ++
 include/linux/aio_abi.h |   18 +-
 3 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/fs/aio.c b/fs/aio.c
index ac1c158..dbe699e 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -30,6 +30,7 @@
 #include linux/highmem.h
 #include linux/workqueue.h
 #include linux/security.h
+#include linux/eventfd.h
 
 #include asm/kmap_types.h
 #include asm/uaccess.h
@@ -417,6 +418,7 @@ static struct kiocb fastcall *__aio_get_req(struct kioctx 
*ctx)
req-private = NULL;
req-ki_iovec = NULL;
INIT_LIST_HEAD(req-ki_run_list);
+   req-ki_eventfd = ERR_PTR(-EINVAL);
 
/* Check if the completion queue has enough free space to
 * accept an event from this io.
@@ -458,6 +460,8 @@ static inline void really_put_req(struct kioctx *ctx, 
struct kiocb *req)
 {
assert_spin_locked(ctx-ctx_lock);
 
+   if (!IS_ERR(req-ki_eventfd))
+   fput(req-ki_eventfd);
if (req-ki_dtor)
req-ki_dtor(req);
if (req-ki_iovec != req-ki_inline_vec)
@@ -942,6 +946,14 @@ int fastcall aio_complete(struct kiocb *iocb, long res, 
long res2)
return 1;
}
 
+   /*
+* Check if the user asked us to deliver the result through an
+* eventfd. The eventfd_signal() function is safe to be called
+* from IRQ context.
+*/
+   if (!IS_ERR(iocb-ki_eventfd))
+   eventfd_signal(iocb-ki_eventfd, 1);
+
info = ctx-ring_info;
 
/* add a completion event to the ring buffer.
@@ -1526,8 +1538,7 @@ int fastcall io_submit_one(struct kioctx *ctx, struct 
iocb __user *user_iocb,
ssize_t ret;
 
/* enforce forwards compatibility on users */
-   if (unlikely(iocb-aio_reserved1 || iocb-aio_reserved2 ||
-iocb-aio_reserved3)) {
+   if (unlikely(iocb-aio_reserved1 || iocb-aio_reserved2)) {
pr_debug(EINVAL: io_submit: reserve field set\n);
return -EINVAL;
}
@@ -1551,6 +1562,19 @@ int fastcall io_submit_one(struct kioctx *ctx, struct 
iocb __user *user_iocb,
fput(file);
return -EAGAIN;
}
+   if (iocb-aio_flags  IOCB_FLAG_RESFD) {
+   /*
+* If the IOCB_FLAG_RESFD flag of aio_flags is set, get an
+* instance of the file* now. The file descriptor must be
+* an eventfd() fd, and will be signaled for each completed
+* event using the eventfd_signal() function.
+*/
+   req-ki_eventfd = eventfd_fget((int) iocb-aio_resfd);
+   if (unlikely(IS_ERR(req-ki_eventfd))) {
+   ret = PTR_ERR(req-ki_eventfd);
+ 

epoll: use anonymous inodes

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=da66f7cb0f69ab27dbf5b9d0b85c4b97716c44d1
Commit: da66f7cb0f69ab27dbf5b9d0b85c4b97716c44d1
Parent: 9c3060bedd84144653a2ad7bea32389f65598d40
Author: Davide Libenzi [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:21 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:37 2007 -0700

epoll: use anonymous inodes

Cut out lots of code from epoll, by reusing the anonymous inode source
patch (fs/anon_inodes.c).

Signed-off-by: Davide Libenzi [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 fs/eventpoll.c |  172 +---
 1 files changed, 3 insertions(+), 169 deletions(-)

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index b5c7ca5..2831c8f 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -34,6 +34,7 @@
 #include linux/mount.h
 #include linux/bitops.h
 #include linux/mutex.h
+#include linux/anon_inodes.h
 #include asm/uaccess.h
 #include asm/system.h
 #include asm/io.h
@@ -75,8 +76,6 @@
  */
 
 
-#define EVENTPOLLFS_MAGIC 0x03111965 /* My birthday should work for this :) */
-
 #define DEBUG_EPOLL 0
 
 #if DEBUG_EPOLL  0
@@ -228,8 +227,6 @@ struct ep_pqueue {
 
 static void ep_poll_safewake_init(struct poll_safewake *psw);
 static void ep_poll_safewake(struct poll_safewake *psw, wait_queue_head_t *wq);
-static int ep_getfd(int *efd, struct inode **einode, struct file **efile,
-   struct eventpoll *ep);
 static int ep_alloc(struct eventpoll **pep);
 static void ep_free(struct eventpoll *ep);
 static struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd);
@@ -255,11 +252,6 @@ static int ep_events_transfer(struct eventpoll *ep,
  int maxevents);
 static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
   int maxevents, long timeout);
-static int eventpollfs_delete_dentry(struct dentry *dentry);
-static struct inode *ep_eventpoll_inode(void);
-static int eventpollfs_get_sb(struct file_system_type *fs_type,
- int flags, const char *dev_name,
- void *data, struct vfsmount *mnt);
 
 /*
  * This semaphore is used to serialize ep_free() and eventpoll_release_file().
@@ -275,30 +267,12 @@ static struct kmem_cache *epi_cache __read_mostly;
 /* Slab cache used to allocate struct eppoll_entry */
 static struct kmem_cache *pwq_cache __read_mostly;
 
-/* Virtual fs used to allocate inodes for eventpoll files */
-static struct vfsmount *eventpoll_mnt __read_mostly;
-
 /* File callbacks that implement the eventpoll file behaviour */
 static const struct file_operations eventpoll_fops = {
.release= ep_eventpoll_close,
.poll   = ep_eventpoll_poll
 };
 
-/*
- * This is used to register the virtual file system from where
- * eventpoll inodes are allocated.
- */
-static struct file_system_type eventpoll_fs_type = {
-   .name   = eventpollfs,
-   .get_sb = eventpollfs_get_sb,
-   .kill_sb= kill_anon_super,
-};
-
-/* Very basic directory entry operations for the eventpoll virtual file system 
*/
-static struct dentry_operations eventpollfs_dentry_operations = {
-   .d_delete   = eventpollfs_delete_dentry,
-};
-
 
 
 /* Fast test to see if the file is an evenpoll file */
@@ -495,7 +469,8 @@ asmlinkage long sys_epoll_create(int size)
 * Creates all the items needed to setup an eventpoll file. That is,
 * a file structure, and inode and a free file descriptor.
 */
-   error = ep_getfd(fd, inode, file, ep);
+   error = anon_inode_getfd(fd, inode, file, [eventpoll],
+eventpoll_fops, ep);
if (error)
goto eexit_2;
 
@@ -725,82 +700,6 @@ asmlinkage long sys_epoll_pwait(int epfd, struct 
epoll_event __user *events,
 #endif /* #ifdef TIF_RESTORE_SIGMASK */
 
 
-/*
- * Creates the file descriptor to be used by the epoll interface.
- */
-static int ep_getfd(int *efd, struct inode **einode, struct file **efile,
-   struct eventpoll *ep)
-{
-   struct qstr this;
-   char name[32];
-   struct dentry *dentry;
-   struct inode *inode;
-   struct file *file;
-   int error, fd;
-
-   /* Get an ready to use file */
-   error = -ENFILE;
-   file = get_empty_filp();
-   if (!file)
-   goto eexit_1;
-
-   /* Allocates an inode from the eventpoll file system */
-   inode = ep_eventpoll_inode();
-   if (IS_ERR(inode)) {
-   error = PTR_ERR(inode);
-   goto eexit_2;
-   }
-
-   /* Allocates a free descriptor to plug the file onto */
-   error = get_unused_fd();
-   if (error  0)
-   goto eexit_3;
-   fd = error;
-
-   /*
-* 

epoll cleanups: epoll no module

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cea69241870e55638156a026814551d6c575fd7f
Commit: cea69241870e55638156a026814551d6c575fd7f
Parent: da66f7cb0f69ab27dbf5b9d0b85c4b97716c44d1
Author: Davide Libenzi [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:22 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:37 2007 -0700

epoll cleanups: epoll no module

Epoll is either compiled it, or not (if EMBEDDED). Remove the module code
and use fs_initcall().

Signed-off-by: Davide Libenzi [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 fs/eventpoll.c |   14 +-
 1 files changed, 1 insertions(+), 13 deletions(-)

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 2831c8f..e224abf 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -11,7 +11,6 @@
  *
  */
 
-#include linux/module.h
 #include linux/init.h
 #include linux/kernel.h
 #include linux/sched.h
@@ -1471,16 +1470,5 @@ static int __init eventpoll_init(void)
 
return 0;
 }
+fs_initcall(eventpoll_init);
 
-
-static void __exit eventpoll_exit(void)
-{
-   /* Undo all operations done inside eventpoll_init() */
-   kmem_cache_destroy(pwq_cache);
-   kmem_cache_destroy(epi_cache);
-}
-
-module_init(eventpoll_init);
-module_exit(eventpoll_exit);
-
-MODULE_LICENSE(GPL);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


epoll cleanups: epoll remove static pre-declarations and akpm-ize the code

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7699acd1341c63fdbcfc56994fb2989ec59d2a43
Commit: 7699acd1341c63fdbcfc56994fb2989ec59d2a43
Parent: cea69241870e55638156a026814551d6c575fd7f
Author: Davide Libenzi [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:23 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:37 2007 -0700

epoll cleanups: epoll remove static pre-declarations and akpm-ize the code

Re-arrange epoll code to avoid static functions pre-declarations, and apply
akpm-filter on it.

Signed-off-by: Davide Libenzi [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 fs/eventpoll.c | 1034 ++--
 1 files changed, 486 insertions(+), 548 deletions(-)

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index e224abf..1aad34e 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -41,7 +41,6 @@
 #include asm/atomic.h
 #include asm/semaphore.h
 
-
 /*
  * LOCKING:
  * There are three level of locking required by epoll :
@@ -74,7 +73,6 @@
  * a greater scalability.
  */
 
-
 #define DEBUG_EPOLL 0
 
 #if DEBUG_EPOLL  0
@@ -104,7 +102,6 @@
 
 #define EP_MAX_EVENTS (INT_MAX / sizeof(struct epoll_event))
 
-
 struct epoll_filefd {
struct file *file;
int fd;
@@ -222,36 +219,6 @@ struct ep_pqueue {
struct epitem *epi;
 };
 
-
-
-static void ep_poll_safewake_init(struct poll_safewake *psw);
-static void ep_poll_safewake(struct poll_safewake *psw, wait_queue_head_t *wq);
-static int ep_alloc(struct eventpoll **pep);
-static void ep_free(struct eventpoll *ep);
-static struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd);
-static void ep_use_epitem(struct epitem *epi);
-static void ep_release_epitem(struct epitem *epi);
-static void ep_ptable_queue_proc(struct file *file, wait_queue_head_t *whead,
-poll_table *pt);
-static void ep_rbtree_insert(struct eventpoll *ep, struct epitem *epi);
-static int ep_insert(struct eventpoll *ep, struct epoll_event *event,
-struct file *tfile, int fd);
-static int ep_modify(struct eventpoll *ep, struct epitem *epi,
-struct epoll_event *event);
-static void ep_unregister_pollwait(struct eventpoll *ep, struct epitem *epi);
-static int ep_unlink(struct eventpoll *ep, struct epitem *epi);
-static int ep_remove(struct eventpoll *ep, struct epitem *epi);
-static int ep_poll_callback(wait_queue_t *wait, unsigned mode, int sync, void 
*key);
-static int ep_eventpoll_close(struct inode *inode, struct file *file);
-static unsigned int ep_eventpoll_poll(struct file *file, poll_table *wait);
-static int ep_send_events(struct eventpoll *ep, struct list_head *txlist,
- struct epoll_event __user *events, int maxevents);
-static int ep_events_transfer(struct eventpoll *ep,
- struct epoll_event __user *events,
- int maxevents);
-static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
-  int maxevents, long timeout);
-
 /*
  * This semaphore is used to serialize ep_free() and eventpoll_release_file().
  */
@@ -266,19 +233,6 @@ static struct kmem_cache *epi_cache __read_mostly;
 /* Slab cache used to allocate struct eppoll_entry */
 static struct kmem_cache *pwq_cache __read_mostly;
 
-/* File callbacks that implement the eventpoll file behaviour */
-static const struct file_operations eventpoll_fops = {
-   .release= ep_eventpoll_close,
-   .poll   = ep_eventpoll_poll
-};
-
-
-
-/* Fast test to see if the file is an evenpoll file */
-static inline int is_file_epoll(struct file *f)
-{
-   return f-f_op == eventpoll_fops;
-}
 
 /* Setup the structure that is used as key for the rb-tree */
 static inline void ep_set_ffd(struct epoll_filefd *ffd,
@@ -347,7 +301,6 @@ static void ep_poll_safewake_init(struct poll_safewake *psw)
spin_lock_init(psw-lock);
 }
 
-
 /*
  * Perform a safe wake up of the poll wait list. The problem is that
  * with the new callback'd wake up system, it is possible that the
@@ -402,325 +355,145 @@ static void ep_poll_safewake(struct poll_safewake *psw, 
wait_queue_head_t *wq)
spin_unlock_irqrestore(psw-lock, flags);
 }
 
-
 /*
- * This is called from eventpoll_release() to unlink files from the eventpoll
- * interface. We need to have this facility to cleanup correctly files that are
- * closed without being removed from the eventpoll interface.
+ * This function unregister poll callbacks from the associated file descriptor.
+ * Since this must be called without holding ep-lock the atomic exchange 
trick
+ * will protect us from multiple unregister.
  */
-void eventpoll_release_file(struct file *file)
+static void ep_unregister_pollwait(struct eventpoll *ep, struct epitem *epi)
 {
-   

fbdev: geforce 7300 cleanup

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e98e267c6f76f509cea4b4022ca502b1aa221d77
Commit: e98e267c6f76f509cea4b4022ca502b1aa221d77
Parent: 7699acd1341c63fdbcfc56994fb2989ec59d2a43
Author: Michal Piotrowski [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:24 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:37 2007 -0700

fbdev: geforce 7300 cleanup

ups... coding style.

Signed-off-by: Michal Piotrowski [EMAIL PROTECTED]
Cc: Antonino A. Daplas [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/video/nvidia/nv_hw.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/video/nvidia/nv_hw.c b/drivers/video/nvidia/nv_hw.c
index c627955..aff11bb 100644
--- a/drivers/video/nvidia/nv_hw.c
+++ b/drivers/video/nvidia/nv_hw.c
@@ -149,7 +149,9 @@ static void nvGetClocks(struct nvidia_par *par, unsigned 
int *MClk,
pll = NV_RD32(par-PMC, 0x4024);
M = pll  0xFF;
N = (pll  8)  0xFF;
-   if (((par-Chipset  0xfff0) == 0x0290) || ((par-Chipset  
0xfff0) == 0x0390) || ((par-Chipset  0xfff0) == 0x02E0)) {
+   if (((par-Chipset  0xfff0) == 0x0290) ||
+   ((par-Chipset  0xfff0) == 0x0390) ||
+   ((par-Chipset  0xfff0) == 0x02E0)) {
MB = 1;
NB = 1;
} else {
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


rivafb: Fix I2C getscl callback function

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=213b8a9af600316902e08e010fbcd216e42e41f7
Commit: 213b8a9af600316902e08e010fbcd216e42e41f7
Parent: 14340586148e7c88d7b1b752876f5b5227b200b9
Author: Jean Delvare [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:28 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:37 2007 -0700

rivafb: Fix I2C getscl callback function

Fix rivafb's I2C getscl callback function, as was done in nvidiafb recently.

Signed-off-by: Jean Delvare [EMAIL PROTECTED]
Signed-off-by: Antonino Daplas [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/video/riva/rivafb-i2c.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/video/riva/rivafb-i2c.c b/drivers/video/riva/rivafb-i2c.c
index 76e6ce3..a0e22ac 100644
--- a/drivers/video/riva/rivafb-i2c.c
+++ b/drivers/video/riva/rivafb-i2c.c
@@ -70,8 +70,6 @@ static int riva_gpio_getscl(void* data)
if (VGA_RD08(par-riva.PCIO, 0x3d5)  0x04)
val = 1;
 
-   val = VGA_RD08(par-riva.PCIO, 0x3d5);
-
return val;
 }
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


atmel_lcdfb: AT91/AT32 LCD Controller framebuffer driver

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=14340586148e7c88d7b1b752876f5b5227b200b9
Commit: 14340586148e7c88d7b1b752876f5b5227b200b9
Parent: f23a06f076173c1f56572556169bf9e1793c5d59
Author: Nicolas Ferre [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:26 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:37 2007 -0700

atmel_lcdfb: AT91/AT32 LCD Controller framebuffer driver

Adds a framebuffer driver to ATMEL AT91SAM9x and AT32 aka AVR32 platforms.
Those chips share quite the same IP and this code is suitable for both
architectures.

Signed-off-by: Nicolas Ferre [EMAIL PROTECTED]
Signed-off-by: Antonino Daplas [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/video/Kconfig   |   16 +
 drivers/video/Makefile  |1 +
 drivers/video/atmel_lcdfb.c |  752 +++
 include/video/atmel_lcdc.h  |  196 +++
 4 files changed, 965 insertions(+), 0 deletions(-)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 5511a8f..13bcead 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -748,6 +748,22 @@ config FB_S1D13XXX
  working with S1D13806). Product specs at
  http://www.erd.epson.com/vdc/html/legacy_13xxx.htm
 
+config FB_ATMEL
+   tristate AT91/AT32 LCD Controller support
+   depends on FB  (ARCH_AT91SAM9261 || ARCH_AT91SAM9263 || AVR32)
+   select FB_CFB_FILLRECT
+   select FB_CFB_COPYAREA
+   select FB_CFB_IMAGEBLIT
+   help
+ This enables support for the AT91/AT32 LCD Controller.
+
+config FB_INTSRAM
+   bool Frame Buffer in internal SRAM
+   depends on FB_ATMEL  ARCH_AT91SAM9261
+   help
+ Say Y if you want to map Frame Buffer in internal SRAM. Say N if you 
want
+ to let frame buffer in external SDRAM.
+
 config FB_NVIDIA
tristate nVidia Framebuffer Support
depends on FB  PCI
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 0b70567..bd8b052 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -87,6 +87,7 @@ obj-$(CONFIG_FB_G364) += g364fb.o
 obj-$(CONFIG_FB_SA1100)   += sa1100fb.o
 obj-$(CONFIG_FB_HIT)  += hitfb.o
 obj-$(CONFIG_FB_EPSON1355)   += epson1355fb.o
+obj-$(CONFIG_FB_ATMEL)   += atmel_lcdfb.o
 obj-$(CONFIG_FB_PVR2) += pvr2fb.o
 obj-$(CONFIG_FB_VOODOO1)  += sstfb.o
 obj-$(CONFIG_FB_ARMCLCD) += amba-clcd.o
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
new file mode 100644
index 000..e1d5bd0
--- /dev/null
+++ b/drivers/video/atmel_lcdfb.c
@@ -0,0 +1,752 @@
+/*
+ *  Driver for AT91/AT32 LCD Controller
+ *
+ *  Copyright (C) 2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive for
+ * more details.
+ */
+
+#include linux/kernel.h
+#include linux/platform_device.h
+#include linux/dma-mapping.h
+#include linux/interrupt.h
+#include linux/clk.h
+#include linux/fb.h
+#include linux/init.h
+#include linux/delay.h
+
+#include asm/arch/board.h
+#include asm/arch/cpu.h
+#include asm/arch/gpio.h
+
+#include video/atmel_lcdc.h
+
+#define lcdc_readl(sinfo, reg) __raw_readl((sinfo)-mmio+(reg))
+#define lcdc_writel(sinfo, reg, val)   __raw_writel((val), (sinfo)-mmio+(reg))
+
+/* configurable parameters */
+#define ATMEL_LCDC_CVAL_DEFAULT0xc8
+#define ATMEL_LCDC_DMA_BURST_LEN   8
+
+#if defined(CONFIG_ARCH_AT91SAM9263)
+#define ATMEL_LCDC_FIFO_SIZE   2048
+#else
+#define ATMEL_LCDC_FIFO_SIZE   512
+#endif
+
+#if defined(CONFIG_ARCH_AT91)
+#defineATMEL_LCDFB_FBINFO_DEFAULT  FBINFO_DEFAULT
+
+static inline void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info *sinfo,
+   struct fb_var_screeninfo *var)
+{
+
+}
+#elif defined(CONFIG_AVR32)
+#defineATMEL_LCDFB_FBINFO_DEFAULT  (FBINFO_DEFAULT \
+   | FBINFO_PARTIAL_PAN_OK \
+   | FBINFO_HWACCEL_XPAN \
+   | FBINFO_HWACCEL_YPAN)
+
+static void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info *sinfo,
+struct fb_var_screeninfo *var)
+{
+   u32 dma2dcfg;
+   u32 pixeloff;
+
+   pixeloff = (var-xoffset * var-bits_per_pixel)  0x1f;
+
+   dma2dcfg = ((var-xres_virtual - var-xres) * var-bits_per_pixel) / 8;
+   dma2dcfg |= pixeloff  ATMEL_LCDC_PIXELOFF_OFFSET;
+   lcdc_writel(sinfo, ATMEL_LCDC_DMA2DCFG, dma2dcfg);
+
+   /* Update configuration */
+   lcdc_writel(sinfo, ATMEL_LCDC_DMACON,
+   lcdc_readl(sinfo, ATMEL_LCDC_DMACON)
+   | 

nvidiafb: Enable debugging messages a Kconfig option

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=647f2e7aeef833272c17a5366680321c3def3f23
Commit: 647f2e7aeef833272c17a5366680321c3def3f23
Parent: 213b8a9af600316902e08e010fbcd216e42e41f7
Author: Jean Delvare [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:29 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:37 2007 -0700

nvidiafb: Enable debugging messages a Kconfig option

Let the user enable debugging messages in nvidiafb.

Signed-off-by: Jean Delvare [EMAIL PROTECTED]
Signed-off-by: Antonino Daplas [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/video/Kconfig |   11 ++-
 drivers/video/nvidia/nvidia.c |1 -
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 13bcead..eebcb70 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -796,6 +796,15 @@ config FB_NVIDIA_I2C
  independently validate video mode parameters, you should say Y
  here.
 
+config FB_NVIDIA_DEBUG
+   bool Lots of debug output
+   depends on FB_NVIDIA
+   default n
+   help
+ Say Y here if you want the nVidia driver to output all sorts
+ of debugging information to provide to the maintainer when
+ something goes wrong.
+
 config FB_NVIDIA_BACKLIGHT
bool Support for backlight control
depends on FB_NVIDIA
@@ -835,7 +844,7 @@ config FB_RIVA_I2C
  here.
 
 config FB_RIVA_DEBUG
-   bool Lots of debug output from Riva(nVidia) driver
+   bool Lots of debug output
depends on FB_RIVA
default n
help
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index f85edf0..41f6365 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -37,7 +37,6 @@
 #include nv_proto.h
 #include nv_dma.h
 
-#undef CONFIG_FB_NVIDIA_DEBUG
 #ifdef CONFIG_FB_NVIDIA_DEBUG
 #define NVTRACE  printk
 #else
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


pm2fb: fb_sync added

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=03b9ae4b80dd5b20d7bf7e15902592d50c66780d
Commit: 03b9ae4b80dd5b20d7bf7e15902592d50c66780d
Parent: 647f2e7aeef833272c17a5366680321c3def3f23
Author: Antonino A. Daplas [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:29 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:37 2007 -0700

pm2fb: fb_sync added

Convert internal wait_pm2() function to fb API fb_sync() method.

Signed-off-by: Krzysztof Helt [EMAIL PROTECTED]
Signed-off-by: Antonino Daplas [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/video/pm2fb.c |   38 +-
 1 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c
index 1ac5264..ab5e668 100644
--- a/drivers/video/pm2fb.c
+++ b/drivers/video/pm2fb.c
@@ -204,17 +204,6 @@ static inline void WAIT_FIFO(struct pm2fb_par* p, u32 a)
 }
 #endif
 
-static void wait_pm2(struct pm2fb_par* par) {
-
-   WAIT_FIFO(par, 1);
-   pm2_WR(par, PM2R_SYNC, 0);
-   mb();
-   do {
-   while (pm2_RD(par, PM2R_OUT_FIFO_WORDS) == 0);
-   rmb();
-   } while (pm2_RD(par, PM2R_OUT_FIFO) != PM2TAG(PM2R_SYNC));
-}
-
 /*
  * partial products for the supported horizontal resolutions.
  */
@@ -1050,13 +1039,30 @@ static int pm2fb_blank(int blank_mode, struct fb_info 
*info)
return 0;
 }
 
+static int pm2fb_sync(struct fb_info *info)
+{
+   struct pm2fb_par *par = info-par;
+
+   WAIT_FIFO(par, 1);
+   pm2_WR(par, PM2R_SYNC, 0);
+   mb();
+   do {
+   while (pm2_RD(par, PM2R_OUT_FIFO_WORDS) == 0)
+   udelay(10);
+   rmb();
+   } while (pm2_RD(par, PM2R_OUT_FIFO) != PM2TAG(PM2R_SYNC));
+
+   return 0;
+}
+
 /*
  * block operation. copy=0: rectangle fill, copy=1: rectangle copy.
  */
-static void pm2fb_block_op(struct pm2fb_par* par, int copy,
+static void pm2fb_block_op(struct fb_info* info, int copy,
s32 xsrc, s32 ysrc,
s32 x, s32 y, s32 w, s32 h,
u32 color) {
+   struct pm2fb_par *par = info-par;
 
if (!w || !h)
return;
@@ -1076,13 +1082,11 @@ static void pm2fb_block_op(struct pm2fb_par* par, int 
copy,
(xxsrc ? PM2F_INCREASE_X : 0) |
(yysrc ? PM2F_INCREASE_Y : 0) |
(copy ? 0 : PM2F_RENDER_FASTFILL));
-   wait_pm2(par);
 }
 
 static void pm2fb_fillrect (struct fb_info *info,
const struct fb_fillrect *region)
 {
-   struct pm2fb_par *par = info-par;
struct fb_fillrect modded;
int vxres, vyres;
u32 color = (info-fix.visual == FB_VISUAL_TRUECOLOR) ?
@@ -1116,7 +1120,7 @@ static void pm2fb_fillrect (struct fb_info *info,
color |= color  16;
 
if(info-var.bits_per_pixel != 24)
-   pm2fb_block_op(par, 0, 0, 0,
+   pm2fb_block_op(info, 0, 0, 0,
modded.dx, modded.dy,
modded.width, modded.height, color);
else
@@ -1126,7 +1130,6 @@ static void pm2fb_fillrect (struct fb_info *info,
 static void pm2fb_copyarea(struct fb_info *info,
const struct fb_copyarea *area)
 {
-   struct pm2fb_par *par = info-par;
struct fb_copyarea modded;
u32 vxres, vyres;
 
@@ -1156,7 +1159,7 @@ static void pm2fb_copyarea(struct fb_info *info,
if(modded.dy + modded.height  vyres)
modded.height = vyres - modded.dy;
 
-   pm2fb_block_op(par, 1, modded.sx, modded.sy,
+   pm2fb_block_op(info, 1, modded.sx, modded.sy,
modded.dx, modded.dy,
modded.width, modded.height, 0);
 }
@@ -1177,6 +1180,7 @@ static struct fb_ops pm2fb_ops = {
.fb_fillrect= pm2fb_fillrect,
.fb_copyarea= pm2fb_copyarea,
.fb_imageblit   = cfb_imageblit,
+   .fb_sync= pm2fb_sync,
 };
 
 /*
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


VIDEO: remove archaic if[] construct from Kconfig file

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=11fe250d89cdce3d6bb43bd674f3dcdcaa78dbc8
Commit: 11fe250d89cdce3d6bb43bd674f3dcdcaa78dbc8
Parent: 03b9ae4b80dd5b20d7bf7e15902592d50c66780d
Author: Robert P. J. Day [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:30 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:37 2007 -0700

VIDEO: remove archaic if[] construct from Kconfig file

Remove the obsolete if [ ] construct from the video console Kconfig
file.

Signed-off-by: Robert P. J. Day [EMAIL PROTECTED]
Acked-by: James Simmons [EMAIL PROTECTED]
Cc: Antonino A. Daplas [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/video/console/Kconfig |7 ---
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index aa3935d..63b85bf 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -19,13 +19,6 @@ config VGA_CONSOLE
 
  Say Y.
 
-#  if [ $CONFIG_PCI = y -a $CONFIG_VGA_CONSOLE = y ]; then
-# bool '   Allow VGA on any bus?' CONFIG_VGA_HOSE
-# if [ $CONFIG_VGA_HOSE = y ]; then
-#define_bool CONFIG_DUMMY_CONSOLE y
-# fi
-#  fi
-
 config VGACON_SOFT_SCROLLBACK
bool Enable Scrollback Buffer in System RAM
depends on VGA_CONSOLE
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


md: improve the is_mddev_idle test

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=435b71be20f2ad3688acd94c05e968e029464d60
Commit: 435b71be20f2ad3688acd94c05e968e029464d60
Parent: 11fe250d89cdce3d6bb43bd674f3dcdcaa78dbc8
Author: NeilBrown [EMAIL PROTECTED]
AuthorDate: Thu May 10 22:23:31 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 08:29:37 2007 -0700

md: improve the is_mddev_idle test

During a 'resync' or similar activity, md checks if the devices in the
array are otherwise active and winds back resync activity when they are.
This test in done in is_mddev_idle, and it is somewhat fragile - it
sometimes thinks there is non-sync io when there isn't.

The test compares the total sectors of io (disk_stat_read) with the sectors
of resync io (disk-sync_io).  This has problems because total sectors gets
updated when a request completes, while resync io gets updated when the
request is submitted.  The time difference can cause large differenced
between the two which do not actually imply non-resync activity.  The test
currently allows for some fuzz (+/- 4096) but there are some cases when it
is not enough.

The test currently looks for any (non-fuzz) difference, either positive or
negative.  This clearly is not needed.  Any non-sync activity will cause
the total sectors to grow faster than the sync_io count (never slower) so
we only need to look for a positive differences.

If we do this then the amount of in-flight sync io will never cause the
appearance of non-sync IO.  Once enough non-sync IO to worry about starts
happening, resync will be slowed down and the measurements will thus be
more precise (as there is less in-flight) and control of resync will still
be suitably responsive.

Signed-off-by: Neil Brown [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/md/md.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 65814b0..c10ce91 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5103,7 +5103,7 @@ static int is_mddev_idle(mddev_t *mddev)
 *
 * Note: the following is an unsigned comparison.
 */
-   if ((curr_events - rdev-last_events + 4096)  8192) {
+   if ((long)curr_events - (long)rdev-last_events  4096) {
rdev-last_events = curr_events;
idle = 0;
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Input: evdev - fix overflow in compat_ioctl

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bf61f8d357e5d71d74a3ca3be3cce52bf1a2c01a
Commit: bf61f8d357e5d71d74a3ca3be3cce52bf1a2c01a
Parent: 435b71be20f2ad3688acd94c05e968e029464d60
Author: Kenichi Nagai [EMAIL PROTECTED]
AuthorDate: Fri May 11 01:12:15 2007 -0400
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Fri May 11 09:08:04 2007 -0700

Input: evdev - fix overflow in compat_ioctl

When exporting input device bitmaps via compat_ioctl on BIG_ENDIAN
platforms evdev calculates data size incorrectly. This causes buffer
overflow if user specifies buffer smaller than maxlen.

Signed-off-by: Kenichi Nagai [EMAIL PROTECTED]
Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/input/evdev.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 55a7259..b234729 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -336,7 +336,7 @@ static int bits_to_user(unsigned long *bits, unsigned int 
maxbit,
 
if (compat) {
len = NBITS_COMPAT(maxbit) * sizeof(compat_long_t);
-   if (len  maxlen)
+   if (len  maxlen)
len = maxlen;
 
for (i = 0; i  len / sizeof(compat_long_t); i++)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Bluetooth] Switch to using input_dev-dev.parent

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5be3946647424b08db0f62c545215cf506af8a52
Commit: 5be3946647424b08db0f62c545215cf506af8a52
Parent: 129a84de2347002f09721cda3155ccfd19fade40
Author: Marcel Holtmann [EMAIL PROTECTED]
AuthorDate: Wed May 9 09:15:30 2007 +0200
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:45:03 2007 -0700

[Bluetooth] Switch to using input_dev-dev.parent

In preparation for struct class_device - struct device input core
conversion, switch to using input_dev-dev.parent when specifying
device position in sysfs tree.

Also, do not access input_dev-private directly, use helpers and
do not use kfree() on input device, use input_free_device() instead.

Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED]
Signed-off-by: Marcel Holtmann [EMAIL PROTECTED]
---
 net/bluetooth/hidp/core.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index d342e89..0ea40ab 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -174,7 +174,7 @@ static inline int hidp_queue_event(struct hidp_session 
*session, struct input_de
 
 static int hidp_hidinput_event(struct input_dev *dev, unsigned int type, 
unsigned int code, int value)
 {
-   struct hid_device *hid = dev-private;
+   struct hid_device *hid = input_get_drvdata(dev);
struct hidp_session *session = hid-driver_data;
 
return hidp_queue_event(session, dev, type, code, value);
@@ -182,7 +182,7 @@ static int hidp_hidinput_event(struct input_dev *dev, 
unsigned int type, unsigne
 
 static int hidp_input_event(struct input_dev *dev, unsigned int type, unsigned 
int code, int value)
 {
-   struct hidp_session *session = dev-private;
+   struct hidp_session *session = input_get_drvdata(dev);
 
return hidp_queue_event(session, dev, type, code, value);
 }
@@ -630,7 +630,7 @@ static inline void hidp_setup_input(struct hidp_session 
*session, struct hidp_co
struct input_dev *input = session-input;
int i;
 
-   input-private = session;
+   input_set_drvdata(input, session);
 
input-name = Bluetooth HID Boot Protocol Device;
 
@@ -663,7 +663,7 @@ static inline void hidp_setup_input(struct hidp_session 
*session, struct hidp_co
input-relbit[0] |= BIT(REL_WHEEL);
}
 
-   input-cdev.dev = hidp_get_device(session);
+   input-dev.parent = hidp_get_device(session);
 
input-event = hidp_input_event;
 
@@ -864,7 +864,7 @@ failed:
if (session-hid)
hid_free_device(session-hid);
 
-   kfree(session-input);
+   input_free_device(session-input);
kfree(session);
return err;
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Bluetooth] Add HCIUARTGETDEVICE support for HCI line discipline

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d215874460e7657b8e104de024140e0932690450
Commit: d215874460e7657b8e104de024140e0932690450
Parent: 5be3946647424b08db0f62c545215cf506af8a52
Author: Marcel Holtmann [EMAIL PROTECTED]
AuthorDate: Wed May 9 09:15:35 2007 +0200
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:45:04 2007 -0700

[Bluetooth] Add HCIUARTGETDEVICE support for HCI line discipline

Adding HCIUARTGETDEVICE makes it possible to get the HCI device number
that is attached to a given serial device. This is required during the
initialization process of some Bluetooth chips.

Signed-off-by: Ohad Ben-Cohen [EMAIL PROTECTED]
Signed-off-by: Marcel Holtmann [EMAIL PROTECTED]
---
 drivers/bluetooth/hci_ldisc.c |5 +
 drivers/bluetooth/hci_uart.h  |5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 0f4203b..75c1508 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -479,6 +479,11 @@ static int hci_uart_tty_ioctl(struct tty_struct *tty, 
struct file * file,
return hu-proto-id;
return -EUNATCH;
 
+   case HCIUARTGETDEVICE:
+   if (test_bit(HCI_UART_PROTO_SET, hu-flags))
+   return hu-hdev-id;
+   return -EUNATCH;
+
default:
err = n_tty_ioctl(tty, file, cmd, arg);
break;
diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h
index b250e67..1097ce7 100644
--- a/drivers/bluetooth/hci_uart.h
+++ b/drivers/bluetooth/hci_uart.h
@@ -28,8 +28,9 @@
 #endif
 
 /* Ioctls */
-#define HCIUARTSETPROTO_IOW('U', 200, int)
-#define HCIUARTGETPROTO_IOR('U', 201, int)
+#define HCIUARTSETPROTO_IOW('U', 200, int)
+#define HCIUARTGETPROTO_IOR('U', 201, int)
+#define HCIUARTGETDEVICE   _IOR('U', 202, int)
 
 /* UART protocols */
 #define HCI_UART_MAX_PROTO 4
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Bluetooth] Fix NULL pointer dereference in HCI line discipline

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=22ad42033b7d2b3d7928fba9f89d1c7f8a3c9581
Commit: 22ad42033b7d2b3d7928fba9f89d1c7f8a3c9581
Parent: d215874460e7657b8e104de024140e0932690450
Author: Marcel Holtmann [EMAIL PROTECTED]
AuthorDate: Wed May 9 09:15:40 2007 +0200
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:45:05 2007 -0700

[Bluetooth] Fix NULL pointer dereference in HCI line discipline

Normally a serial Bluetooth device is opened, TIOSETD'ed to N_HCI line
discipline, HCIUARTSETPROTO'ed and finally closed. In case the device
fails to HCIUARTSETPROTO, closing it produces a NULL pointer dereference.

Signed-off-by: Ohad Ben-Cohen [EMAIL PROTECTED]
Signed-off-by: Marcel Holtmann [EMAIL PROTECTED]
---
 drivers/bluetooth/hci_ldisc.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 75c1508..e8ae0d7 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -307,7 +307,9 @@ static void hci_uart_tty_close(struct tty_struct *tty)
 
if (hu) {
struct hci_dev *hdev = hu-hdev;
-   hci_uart_close(hdev);
+
+   if (hdev)
+   hci_uart_close(hdev);
 
if (test_and_clear_bit(HCI_UART_PROTO_SET, hu-flags)) {
hu-proto-close(hu);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Bluetooth] Fix unintentional fall-through in HCI line discipline

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c33be3c362f1bc98f6e2d731a274ef138ae80741
Commit: c33be3c362f1bc98f6e2d731a274ef138ae80741
Parent: 22ad42033b7d2b3d7928fba9f89d1c7f8a3c9581
Author: Marcel Holtmann [EMAIL PROTECTED]
AuthorDate: Wed May 9 09:15:45 2007 +0200
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:45:06 2007 -0700

[Bluetooth] Fix unintentional fall-through in HCI line discipline

A trivial fix to (what looks like) an unintentional fall-through in the
HCI line discipline.

Signed-off-by: Ohad Ben-Cohen [EMAIL PROTECTED]
Signed-off-by: Marcel Holtmann [EMAIL PROTECTED]
---
 drivers/bluetooth/hci_ldisc.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index e8ae0d7..6055b9c 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -475,6 +475,7 @@ static int hci_uart_tty_ioctl(struct tty_struct *tty, 
struct file * file,
tty-low_latency = 1;
} else
return -EBUSY;
+   break;
 
case HCIUARTGETPROTO:
if (test_bit(HCI_UART_PROTO_SET, hu-flags))
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NET] link_watch: Move link watch list into net_device

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=572a103ded0ad880f75ce83e99f0512fbb80b5b0
Commit: 572a103ded0ad880f75ce83e99f0512fbb80b5b0
Parent: c33be3c362f1bc98f6e2d731a274ef138ae80741
Author: Herbert Xu [EMAIL PROTECTED]
AuthorDate: Tue May 8 18:34:17 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:45:07 2007 -0700

[NET] link_watch: Move link watch list into net_device

These days the link watch mechanism is an integral part of the
network subsystem as it manages the carrier status.  So it now
makes sense to allocate some memory for it in net_device rather
than allocating it on demand.

In fact, this is necessary because we can't tolerate a memory
allocation failure since that means we'd have to potentially
throw a link up event away.

It also simplifies the code greatly.

In doing so I discovered a subtle race condition in the use
of singleevent.  This race condition still exists (and is
somewhat magnified) without singleevent but it's now plugged
thanks to an smp_mb__before_clear_bit.

Signed-off-by: Herbert Xu [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/linux/netdevice.h |2 +
 net/core/link_watch.c |   50 +---
 2 files changed, 17 insertions(+), 35 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 3044622..f671cd2 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -467,6 +467,8 @@ struct net_device
/* device index hash chain */
struct hlist_node   index_hlist;
 
+   struct net_device   *link_watch_next;
+
/* register/unregister state machine */
enum { NETREG_UNINITIALIZED=0,
   NETREG_REGISTERED,   /* completed register_netdevice */
diff --git a/net/core/link_watch.c b/net/core/link_watch.c
index e3c26a9..71a35da 100644
--- a/net/core/link_watch.c
+++ b/net/core/link_watch.c
@@ -19,7 +19,6 @@
 #include linux/rtnetlink.h
 #include linux/jiffies.h
 #include linux/spinlock.h
-#include linux/list.h
 #include linux/slab.h
 #include linux/workqueue.h
 #include linux/bitops.h
@@ -28,7 +27,6 @@
 
 enum lw_bits {
LW_RUNNING = 0,
-   LW_SE_USED
 };
 
 static unsigned long linkwatch_flags;
@@ -37,17 +35,9 @@ static unsigned long linkwatch_nextevent;
 static void linkwatch_event(struct work_struct *dummy);
 static DECLARE_DELAYED_WORK(linkwatch_work, linkwatch_event);
 
-static LIST_HEAD(lweventlist);
+static struct net_device *lweventlist;
 static DEFINE_SPINLOCK(lweventlist_lock);
 
-struct lw_event {
-   struct list_head list;
-   struct net_device *dev;
-};
-
-/* Avoid kmalloc() for most systems */
-static struct lw_event singleevent;
-
 static unsigned char default_operstate(const struct net_device *dev)
 {
if (!netif_carrier_ok(dev))
@@ -90,21 +80,23 @@ static void rfc2863_policy(struct net_device *dev)
 /* Must be called with the rtnl semaphore held */
 void linkwatch_run_queue(void)
 {
-   struct list_head head, *n, *next;
+   struct net_device *next;
 
spin_lock_irq(lweventlist_lock);
-   list_replace_init(lweventlist, head);
+   next = lweventlist;
+   lweventlist = NULL;
spin_unlock_irq(lweventlist_lock);
 
-   list_for_each_safe(n, next, head) {
-   struct lw_event *event = list_entry(n, struct lw_event, list);
-   struct net_device *dev = event-dev;
+   while (next) {
+   struct net_device *dev = next;
 
-   if (event == singleevent) {
-   clear_bit(LW_SE_USED, linkwatch_flags);
-   } else {
-   kfree(event);
-   }
+   next = dev-link_watch_next;
+
+   /*
+* Make sure the above read is complete since it can be
+* rewritten as soon as we clear the bit below.
+*/
+   smp_mb__before_clear_bit();
 
/* We are about to handle this device,
 * so new events can be accepted
@@ -147,24 +139,12 @@ void linkwatch_fire_event(struct net_device *dev)
 {
if (!test_and_set_bit(__LINK_STATE_LINKWATCH_PENDING, dev-state)) {
unsigned long flags;
-   struct lw_event *event;
-
-   if (test_and_set_bit(LW_SE_USED, linkwatch_flags)) {
-   event = kmalloc(sizeof(struct lw_event), GFP_ATOMIC);
-
-   if (unlikely(event == NULL)) {
-   clear_bit(__LINK_STATE_LINKWATCH_PENDING, 
dev-state);
-   return;
-   }
-   } else {
-   event = singleevent;
-   }
 
dev_hold(dev);
-   event-dev = dev;
 

[NET]: Remove link_watch delay for up even when we're down

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=294cc44b7e48a6e7732499eebcf409b231460d8e
Commit: 294cc44b7e48a6e7732499eebcf409b231460d8e
Parent: 572a103ded0ad880f75ce83e99f0512fbb80b5b0
Author: Herbert Xu [EMAIL PROTECTED]
AuthorDate: Tue May 8 18:36:28 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:45:08 2007 -0700

[NET]: Remove link_watch delay for up even when we're down

Currently all link carrier events are delayed by up to a second
before they're processed to prevent link storms.  This causes
unnecessary packet loss during that interval.

In fact, we can achieve the same effect in preventing storms by
only delaying down events and unnecssary up events.  The latter
is defined as up events when we're already up.

Signed-off-by: Herbert Xu [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/core/link_watch.c |   90 
 1 files changed, 67 insertions(+), 23 deletions(-)

diff --git a/net/core/link_watch.c b/net/core/link_watch.c
index 71a35da..b5f4579 100644
--- a/net/core/link_watch.c
+++ b/net/core/link_watch.c
@@ -77,11 +77,52 @@ static void rfc2863_policy(struct net_device *dev)
 }
 
 
-/* Must be called with the rtnl semaphore held */
-void linkwatch_run_queue(void)
+static int linkwatch_urgent_event(struct net_device *dev)
+{
+   return netif_running(dev)  netif_carrier_ok(dev) 
+  dev-qdisc != dev-qdisc_sleeping;
+}
+
+
+static void linkwatch_add_event(struct net_device *dev)
+{
+   unsigned long flags;
+
+   spin_lock_irqsave(lweventlist_lock, flags);
+   dev-link_watch_next = lweventlist;
+   lweventlist = dev;
+   spin_unlock_irqrestore(lweventlist_lock, flags);
+}
+
+
+static void linkwatch_schedule_work(unsigned long delay)
+{
+   if (test_and_set_bit(LW_RUNNING, linkwatch_flags))
+   return;
+
+   /* If we wrap around we'll delay it by at most HZ. */
+   if (delay  HZ)
+   delay = 0;
+
+   schedule_delayed_work(linkwatch_work, delay);
+}
+
+
+static void __linkwatch_run_queue(int urgent_only)
 {
struct net_device *next;
 
+   /*
+* Limit the number of linkwatch events to one
+* per second so that a runaway driver does not
+* cause a storm of messages on the netlink
+* socket.  This limit does not apply to up events
+* while the device qdisc is down.
+*/
+   if (!urgent_only)
+   linkwatch_nextevent = jiffies + HZ;
+   clear_bit(LW_RUNNING, linkwatch_flags);
+
spin_lock_irq(lweventlist_lock);
next = lweventlist;
lweventlist = NULL;
@@ -92,6 +133,11 @@ void linkwatch_run_queue(void)
 
next = dev-link_watch_next;
 
+   if (urgent_only  !linkwatch_urgent_event(dev)) {
+   linkwatch_add_event(dev);
+   continue;
+   }
+
/*
 * Make sure the above read is complete since it can be
 * rewritten as soon as we clear the bit below.
@@ -116,21 +162,23 @@ void linkwatch_run_queue(void)
 
dev_put(dev);
}
+
+   if (lweventlist)
+   linkwatch_schedule_work(linkwatch_nextevent - jiffies);
 }
 
 
-static void linkwatch_event(struct work_struct *dummy)
+/* Must be called with the rtnl semaphore held */
+void linkwatch_run_queue(void)
 {
-   /* Limit the number of linkwatch events to one
-* per second so that a runaway driver does not
-* cause a storm of messages on the netlink
-* socket
-*/
-   linkwatch_nextevent = jiffies + HZ;
-   clear_bit(LW_RUNNING, linkwatch_flags);
+   __linkwatch_run_queue(0);
+}
+
 
+static void linkwatch_event(struct work_struct *dummy)
+{
rtnl_lock();
-   linkwatch_run_queue();
+   __linkwatch_run_queue(time_after(linkwatch_nextevent, jiffies));
rtnl_unlock();
 }
 
@@ -138,23 +186,19 @@ static void linkwatch_event(struct work_struct *dummy)
 void linkwatch_fire_event(struct net_device *dev)
 {
if (!test_and_set_bit(__LINK_STATE_LINKWATCH_PENDING, dev-state)) {
-   unsigned long flags;
+   unsigned long delay;
 
dev_hold(dev);
 
-   spin_lock_irqsave(lweventlist_lock, flags);
-   dev-link_watch_next = lweventlist;
-   lweventlist = dev;
-   spin_unlock_irqrestore(lweventlist_lock, flags);
+   linkwatch_add_event(dev);
 
-   if (!test_and_set_bit(LW_RUNNING, linkwatch_flags)) {
-   unsigned long delay = linkwatch_nextevent - jiffies;
+   delay = linkwatch_nextevent - jiffies;
 
-   /* If we wrap around we'll delay it by at most HZ. */
-   if (delay  HZ)
- 

[MAC80211]: include linux/delay.h instead of asm/delay.h

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5b323edbf9daf287fed50dcc63a85589ba24887b
Commit: 5b323edbf9daf287fed50dcc63a85589ba24887b
Parent: 294cc44b7e48a6e7732499eebcf409b231460d8e
Author: Geert Uytterhoeven [EMAIL PROTECTED]
AuthorDate: Tue May 8 18:40:27 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:45:09 2007 -0700

[MAC80211]: include linux/delay.h instead of asm/delay.h

|   CC  net/mac80211/ieee80211_sta.o
| In file included from linux/net/mac80211/ieee80211_sta.c:31:
| include2/asm/delay.h: In function '__const_udelay':
| include2/asm/delay.h:33: error: 'loops_per_jiffy' undeclared (first use 
in this function)
| include2/asm/delay.h:33: error: (Each undeclared identifier is reported 
only once
| include2/asm/delay.h:33: error: for each function it appears in.)

Signed-off-by: Geert Uytterhoeven [EMAIL PROTECTED]
Signed-off-by: John W. Linville [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/mac80211/ieee80211_sta.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 822917d..3e07e9d 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -17,6 +17,7 @@
  * scan result table filtering (by capability (privacy, IBSS/BSS, WPA/RSN IE,
  *SSID)
  */
+#include linux/delay.h
 #include linux/if_ether.h
 #include linux/skbuff.h
 #include linux/netdevice.h
@@ -27,7 +28,6 @@
 #include linux/rtnetlink.h
 #include net/iw_handler.h
 #include asm/types.h
-#include asm/delay.h
 
 #include net/mac80211.h
 #include ieee80211_i.h
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NET_SCHED]: teql_enqueue can check limits before skb enqueue

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4cd8c9e87be7ea891050ff1bebbf767a837eb5cf
Commit: 4cd8c9e87be7ea891050ff1bebbf767a837eb5cf
Parent: 5b323edbf9daf287fed50dcc63a85589ba24887b
Author: Krishna Kumar [EMAIL PROTECTED]
AuthorDate: Tue May 8 18:57:50 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:45:10 2007 -0700

[NET_SCHED]: teql_enqueue can check limits before skb enqueue

Optimize teql_enqueue so that it first checks limits before enqueing.

Signed-off-by: Krishna Kumar [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/sched/sch_teql.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index d24914d..f05ad9a 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -94,14 +94,13 @@ teql_enqueue(struct sk_buff *skb, struct Qdisc* sch)
struct net_device *dev = sch-dev;
struct teql_sched_data *q = qdisc_priv(sch);
 
-   __skb_queue_tail(q-q, skb);
-   if (q-q.qlen = dev-tx_queue_len) {
+   if (q-q.qlen  dev-tx_queue_len) {
+   __skb_queue_tail(q-q, skb);
sch-bstats.bytes += skb-len;
sch-bstats.packets++;
return 0;
}
 
-   __skb_unlink(skb, q-q);
kfree_skb(skb);
sch-qstats.drops++;
return NET_XMIT_DROP;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NET] link_watch: Eliminate potential delay on wrap-around

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=db0ccffed91e234cad99a35f07d5a322f410baa2
Commit: db0ccffed91e234cad99a35f07d5a322f410baa2
Parent: 4cd8c9e87be7ea891050ff1bebbf767a837eb5cf
Author: Herbert Xu [EMAIL PROTECTED]
AuthorDate: Tue May 8 23:22:43 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:45:11 2007 -0700

[NET] link_watch: Eliminate potential delay on wrap-around

When the jiffies wrap around or when the system boots up for the first
time, down events can be delayed indefinitely since we no longer
update linkwatch_nextevent when only urgent events are processed.

This patch fixes this by setting linkwatch_nextevent when a
wrap-around occurs.

Signed-off-by: Herbert Xu [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/core/link_watch.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/net/core/link_watch.c b/net/core/link_watch.c
index b5f4579..4674ae5 100644
--- a/net/core/link_watch.c
+++ b/net/core/link_watch.c
@@ -101,8 +101,10 @@ static void linkwatch_schedule_work(unsigned long delay)
return;
 
/* If we wrap around we'll delay it by at most HZ. */
-   if (delay  HZ)
+   if (delay  HZ) {
+   linkwatch_nextevent = jiffies;
delay = 0;
+   }
 
schedule_delayed_work(linkwatch_work, delay);
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NET] link_watch: Always schedule urgent events

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d9568ba91b1fdd1ea4fdbf9fcc76b867cca6c1d5
Commit: d9568ba91b1fdd1ea4fdbf9fcc76b867cca6c1d5
Parent: db0ccffed91e234cad99a35f07d5a322f410baa2
Author: Herbert Xu [EMAIL PROTECTED]
AuthorDate: Wed May 9 00:17:30 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:45:28 2007 -0700

[NET] link_watch: Always schedule urgent events

Urgent events may be delayed if we already have a non-urgent event
queued for that device.  This patch changes this by making sure that
an urgent event is always looked at immediately.

I've replaced the LW_RUNNING flag by LW_URGENT since whether work
is scheduled is already kept track by the work queue system.

The only complication is that we have to provide some exclusion for
the setting linkwatch_nextevent which is available in the actual
work function.

Signed-off-by: Herbert Xu [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/core/link_watch.c |   60 +---
 1 files changed, 41 insertions(+), 19 deletions(-)

diff --git a/net/core/link_watch.c b/net/core/link_watch.c
index 4674ae5..a5e372b 100644
--- a/net/core/link_watch.c
+++ b/net/core/link_watch.c
@@ -26,7 +26,7 @@
 
 
 enum lw_bits {
-   LW_RUNNING = 0,
+   LW_URGENT = 0,
 };
 
 static unsigned long linkwatch_flags;
@@ -95,18 +95,41 @@ static void linkwatch_add_event(struct net_device *dev)
 }
 
 
-static void linkwatch_schedule_work(unsigned long delay)
+static void linkwatch_schedule_work(int urgent)
 {
-   if (test_and_set_bit(LW_RUNNING, linkwatch_flags))
+   unsigned long delay = linkwatch_nextevent - jiffies;
+
+   if (test_bit(LW_URGENT, linkwatch_flags))
return;
 
-   /* If we wrap around we'll delay it by at most HZ. */
-   if (delay  HZ) {
-   linkwatch_nextevent = jiffies;
+   /* Minimise down-time: drop delay for up event. */
+   if (urgent) {
+   if (test_and_set_bit(LW_URGENT, linkwatch_flags))
+   return;
delay = 0;
}
 
-   schedule_delayed_work(linkwatch_work, delay);
+   /* If we wrap around we'll delay it by at most HZ. */
+   if (delay  HZ)
+   delay = 0;
+
+   /*
+* This is true if we've scheduled it immeditately or if we don't
+* need an immediate execution and it's already pending.
+*/
+   if (schedule_delayed_work(linkwatch_work, delay) == !delay)
+   return;
+
+   /* Don't bother if there is nothing urgent. */
+   if (!test_bit(LW_URGENT, linkwatch_flags))
+   return;
+
+   /* It's already running which is good enough. */
+   if (!cancel_delayed_work(linkwatch_work))
+   return;
+
+   /* Otherwise we reschedule it again for immediate exection. */
+   schedule_delayed_work(linkwatch_work, 0);
 }
 
 
@@ -123,7 +146,11 @@ static void __linkwatch_run_queue(int urgent_only)
 */
if (!urgent_only)
linkwatch_nextevent = jiffies + HZ;
-   clear_bit(LW_RUNNING, linkwatch_flags);
+   /* Limit wrap-around effect on delay. */
+   else if (time_after(linkwatch_nextevent, jiffies + HZ))
+   linkwatch_nextevent = jiffies;
+
+   clear_bit(LW_URGENT, linkwatch_flags);
 
spin_lock_irq(lweventlist_lock);
next = lweventlist;
@@ -166,7 +193,7 @@ static void __linkwatch_run_queue(int urgent_only)
}
 
if (lweventlist)
-   linkwatch_schedule_work(linkwatch_nextevent - jiffies);
+   linkwatch_schedule_work(0);
 }
 
 
@@ -187,21 +214,16 @@ static void linkwatch_event(struct work_struct *dummy)
 
 void linkwatch_fire_event(struct net_device *dev)
 {
-   if (!test_and_set_bit(__LINK_STATE_LINKWATCH_PENDING, dev-state)) {
-   unsigned long delay;
+   int urgent = linkwatch_urgent_event(dev);
 
+   if (!test_and_set_bit(__LINK_STATE_LINKWATCH_PENDING, dev-state)) {
dev_hold(dev);
 
linkwatch_add_event(dev);
+   } else if (!urgent)
+   return;
 
-   delay = linkwatch_nextevent - jiffies;
-
-   /* Minimise down-time: drop delay for up event. */
-   if (linkwatch_urgent_event(dev))
-   delay = 0;
-
-   linkwatch_schedule_work(delay);
-   }
+   linkwatch_schedule_work(urgent);
 }
 
 EXPORT_SYMBOL(linkwatch_fire_event);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCTP]: Prevent OOPS if hmac modules didn't load

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8dc4984a6bdcaf56cdb458a7338c32c16f32540c
Commit: 8dc4984a6bdcaf56cdb458a7338c32c16f32540c
Parent: d9568ba91b1fdd1ea4fdbf9fcc76b867cca6c1d5
Author: Vlad Yasevich [EMAIL PROTECTED]
AuthorDate: Wed May 9 13:50:20 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:45:29 2007 -0700

[SCTP]: Prevent OOPS if hmac modules didn't load

SCTP was checking for NULL when trying to detect hmac
allocation failure where it should have been using IS_ERR.
Also, print a rate limited warning to the log telling the
user what happend.

Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/sctp/socket.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 83a76ba..f3c95f9 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -5227,7 +5227,12 @@ int sctp_inet_listen(struct socket *sock, int backlog)
/* Allocate HMAC for generating cookie. */
if (sctp_hmac_alg) {
tfm = crypto_alloc_hash(sctp_hmac_alg, 0, CRYPTO_ALG_ASYNC);
-   if (!tfm) {
+   if (IS_ERR(tfm)) {
+   if (net_ratelimit()) {
+   printk(KERN_INFO
+  SCTP: failed to load transform for %s: 
%ld\n,
+   sctp_hmac_alg, PTR_ERR(tfm));
+   }
err = -ENOSYS;
goto out;
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCTP]: Correctly copy addresses in sctp_copy_laddrs

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=70b57b814ed5a93bf21d9dc5f8a7d23620a77e44
Commit: 70b57b814ed5a93bf21d9dc5f8a7d23620a77e44
Parent: 8dc4984a6bdcaf56cdb458a7338c32c16f32540c
Author: Vlad Yasevich [EMAIL PROTECTED]
AuthorDate: Wed May 9 13:51:31 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:45:30 2007 -0700

[SCTP]: Correctly copy addresses in sctp_copy_laddrs

I broke the  non-wildcard case recently.  This is to fixes it.
Now, explictitly bound addresses can ge retrieved using the API.

Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/sctp/socket.c |   12 
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index f3c95f9..4dcdabf 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -4164,6 +4164,7 @@ static int sctp_getsockopt_local_addrs_old(struct sock 
*sk, int len,
rwlock_t *addr_lock;
int err = 0;
void *addrs;
+   void *buf;
int bytes_copied = 0;
 
if (len != sizeof(struct sctp_getaddrs_old))
@@ -4217,13 +4218,14 @@ static int sctp_getsockopt_local_addrs_old(struct sock 
*sk, int len,
}
}
 
+   buf = addrs;
list_for_each(pos, bp-address_list) {
addr = list_entry(pos, struct sctp_sockaddr_entry, list);
memcpy(temp, addr-a, sizeof(temp));
sctp_get_pf_specific(sk-sk_family)-addr_v4map(sp, temp);
addrlen = sctp_get_af_specific(temp.sa.sa_family)-sockaddr_len;
-   memcpy(addrs, temp, addrlen);
-   to += addrlen;
+   memcpy(buf, temp, addrlen);
+   buf += addrlen;
bytes_copied += addrlen;
cnt ++;
if (cnt = getaddrs.addr_num) break;
@@ -4266,6 +4268,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, 
int len,
size_t space_left;
int bytes_copied = 0;
void *addrs;
+   void *buf;
 
if (len = sizeof(struct sctp_getaddrs))
return -EINVAL;
@@ -4316,6 +4319,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, 
int len,
}
}
 
+   buf = addrs;
list_for_each(pos, bp-address_list) {
addr = list_entry(pos, struct sctp_sockaddr_entry, list);
memcpy(temp, addr-a, sizeof(temp));
@@ -4325,8 +4329,8 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, 
int len,
err =  -ENOMEM; /*fixme: right error?*/
goto error;
}
-   memcpy(addrs, temp, addrlen);
-   to += addrlen;
+   memcpy(buf, temp, addrlen);
+   buf += addrlen;
bytes_copied += addrlen;
cnt ++;
space_left -= addrlen;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[SCTP]: Do not include ABORT chunk header in the notification.

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ac40e41f4ddec8882d3f7bc8fa98a4fce8796aff
Commit: ac40e41f4ddec8882d3f7bc8fa98a4fce8796aff
Parent: 70b57b814ed5a93bf21d9dc5f8a7d23620a77e44
Author: Vlad Yasevich [EMAIL PROTECTED]
AuthorDate: Wed May 9 13:52:35 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:45:31 2007 -0700

[SCTP]: Do not include ABORT chunk header in the notification.

The socket API draft is unclear about whether to include the
chunk header or not.  Recent discussion on the sctp implementors
mailing list clarified that the chunk header shouldn't be included,
but the error parameter header still needs to be there.

Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/sctp/ulpevent.c |   11 ++-
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
index 661ea2d..bfecb35 100644
--- a/net/sctp/ulpevent.c
+++ b/net/sctp/ulpevent.c
@@ -141,11 +141,6 @@ struct sctp_ulpevent  *sctp_ulpevent_make_assoc_change(
 * an ABORT, so we need to include it in the sac_info.
 */
if (chunk) {
-   /* sctp_inqu_pop() has allready pulled off the chunk
-* header.  We need to put it back temporarily
-*/
-   skb_push(chunk-skb, sizeof(sctp_chunkhdr_t));
-
/* Copy the chunk data to a new skb and reserve enough
 * head room to use as notification.
 */
@@ -155,9 +150,6 @@ struct sctp_ulpevent  *sctp_ulpevent_make_assoc_change(
if (!skb)
goto fail;
 
-   /* put back the chunk header now that we have a copy */
-   skb_pull(chunk-skb, sizeof(sctp_chunkhdr_t));
-
/* Embed the event fields inside the cloned skb.  */
event = sctp_skb2event(skb);
sctp_ulpevent_init(event, MSG_NOTIFICATION, skb-truesize);
@@ -168,7 +160,8 @@ struct sctp_ulpevent  *sctp_ulpevent_make_assoc_change(
 
/* Trim the buffer to the right length.  */
skb_trim(skb, sizeof(struct sctp_assoc_change) +
-ntohs(chunk-chunk_hdr-length));
+ntohs(chunk-chunk_hdr-length) -
+sizeof(sctp_chunkhdr_t));
} else {
event = sctp_ulpevent_new(sizeof(struct sctp_assoc_change),
  MSG_NOTIFICATION, gfp);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[IPV6]: Send ICMPv6 error on scope violations.

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5bb1ab09e4f6287c0b6c9cdbd463147cbd003f54
Commit: 5bb1ab09e4f6287c0b6c9cdbd463147cbd003f54
Parent: ac40e41f4ddec8882d3f7bc8fa98a4fce8796aff
Author: David L Stevens [EMAIL PROTECTED]
AuthorDate: Wed May 9 13:53:44 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:45:32 2007 -0700

[IPV6]: Send ICMPv6 error on scope violations.

When an IPv6 router is forwarding a packet with a link-local scope source
address off-link, RFC 4007 requires it to send an ICMPv6 destination
unreachable with code 2 (not neighbor), but Linux doesn't. Fix below.

Signed-off-by: David L Stevens [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv6/ip6_output.c |   13 ++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index f508171..4704b5f 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -463,10 +463,17 @@ int ip6_forward(struct sk_buff *skb)
 */
if (xrlim_allow(dst, 1*HZ))
ndisc_send_redirect(skb, n, target);
-   } else if 
(ipv6_addr_type(hdr-saddr)(IPV6_ADDR_MULTICAST|IPV6_ADDR_LOOPBACK
-   |IPV6_ADDR_LINKLOCAL)) {
+   } else {
+   int addrtype = ipv6_addr_type(hdr-saddr);
+
/* This check is security critical. */
-   goto error;
+   if (addrtype  (IPV6_ADDR_MULTICAST|IPV6_ADDR_LOOPBACK))
+   goto error;
+   if (addrtype  IPV6_ADDR_LINKLOCAL) {
+   icmpv6_send(skb, ICMPV6_DEST_UNREACH,
+   ICMPV6_NOT_NEIGHBOUR, 0, skb-dev);
+   goto error;
+   }
}
 
if (skb-len  dst_mtu(dst)) {
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[IPV6]: Do no rely on skb-dst before it is assigned.

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e76b2b2567b83448c2ee85a896433b96150c92e6
Commit: e76b2b2567b83448c2ee85a896433b96150c92e6
Parent: 5bb1ab09e4f6287c0b6c9cdbd463147cbd003f54
Author: YOSHIFUJI Hideaki [EMAIL PROTECTED]
AuthorDate: Wed May 9 14:01:59 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:45:58 2007 -0700

[IPV6]: Do no rely on skb-dst before it is assigned.

Because skb-dst is assigned in ip6_route_input(), it is really
bad to use it in hop-by-hop option handler(s).

Closes: Bug #8450 (Eric Sesterhenn [EMAIL PROTECTED])
Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv6/exthdrs.c |   16 
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 6d8e4ac..14be0b9 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -660,6 +660,14 @@ EXPORT_SYMBOL_GPL(ipv6_invert_rthdr);
   Hop-by-hop options.
  **/
 
+/*
+ * Note: we cannot rely on skb-dst before we assign it in ip6_route_input().
+ */
+static inline struct inet6_dev *ipv6_skb_idev(struct sk_buff *skb)
+{
+   return skb-dst ? ip6_dst_idev(skb-dst) : __in6_dev_get(skb-dev);
+}
+
 /* Router Alert as of RFC 2711 */
 
 static int ipv6_hop_ra(struct sk_buff **skbp, int optoff)
@@ -688,25 +696,25 @@ static int ipv6_hop_jumbo(struct sk_buff **skbp, int 
optoff)
if (nh[optoff + 1] != 4 || (optoff  3) != 2) {
LIMIT_NETDEBUG(KERN_DEBUG ipv6_hop_jumbo: wrong jumbo opt 
length/alignment %d\n,
   nh[optoff+1]);
-   IP6_INC_STATS_BH(ip6_dst_idev(skb-dst),
+   IP6_INC_STATS_BH(ipv6_skb_idev(skb),
 IPSTATS_MIB_INHDRERRORS);
goto drop;
}
 
pkt_len = ntohl(*(__be32 *)(nh + optoff + 2));
if (pkt_len = IPV6_MAXPLEN) {
-   IP6_INC_STATS_BH(ip6_dst_idev(skb-dst), 
IPSTATS_MIB_INHDRERRORS);
+   IP6_INC_STATS_BH(ipv6_skb_idev(skb), IPSTATS_MIB_INHDRERRORS);
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2);
return 0;
}
if (ipv6_hdr(skb)-payload_len) {
-   IP6_INC_STATS_BH(ip6_dst_idev(skb-dst), 
IPSTATS_MIB_INHDRERRORS);
+   IP6_INC_STATS_BH(ipv6_skb_idev(skb), IPSTATS_MIB_INHDRERRORS);
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff);
return 0;
}
 
if (pkt_len  skb-len - sizeof(struct ipv6hdr)) {
-   IP6_INC_STATS_BH(ip6_dst_idev(skb-dst), 
IPSTATS_MIB_INTRUNCATEDPKTS);
+   IP6_INC_STATS_BH(ipv6_skb_idev(skb), 
IPSTATS_MIB_INTRUNCATEDPKTS);
goto drop;
}
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[IPV6] ROUTE: Assign rt6i_idev for ip6_{prohibit,blk_hole}_entry.

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9a6bf6fe716ea09160ee11660ee66a930167692b
Commit: 9a6bf6fe716ea09160ee11660ee66a930167692b
Parent: e76b2b2567b83448c2ee85a896433b96150c92e6
Author: YOSHIFUJI Hideaki [EMAIL PROTECTED]
AuthorDate: Wed May 9 14:03:28 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:46:12 2007 -0700

[IPV6] ROUTE: Assign rt6i_idev for ip6_{prohibit,blk_hole}_entry.

I think this is less critical, but is also suitable for -stable
release.

Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv6/addrconf.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index d02685c..c7ea248 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4204,6 +4204,10 @@ int __init addrconf_init(void)
return err;
 
ip6_null_entry.rt6i_idev = in6_dev_get(loopback_dev);
+#ifdef CONFIG_IPV6_MULTIPLE_TABLES
+   ip6_prohibit_entry.rt6i_idev = in6_dev_get(loopback_dev);
+   ip6_blk_hole_entry.rt6i_idev = in6_dev_get(loopback_dev);
+#endif
 
register_netdevice_notifier(ipv6_dev_notf);
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[IrDA]: KingSun/DonShine USB IrDA dongle support.

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a2af421f1819946556c6f467b1efdd0dc84af4d5
Commit: a2af421f1819946556c6f467b1efdd0dc84af4d5
Parent: 9a6bf6fe716ea09160ee11660ee66a930167692b
Author: Alex Villac�s Lasso [EMAIL PROTECTED]
AuthorDate: Wed May 9 16:18:21 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:46:13 2007 -0700

[IrDA]: KingSun/DonShine USB IrDA dongle support.

This dongle does not follow the usb-irda specification, so it needs its
own special driver. In addition, it uses interrupt endpoints instead of
bulk ones as the rest of USB IrDA dongles supported by Linux (just to be
different?) and data reads need to be parsed to extract the valid bytes
before being unwrapped (details in the comment at the start of the
source). No speed commands have been discovered for this dongle, and I
suspect it does not have any at all.

On plugin, this dongle reports vendor and device IDs: 0x07c0:0x4200 .

The Windows driver that is used normally to control this dongle has a
filename of DSIR620.SYS .

Signed-off-by: Alex Villac�s Lasso [EMAIL PROTECTED]
Signed-off-by: Samuel Ortiz [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 drivers/net/irda/Kconfig   |   14 +
 drivers/net/irda/Makefile  |1 +
 drivers/net/irda/kingsun-sir.c |  657 
 3 files changed, 672 insertions(+), 0 deletions(-)

diff --git a/drivers/net/irda/Kconfig b/drivers/net/irda/Kconfig
index 7c8ccc0..829da9a 100644
--- a/drivers/net/irda/Kconfig
+++ b/drivers/net/irda/Kconfig
@@ -141,6 +141,20 @@ config ACT200L_DONGLE
  To activate support for ACTiSYS IR-200L dongle you will have to
  start irattach like this: irattach -d act200l.
 
+config KINGSUN_DONGLE
+   tristate KingSun/DonShine DS-620 IrDA-USB dongle
+   depends on IRDA  USB  EXPERIMENTAL
+   help
+ Say Y or M here if you want to build support for the KingSun/DonShine
+ DS-620 IrDA-USB bridge device driver.
+
+ This USB bridge does not conform to the IrDA-USB device class
+ specification, and therefore needs its own specific driver. This
+ dongle supports SIR speed only (9600 bps).
+
+ To compile it as a module, choose M here: the module will be called
+ kingsun-sir.
+
 comment Old SIR device drivers
 
 config IRPORT_SIR
diff --git a/drivers/net/irda/Makefile b/drivers/net/irda/Makefile
index 5be09f1..233a2f9 100644
--- a/drivers/net/irda/Makefile
+++ b/drivers/net/irda/Makefile
@@ -45,6 +45,7 @@ obj-$(CONFIG_MCP2120_DONGLE)  += mcp2120-sir.o
 obj-$(CONFIG_ACT200L_DONGLE)   += act200l-sir.o
 obj-$(CONFIG_MA600_DONGLE) += ma600-sir.o
 obj-$(CONFIG_TOIM3232_DONGLE)  += toim3232-sir.o
+obj-$(CONFIG_KINGSUN_DONGLE)   += kingsun-sir.o
 
 # The SIR helper module
 sir-dev-objs := sir_dev.o sir_dongle.o
diff --git a/drivers/net/irda/kingsun-sir.c b/drivers/net/irda/kingsun-sir.c
new file mode 100644
index 000..2174291
--- /dev/null
+++ b/drivers/net/irda/kingsun-sir.c
@@ -0,0 +1,657 @@
+/*
+*
+* Filename:  kingsun-sir.c
+* Version:   0.1.1
+* Description:   Irda KingSun/DonShine USB Dongle
+* Status:Experimental
+* Author:Alex Villac�s Lasso [EMAIL PROTECTED]
+*
+*  Based on stir4200 and mcs7780 drivers, with (strange?) differences
+*
+*  This program is free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License.
+*
+*  This program is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  You should have received a copy of the GNU General Public License
+*  along with this program; if not, write to the Free Software
+*  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*
+*/
+
+/*
+ * This is my current (2007-04-25) understanding of how this dongle is supposed
+ * to work. This is based on reverse-engineering and examination of the packet
+ * data sent and received by the WinXP driver using USBSnoopy. Feel free to
+ * update here as more of this dongle is known:
+ *
+ * General: Unlike the other USB IrDA dongles, this particular dongle exposes,
+ * not two bulk (in and out) endpoints, but two *interrupt* ones. This dongle,
+ * like the bulk based ones (stir4200.c and mcs7780.c), requires polling in
+ * order to receive data.
+ * Transmission: Just like stir4200, this dongle uses a raw stream of data,
+ * which needs to be wrapped and 

[UDP]: Fix AF-specific references in AF-agnostic code.

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fc038410b4b1643766f8033f4940bcdb1dace633
Commit: fc038410b4b1643766f8033f4940bcdb1dace633
Parent: a2af421f1819946556c6f467b1efdd0dc84af4d5
Author: David S. Miller [EMAIL PROTECTED]
AuthorDate: Wed May 9 16:42:20 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:47:22 2007 -0700

[UDP]: Fix AF-specific references in AF-agnostic code.

__udp_lib_port_inuse() cannot make direct references to
inet_sk(sk)-rcv_saddr as that is ipv4 specific state and
this code is used by ipv6 too.

Use an operations vector to solve this, and this also paves
the way for ipv6 support for non-wild saddr hashing in UDP.

Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/udp.h |9 +-
 include/net/udplite.h |2 +-
 net/ipv4/udp.c|   85 +++--
 net/ipv4/udp_impl.h   |6 ++--
 net/ipv4/udplite.c|7 ++--
 net/ipv6/udp.c|   21 +++-
 net/ipv6/udp_impl.h   |2 +
 net/ipv6/udplite.c|2 +-
 8 files changed, 93 insertions(+), 41 deletions(-)

diff --git a/include/net/udp.h b/include/net/udp.h
index 98755eb..496f89d 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -119,9 +119,16 @@ static inline void udp_lib_close(struct sock *sk, long 
timeout)
 }
 
 
+struct udp_get_port_ops {
+   int (*saddr_cmp)(const struct sock *sk1, const struct sock *sk2);
+   int (*saddr_any)(const struct sock *sk);
+   unsigned int (*hash_port_and_rcv_saddr)(__u16 port,
+   const struct sock *sk);
+};
+
 /* net/ipv4/udp.c */
 extern int udp_get_port(struct sock *sk, unsigned short snum,
-int (*saddr_cmp)(const struct sock *, const struct 
sock *));
+const struct udp_get_port_ops *ops);
 extern voidudp_err(struct sk_buff *, u32);
 
 extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk,
diff --git a/include/net/udplite.h b/include/net/udplite.h
index 635b0ea..50b4b42 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -120,5 +120,5 @@ static inline __wsum udplite_csum_outgoing(struct sock *sk, 
struct sk_buff *skb)
 
 extern voidudplite4_register(void);
 extern int udplite_get_port(struct sock *sk, unsigned short snum,
-   int (*scmp)(const struct sock *, const struct sock *));
+const struct udp_get_port_ops *ops);
 #endif /* _UDPLITE_H */
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 66026df..4c7e95f 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -118,15 +118,15 @@ static int udp_port_rover;
  * Note about this hash function :
  * Typical use is probably daddr = 0, only dport is going to vary hash
  */
-static inline unsigned int hash_port_and_addr(__u16 port, __be32 addr)
+static inline unsigned int udp_hash_port(__u16 port)
 {
-   addr ^= addr  16;
-   addr ^= addr  8;
-   return port ^ addr;
+   return port;
 }
 
 static inline int __udp_lib_port_inuse(unsigned int hash, int port,
-   __be32 daddr, struct hlist_head udptable[])
+  const struct sock *this_sk,
+  struct hlist_head udptable[],
+  const struct udp_get_port_ops *ops)
 {
struct sock *sk;
struct hlist_node *node;
@@ -138,7 +138,10 @@ static inline int __udp_lib_port_inuse(unsigned int hash, 
int port,
inet = inet_sk(sk);
if (inet-num != port)
continue;
-   if (inet-rcv_saddr == daddr)
+   if (this_sk) {
+   if (ops-saddr_cmp(sk, this_sk))
+   return 1;
+   } else if (ops-saddr_any(sk))
return 1;
}
return 0;
@@ -151,12 +154,11 @@ static inline int __udp_lib_port_inuse(unsigned int hash, 
int port,
  *  @snum:port number to look up
  *  @udptable:hash list table, must be of UDP_HTABLE_SIZE
  *  @port_rover:  pointer to record of last unallocated port
- *  @saddr_comp:  AF-dependent comparison of bound local IP addresses
+ *  @ops: AF-dependent address operations
  */
 int __udp_lib_get_port(struct sock *sk, unsigned short snum,
   struct hlist_head udptable[], int *port_rover,
-  int (*saddr_comp)(const struct sock *sk1,
-const struct sock *sk2 ))
+  const struct udp_get_port_ops *ops)
 {
struct hlist_node *node;
struct hlist_head *head;
@@ -176,8 +178,7 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum,
for (i = 0; i  UDP_HTABLE_SIZE; i++, result++) {
int size;
 
-   hash 

[NET]: Fix dev-qdisc race for NETDEV_TX_LOCKED case

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5830725f8a36908111ecccf2899d06d6dcf54d45
Commit: 5830725f8a36908111ecccf2899d06d6dcf54d45
Parent: fc038410b4b1643766f8033f4940bcdb1dace633
Author: Thomas Graf [EMAIL PROTECTED]
AuthorDate: Thu May 10 04:02:41 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:47:39 2007 -0700

[NET]: Fix dev-qdisc race for NETDEV_TX_LOCKED case

When transmit fails with NETDEV_TX_LOCKED the skb is requeued
to dev-qdisc again. The dev-qdisc pointer is protected by
the queue lock which needs to be dropped when attempting to
transmit and acquired again before requeing. The problem is
that qdisc_restart() fetches the dev-qdisc pointer once and
stores it in the `q' variable which is invalidated when
dropping the queue_lock, therefore the variable needs to be
refreshed before requeueing.

Signed-off-by: Thomas Graf [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/sched/sch_generic.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 3385ee5..a8240c5 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -139,6 +139,7 @@ static inline int qdisc_restart(struct net_device *dev)
}
if (ret == NETDEV_TX_LOCKED  nolock) {
spin_lock(dev-queue_lock);
+   q = dev-qdisc;
goto collision;
}
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NET_SCHED]: Rationalise return value of qdisc_restart

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d90df3ad07a20cd93921e05ff2b12ca7030b4fd7
Commit: d90df3ad07a20cd93921e05ff2b12ca7030b4fd7
Parent: 5830725f8a36908111ecccf2899d06d6dcf54d45
Author: Herbert Xu [EMAIL PROTECTED]
AuthorDate: Thu May 10 04:55:14 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:47:40 2007 -0700

[NET_SCHED]: Rationalise return value of qdisc_restart

The current return value scheme and associated comment was invented
back in the 20th century when we still had that tbusy flag.  Things
have changed quite a bit since then (even Tony Blair is moving on
now, not to mention the new French president).

All we need to indicate now is whether the caller should continue
processing the queue.  Therefore it's sufficient if we return 0 if
we want to stop and non-zero otherwise.

This is based on a patch by Krishna Kumar.

Signed-off-by: Herbert Xu [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/sched/sch_generic.c |   21 +++--
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index a8240c5..07200bf 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -71,12 +71,9 @@ void qdisc_unlock_tree(struct net_device *dev)
 
 
 /* Kick device.
-   Note, that this procedure can be called by a watchdog timer, so that
-   we do not check dev-tbusy flag here.
 
-   Returns:  0  - queue is empty.
-   0  - queue is not empty, but throttled.
-   0  - queue is not empty. Device is throttled, if dev-tbusy != 0.
+   Returns:  0  - queue is empty or throttled.
+   0  - queue is not empty.
 
NOTE: Called under dev-queue_lock with locally disabled BH.
 */
@@ -115,7 +112,7 @@ static inline int qdisc_restart(struct net_device *dev)
kfree_skb(skb);
if (net_ratelimit())
printk(KERN_DEBUG Dead loop on 
netdevice %s, fix it urgently!\n, dev-name);
-   return -1;
+   goto out;
}
__get_cpu_var(netdev_rx_stat).cpu_collision++;
goto requeue;
@@ -135,7 +132,7 @@ static inline int qdisc_restart(struct net_device *dev)
netif_tx_unlock(dev);
}
spin_lock(dev-queue_lock);
-   return -1;
+   goto out;
}
if (ret == NETDEV_TX_LOCKED  nolock) {
spin_lock(dev-queue_lock);
@@ -169,8 +166,10 @@ requeue:
else
q-ops-requeue(skb, q);
netif_schedule(dev);
-   return 1;
+   return 0;
}
+
+out:
BUG_ON((int) q-q.qlen  0);
return q-q.qlen;
 }
@@ -180,8 +179,10 @@ void __qdisc_run(struct net_device *dev)
if (unlikely(dev-qdisc == noop_qdisc))
goto out;
 
-   while (qdisc_restart(dev)  0  !netif_queue_stopped(dev))
-   /* NOTHING */;
+   do {
+   if (!qdisc_restart(dev))
+   break;
+   } while (!netif_queue_stopped(dev));
 
 out:
clear_bit(__LINK_STATE_QDISC_RUNNING, dev-state);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NET_SCHED]: Reread dev-qdisc for NETDEV_TX_OK

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cce1fa36a8ed36e8a3f64455e2a830f48e904c64
Commit: cce1fa36a8ed36e8a3f64455e2a830f48e904c64
Parent: d90df3ad07a20cd93921e05ff2b12ca7030b4fd7
Author: Herbert Xu [EMAIL PROTECTED]
AuthorDate: Thu May 10 14:11:16 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:47:41 2007 -0700

[NET_SCHED]: Reread dev-qdisc for NETDEV_TX_OK

Now that we return the queue length after NETDEV_TX_OK we better
make sure that we have the right queue.  Otherwise we can cause a
stall after a really quick dev_deactive/dev_activate.

Signed-off-by: Herbert Xu [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/sched/sch_generic.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 07200bf..816d311 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -132,6 +132,7 @@ static inline int qdisc_restart(struct net_device *dev)
netif_tx_unlock(dev);
}
spin_lock(dev-queue_lock);
+   q = dev-qdisc;
goto out;
}
if (ret == NETDEV_TX_LOCKED  nolock) {
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NET_SCHED]: Avoid requeue warning on dev_deactivate

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=41a23b0788610b27ecb4c4ee857f3fe7168f1070
Commit: 41a23b0788610b27ecb4c4ee857f3fe7168f1070
Parent: cce1fa36a8ed36e8a3f64455e2a830f48e904c64
Author: Herbert Xu [EMAIL PROTECTED]
AuthorDate: Thu May 10 14:12:47 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:47:42 2007 -0700

[NET_SCHED]: Avoid requeue warning on dev_deactivate

When we relinquish queue_lock in qdisc_restart and then retake it for
requeueing, we might race against dev_deactivate and end up requeueing
onto noop_qdisc.  This causes a warning to be printed.

This patch fixes this by checking this before we requeue.  As an added
bonus, we can remove the same check in __qdisc_run which was added to
prevent dev-gso_skb from being requeued when we're shutting down.

Even though we've had to add a new conditional in its place, it's better
because it only happens on requeues rather than every single time that
qdisc_run is called.

For this to work we also need to move the clearing of gso_skb up in
dev_deactivate as now qdisc_restart can occur even after we wait for
__LINK_STATE_QDISC_RUNNING to clear (but it won't do anything as long
as the queue and gso_skb is already clear).

Signed-off-by: Herbert Xu [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/sched/sch_generic.c |   18 --
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 816d311..f28bb2d 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -162,7 +162,9 @@ static inline int qdisc_restart(struct net_device *dev)
 */
 
 requeue:
-   if (skb-next)
+   if (unlikely(q == noop_qdisc))
+   kfree_skb(skb);
+   else if (skb-next)
dev-gso_skb = skb;
else
q-ops-requeue(skb, q);
@@ -177,15 +179,11 @@ out:
 
 void __qdisc_run(struct net_device *dev)
 {
-   if (unlikely(dev-qdisc == noop_qdisc))
-   goto out;
-
do {
if (!qdisc_restart(dev))
break;
} while (!netif_queue_stopped(dev));
 
-out:
clear_bit(__LINK_STATE_QDISC_RUNNING, dev-state);
 }
 
@@ -547,6 +545,7 @@ void dev_activate(struct net_device *dev)
 void dev_deactivate(struct net_device *dev)
 {
struct Qdisc *qdisc;
+   struct sk_buff *skb;
 
spin_lock_bh(dev-queue_lock);
qdisc = dev-qdisc;
@@ -554,8 +553,12 @@ void dev_deactivate(struct net_device *dev)
 
qdisc_reset(qdisc);
 
+   skb = dev-gso_skb;
+   dev-gso_skb = NULL;
spin_unlock_bh(dev-queue_lock);
 
+   kfree_skb(skb);
+
dev_watchdog_down(dev);
 
/* Wait for outstanding dev_queue_xmit calls. */
@@ -564,11 +567,6 @@ void dev_deactivate(struct net_device *dev)
/* Wait for outstanding qdisc_run calls. */
while (test_bit(__LINK_STATE_QDISC_RUNNING, dev-state))
yield();
-
-   if (dev-gso_skb) {
-   kfree_skb(dev-gso_skb);
-   dev-gso_skb = NULL;
-   }
 }
 
 void dev_init_scheduler(struct net_device *dev)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETFILTER]: Clean up table initialization

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3c2ad469c317147fc1de19579f8173ddb68a9e91
Commit: 3c2ad469c317147fc1de19579f8173ddb68a9e91
Parent: 41a23b0788610b27ecb4c4ee857f3fe7168f1070
Author: Patrick McHardy [EMAIL PROTECTED]
AuthorDate: Thu May 10 14:14:16 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:47:43 2007 -0700

[NETFILTER]: Clean up table initialization

- move arp_tables initial table structure definitions to arp_tables.h
  similar to ip_tables and ip6_tables

- use C99 initializers

- use initializer macros where possible

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/linux/netfilter/x_tables.h|8 ++
 include/linux/netfilter_arp/arp_tables.h  |   41 +
 include/linux/netfilter_ipv4/ip_tables.h  |   22 +
 include/linux/netfilter_ipv6/ip6_tables.h |   22 +
 net/ipv4/netfilter/arptable_filter.c  |  140 +
 net/ipv4/netfilter/iptable_filter.c   |   70 +--
 net/ipv4/netfilter/iptable_mangle.c   |   96 ++--
 net/ipv4/netfilter/iptable_raw.c  |   58 ++---
 net/ipv4/netfilter/nf_nat_rule.c  |   73 ++-
 net/ipv6/netfilter/ip6table_filter.c  |   70 +--
 net/ipv6/netfilter/ip6table_mangle.c  |   96 ++--
 net/ipv6/netfilter/ip6table_raw.c |   52 +--
 12 files changed, 238 insertions(+), 510 deletions(-)

diff --git a/include/linux/netfilter/x_tables.h 
b/include/linux/netfilter/x_tables.h
index 022edfa..7e733a6 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -54,6 +54,14 @@ struct xt_entry_target
unsigned char data[0];
 };
 
+#define XT_TARGET_INIT(__name, __size)\
+{ \
+   .target.u.user = { \
+   .target_size= XT_ALIGN(__size),\
+   .name   = __name,  \
+   }, \
+}
+
 struct xt_standard_target
 {
struct xt_entry_target target;
diff --git a/include/linux/netfilter_arp/arp_tables.h 
b/include/linux/netfilter_arp/arp_tables.h
index 24c8786..584cd1b 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -238,6 +238,47 @@ static __inline__ struct arpt_entry_target 
*arpt_get_target(struct arpt_entry *e
  */
 #ifdef __KERNEL__
 
+/* Standard entry. */
+struct arpt_standard
+{
+   struct arpt_entry entry;
+   struct arpt_standard_target target;
+};
+
+struct arpt_error_target
+{
+   struct arpt_entry_target target;
+   char errorname[ARPT_FUNCTION_MAXNAMELEN];
+};
+
+struct arpt_error
+{
+   struct arpt_entry entry;
+   struct arpt_error_target target;
+};
+
+#define ARPT_ENTRY_INIT(__size)
   \
+{ \
+   .target_offset  = sizeof(struct arpt_entry),   \
+   .next_offset= (__size),\
+}
+
+#define ARPT_STANDARD_INIT(__verdict) \
+{ \
+   .entry  = ARPT_ENTRY_INIT(sizeof(struct arpt_standard)),   \
+   .target = XT_TARGET_INIT(ARPT_STANDARD_TARGET, \
+sizeof(struct arpt_standard_target)), \
+   .target.verdict = -(__verdict) - 1,\
+}
+
+#define ARPT_ERROR_INIT
   \
+{ \
+   .entry  = ARPT_ENTRY_INIT(sizeof(struct arpt_error)),  \
+   .target = XT_TARGET_INIT(ARPT_ERROR_TARGET,\
+sizeof(struct arpt_error_target)),\
+   .target.errorname = ERROR,   \
+}
+
 #define arpt_register_target(tgt)  \
 ({ (tgt)-family = NF_ARP; \
xt_register_target(tgt); })
diff --git a/include/linux/netfilter_ipv4/ip_tables.h 
b/include/linux/netfilter_ipv4/ip_tables.h
index 9527296..2f46dd7 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -295,6 +295,28 @@ struct ipt_error
struct ipt_error_target target;
 };
 
+#define IPT_ENTRY_INIT(__size)\
+{   

[NETFILTER]: nf_nat: remove unused argument of function allocating binding

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ba4c7cbadd2c025321809b522c398fc81cd5d75d
Commit: ba4c7cbadd2c025321809b522c398fc81cd5d75d
Parent: 3c2ad469c317147fc1de19579f8173ddb68a9e91
Author: Yasuyuki Kozakai [EMAIL PROTECTED]
AuthorDate: Thu May 10 14:14:45 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:47:44 2007 -0700

[NETFILTER]: nf_nat: remove unused argument of function allocating binding

nf_nat_rule_find, alloc_null_binding and alloc_null_binding_confirmed
do not use the argument 'info', which is actually ct-nat.info.
If they are necessary to access it again, we can use the argument 'ct'
instead.

Signed-off-by: Yasuyuki Kozakai [EMAIL PROTECTED]
Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/netfilter/nf_nat_rule.h|   11 +++
 net/ipv4/netfilter/nf_nat_rule.c   |   13 -
 net/ipv4/netfilter/nf_nat_standalone.c |   11 +++
 3 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/include/net/netfilter/nf_nat_rule.h 
b/include/net/netfilter/nf_nat_rule.h
index e765654..f974318 100644
--- a/include/net/netfilter/nf_nat_rule.h
+++ b/include/net/netfilter/nf_nat_rule.h
@@ -10,16 +10,11 @@ extern int nf_nat_rule_find(struct sk_buff **pskb,
unsigned int hooknum,
const struct net_device *in,
const struct net_device *out,
-   struct nf_conn *ct,
-   struct nf_nat_info *info);
+   struct nf_conn *ct);
 
 extern unsigned int
-alloc_null_binding(struct nf_conn *ct,
-  struct nf_nat_info *info,
-  unsigned int hooknum);
+alloc_null_binding(struct nf_conn *ct, unsigned int hooknum);
 
 extern unsigned int
-alloc_null_binding_confirmed(struct nf_conn *ct,
-struct nf_nat_info *info,
-unsigned int hooknum);
+alloc_null_binding_confirmed(struct nf_conn *ct, unsigned int hooknum);
 #endif /* _NF_NAT_RULE_H */
diff --git a/net/ipv4/netfilter/nf_nat_rule.c b/net/ipv4/netfilter/nf_nat_rule.c
index 07e99e3..6740736 100644
--- a/net/ipv4/netfilter/nf_nat_rule.c
+++ b/net/ipv4/netfilter/nf_nat_rule.c
@@ -173,9 +173,7 @@ static int ipt_dnat_checkentry(const char *tablename,
 }
 
 inline unsigned int
-alloc_null_binding(struct nf_conn *ct,
-  struct nf_nat_info *info,
-  unsigned int hooknum)
+alloc_null_binding(struct nf_conn *ct, unsigned int hooknum)
 {
/* Force range to this IP; let proto decide mapping for
   per-proto parts (hence not IP_NAT_RANGE_PROTO_SPECIFIED).
@@ -194,9 +192,7 @@ alloc_null_binding(struct nf_conn *ct,
 }
 
 unsigned int
-alloc_null_binding_confirmed(struct nf_conn *ct,
-struct nf_nat_info *info,
-unsigned int hooknum)
+alloc_null_binding_confirmed(struct nf_conn *ct, unsigned int hooknum)
 {
__be32 ip
= (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC
@@ -218,8 +214,7 @@ int nf_nat_rule_find(struct sk_buff **pskb,
 unsigned int hooknum,
 const struct net_device *in,
 const struct net_device *out,
-struct nf_conn *ct,
-struct nf_nat_info *info)
+struct nf_conn *ct)
 {
int ret;
 
@@ -228,7 +223,7 @@ int nf_nat_rule_find(struct sk_buff **pskb,
if (ret == NF_ACCEPT) {
if (!nf_nat_initialized(ct, HOOK2MANIP(hooknum)))
/* NUL mapping */
-   ret = alloc_null_binding(ct, info, hooknum);
+   ret = alloc_null_binding(ct, hooknum);
}
return ret;
 }
diff --git a/net/ipv4/netfilter/nf_nat_standalone.c 
b/net/ipv4/netfilter/nf_nat_standalone.c
index 64bbed2..55dac36 100644
--- a/net/ipv4/netfilter/nf_nat_standalone.c
+++ b/net/ipv4/netfilter/nf_nat_standalone.c
@@ -80,7 +80,6 @@ nf_nat_fn(unsigned int hooknum,
struct nf_conn *ct;
enum ip_conntrack_info ctinfo;
struct nf_conn_nat *nat;
-   struct nf_nat_info *info;
/* maniptype == SRC for postrouting. */
enum nf_nat_manip_type maniptype = HOOK2MANIP(hooknum);
 
@@ -129,7 +128,6 @@ nf_nat_fn(unsigned int hooknum,
}
/* Fall thru... (Only ICMPs can be IP_CT_IS_REPLY) */
case IP_CT_NEW:
-   info = nat-info;
 
/* Seen it before?  This can happen for loopback, retrans,
   or local packets.. */
@@ -138,14 +136,13 @@ nf_nat_fn(unsigned int hooknum,
 
if (unlikely(nf_ct_is_confirmed(ct)))
/* NAT module was loaded late */
-   ret = 

[NETFILTER]: nf_conntrack: Removes duplicated declarations

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c874d5f726ebaa5487d9fb7b057e28c25c4975a2
Commit: c874d5f726ebaa5487d9fb7b057e28c25c4975a2
Parent: ba4c7cbadd2c025321809b522c398fc81cd5d75d
Author: Yasuyuki Kozakai [EMAIL PROTECTED]
AuthorDate: Thu May 10 14:15:08 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:47:45 2007 -0700

[NETFILTER]: nf_conntrack: Removes duplicated declarations

These are also in include/net/netfilter/nf_conntrack_helper.h

Signed-off-by: Yasuyuki Kozakai [EMAIL PROTECTED]
Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/netfilter/nf_conntrack.h |7 ---
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/include/net/netfilter/nf_conntrack.h 
b/include/net/netfilter/nf_conntrack.h
index 1c6b8bd..4732432 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -183,13 +183,6 @@ extern void nf_conntrack_hash_insert(struct nf_conn *ct);
 
 extern void nf_conntrack_flush(void);
 
-extern struct nf_conntrack_helper *
-nf_ct_helper_find_get( const struct nf_conntrack_tuple *tuple);
-extern void nf_ct_helper_put(struct nf_conntrack_helper *helper);
-
-extern struct nf_conntrack_helper *
-__nf_conntrack_helper_find_byname(const char *name);
-
 extern int nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse,
const struct nf_conntrack_tuple *orig);
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETFILTER]: nf_conntrack: Removes unused destroy operation of l3proto

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fda61436835f6d46b6d85d4fe9206ffe682fe7f0
Commit: fda61436835f6d46b6d85d4fe9206ffe682fe7f0
Parent: c874d5f726ebaa5487d9fb7b057e28c25c4975a2
Author: Yasuyuki Kozakai [EMAIL PROTECTED]
AuthorDate: Thu May 10 14:15:30 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:47:46 2007 -0700

[NETFILTER]: nf_conntrack: Removes unused destroy operation of l3proto

Signed-off-by: Yasuyuki Kozakai [EMAIL PROTECTED]
Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 include/net/netfilter/nf_conntrack_l3proto.h |3 ---
 net/netfilter/nf_conntrack_core.c|5 -
 2 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/include/net/netfilter/nf_conntrack_l3proto.h 
b/include/net/netfilter/nf_conntrack_l3proto.h
index f32f714..96a58d8 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -56,9 +56,6 @@ struct nf_conntrack_l3proto
 */
int (*new)(struct nf_conn *conntrack, const struct sk_buff *skb);
 
-   /* Called when a conntrack entry is destroyed */
-   void (*destroy)(struct nf_conn *conntrack);
-
/*
 * Called before tracking. 
 *  *dataoff: offset of protocol header (TCP, UDP,...) in *pskb
diff --git a/net/netfilter/nf_conntrack_core.c 
b/net/netfilter/nf_conntrack_core.c
index e132c8a..94000a4 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -299,7 +299,6 @@ destroy_conntrack(struct nf_conntrack *nfct)
 {
struct nf_conn *ct = (struct nf_conn *)nfct;
struct nf_conn_help *help = nfct_help(ct);
-   struct nf_conntrack_l3proto *l3proto;
struct nf_conntrack_l4proto *l4proto;
typeof(nf_conntrack_destroyed) destroyed;
 
@@ -317,10 +316,6 @@ destroy_conntrack(struct nf_conntrack *nfct)
 * destroy_conntrack() MUST NOT be called with a write lock
 * to nf_conntrack_lock!!! -HW */
rcu_read_lock();
-   l3proto = 
__nf_ct_l3proto_find(ct-tuplehash[IP_CT_DIR_REPLY].tuple.src.l3num);
-   if (l3proto  l3proto-destroy)
-   l3proto-destroy(ct);
-
l4proto = 
__nf_ct_l4proto_find(ct-tuplehash[IP_CT_DIR_REPLY].tuple.src.l3num,
   
ct-tuplehash[IP_CT_DIR_REPLY].tuple.dst.protonum);
if (l4proto  l4proto-destroy)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETFILTER]: nf_nat: Clears helper private area when NATing

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5d78a84913abc1b2ef1ec0c14a78ec99517cc122
Commit: 5d78a84913abc1b2ef1ec0c14a78ec99517cc122
Parent: df293bbb6ff80f40a2308140ba4cbc2d3c1b18da
Author: Yasuyuki Kozakai [EMAIL PROTECTED]
AuthorDate: Thu May 10 14:16:24 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:47:48 2007 -0700

[NETFILTER]: nf_nat: Clears helper private area when NATing

Some helpers (eg. ftp) assume that private area in conntrack is
filled with zero. It should be cleared when helper is changed.

Signed-off-by: Yasuyuki Kozakai [EMAIL PROTECTED]
Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/netfilter/nf_conntrack_core.c |9 +++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nf_conntrack_core.c 
b/net/netfilter/nf_conntrack_core.c
index 94000a4..e8b5c2d 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -888,8 +888,13 @@ void nf_conntrack_alter_reply(struct nf_conn *ct,
NF_CT_DUMP_TUPLE(newreply);
 
ct-tuplehash[IP_CT_DIR_REPLY].tuple = *newreply;
-   if (!ct-master  help  help-expecting == 0)
-   help-helper = __nf_ct_helper_find(newreply);
+   if (!ct-master  help  help-expecting == 0) {
+   struct nf_conntrack_helper *helper;
+   helper = __nf_ct_helper_find(newreply);
+   if (helper)
+   memset(help-help, 0, sizeof(help-help));
+   help-helper = helper;
+   }
write_unlock_bh(nf_conntrack_lock);
 }
 EXPORT_SYMBOL_GPL(nf_conntrack_alter_reply);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETFILTER]: iptable_{filter,mangle}: more descriptive happy cracking message

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4a176c1a61ed279f4d98b6adf9be84fb905d921c
Commit: 4a176c1a61ed279f4d98b6adf9be84fb905d921c
Parent: 5d78a84913abc1b2ef1ec0c14a78ec99517cc122
Author: Patrick McHardy [EMAIL PROTECTED]
AuthorDate: Thu May 10 14:16:56 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:47:59 2007 -0700

[NETFILTER]: iptable_{filter,mangle}: more descriptive happy cracking 
message

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/netfilter/iptable_filter.c |3 ++-
 net/ipv4/netfilter/iptable_mangle.c |3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/netfilter/iptable_filter.c 
b/net/ipv4/netfilter/iptable_filter.c
index ea14979..4f51c1d 100644
--- a/net/ipv4/netfilter/iptable_filter.c
+++ b/net/ipv4/netfilter/iptable_filter.c
@@ -81,7 +81,8 @@ ipt_local_out_hook(unsigned int hook,
if ((*pskb)-len  sizeof(struct iphdr)
|| ip_hdrlen(*pskb)  sizeof(struct iphdr)) {
if (net_ratelimit())
-   printk(ipt_hook: happy cracking.\n);
+   printk(iptable_filter: ignoring short SOCK_RAW 
+  packet.\n);
return NF_ACCEPT;
}
 
diff --git a/net/ipv4/netfilter/iptable_mangle.c 
b/net/ipv4/netfilter/iptable_mangle.c
index c3827ba..902446f 100644
--- a/net/ipv4/netfilter/iptable_mangle.c
+++ b/net/ipv4/netfilter/iptable_mangle.c
@@ -100,7 +100,8 @@ ipt_local_hook(unsigned int hook,
if ((*pskb)-len  sizeof(struct iphdr)
|| ip_hdrlen(*pskb)  sizeof(struct iphdr)) {
if (net_ratelimit())
-   printk(ipt_hook: happy cracking.\n);
+   printk(iptable_mangle: ignoring short SOCK_RAW 
+  packet.\n);
return NF_ACCEPT;
}
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETFILTER]: iptable_raw: ignore short packets sent by SOCK_RAW sockets

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=802169a4b0f71d25a0f798a9c0657a565b1e79bc
Commit: 802169a4b0f71d25a0f798a9c0657a565b1e79bc
Parent: 4a176c1a61ed279f4d98b6adf9be84fb905d921c
Author: Patrick McHardy [EMAIL PROTECTED]
AuthorDate: Thu May 10 14:17:36 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:47:59 2007 -0700

[NETFILTER]: iptable_raw: ignore short packets sent by SOCK_RAW sockets

iptables matches and targets expect packets to have at least a full
IP header and a valid header length. Ignore packets sent through
raw sockets for which this isn't true as in the other tables.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/ipv4/netfilter/iptable_raw.c |   21 -
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/netfilter/iptable_raw.c b/net/ipv4/netfilter/iptable_raw.c
index f7d28fd..d6e5033 100644
--- a/net/ipv4/netfilter/iptable_raw.c
+++ b/net/ipv4/netfilter/iptable_raw.c
@@ -5,6 +5,7 @@
  */
 #include linux/module.h
 #include linux/netfilter_ipv4/ip_tables.h
+#include net/ip.h
 
 #define RAW_VALID_HOOKS ((1  NF_IP_PRE_ROUTING) | (1  NF_IP_LOCAL_OUT))
 
@@ -54,6 +55,24 @@ ipt_hook(unsigned int hook,
return ipt_do_table(pskb, hook, in, out, packet_raw);
 }
 
+static unsigned int
+ipt_local_hook(unsigned int hook,
+  struct sk_buff **pskb,
+  const struct net_device *in,
+  const struct net_device *out,
+  int (*okfn)(struct sk_buff *))
+{
+   /* root is playing with raw sockets. */
+   if ((*pskb)-len  sizeof(struct iphdr) ||
+   ip_hdrlen(*pskb)  sizeof(struct iphdr)) {
+   if (net_ratelimit())
+   printk(iptable_raw: ignoring short SOCK_RAW
+  packet.\n);
+   return NF_ACCEPT;
+   }
+   return ipt_do_table(pskb, hook, in, out, packet_raw);
+}
+
 /* 'raw' is the very first table. */
 static struct nf_hook_ops ipt_ops[] = {
{
@@ -64,7 +83,7 @@ static struct nf_hook_ops ipt_ops[] = {
.owner = THIS_MODULE,
},
{
-   .hook = ipt_hook,
+   .hook = ipt_local_hook,
.pf = PF_INET,
.hooknum = NF_IP_LOCAL_OUT,
.priority = NF_IP_PRI_RAW,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[NETFILTER]: xt_conntrack: add compat support

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=da0dd231436ba7e81789e93dd933d7a275e1709d
Commit: da0dd231436ba7e81789e93dd933d7a275e1709d
Parent: 802169a4b0f71d25a0f798a9c0657a565b1e79bc
Author: Patrick McHardy [EMAIL PROTECTED]
AuthorDate: Thu May 10 14:17:58 2007 -0700
Committer:  David S. Miller [EMAIL PROTECTED]
CommitDate: Thu May 10 23:48:00 2007 -0700

[NETFILTER]: xt_conntrack: add compat support

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]
Signed-off-by: David S. Miller [EMAIL PROTECTED]
---
 net/netfilter/xt_conntrack.c |   54 ++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/net/netfilter/xt_conntrack.c b/net/netfilter/xt_conntrack.c
index f4ea8fe..189ded5 100644
--- a/net/netfilter/xt_conntrack.c
+++ b/net/netfilter/xt_conntrack.c
@@ -134,12 +134,66 @@ static void destroy(const struct xt_match *match, void 
*matchinfo)
nf_ct_l3proto_module_put(match-family);
 }
 
+#ifdef CONFIG_COMPAT
+struct compat_xt_conntrack_info
+{
+   compat_uint_t   statemask;
+   compat_uint_t   statusmask;
+   struct ip_conntrack_old_tuple   tuple[IP_CT_DIR_MAX];
+   struct in_addr  sipmsk[IP_CT_DIR_MAX];
+   struct in_addr  dipmsk[IP_CT_DIR_MAX];
+   compat_ulong_t  expires_min;
+   compat_ulong_t  expires_max;
+   u_int8_tflags;
+   u_int8_tinvflags;
+};
+
+static void compat_from_user(void *dst, void *src)
+{
+   struct compat_xt_conntrack_info *cm = src;
+   struct xt_conntrack_info m = {
+   .statemask  = cm-statemask,
+   .statusmask = cm-statusmask,
+   .expires_min= cm-expires_min,
+   .expires_max= cm-expires_max,
+   .flags  = cm-flags,
+   .invflags   = cm-invflags,
+   };
+   memcpy(m.tuple, cm-tuple, sizeof(m.tuple));
+   memcpy(m.sipmsk, cm-sipmsk, sizeof(m.sipmsk));
+   memcpy(m.dipmsk, cm-dipmsk, sizeof(m.dipmsk));
+   memcpy(dst, m, sizeof(m));
+}
+
+static int compat_to_user(void __user *dst, void *src)
+{
+   struct xt_conntrack_info *m = src;
+   struct compat_xt_conntrack_info cm = {
+   .statemask  = m-statemask,
+   .statusmask = m-statusmask,
+   .expires_min= m-expires_min,
+   .expires_max= m-expires_max,
+   .flags  = m-flags,
+   .invflags   = m-invflags,
+   };
+   memcpy(cm.tuple, m-tuple, sizeof(cm.tuple));
+   memcpy(cm.sipmsk, m-sipmsk, sizeof(cm.sipmsk));
+   memcpy(cm.dipmsk, m-dipmsk, sizeof(cm.dipmsk));
+   return copy_to_user(dst, cm, sizeof(cm)) ? -EFAULT : 0;
+}
+#endif
+
 static struct xt_match conntrack_match = {
.name   = conntrack,
.match  = match,
.checkentry = checkentry,
.destroy= destroy,
.matchsize  = sizeof(struct xt_conntrack_info),
+#ifdef CONFIG_COMPAT
+   .compatsize = sizeof(struct compat_xt_conntrack_info),
+   .compat_from_user = compat_from_user,
+   .compat_to_user = compat_to_user,
+#endif
.family = AF_INET,
.me = THIS_MODULE,
 };
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


HID: add input mappings for non-working keys on Logitech S510 remote

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=529fa5473123a9e81e711a92e46fba732c4264ed
Commit: 529fa5473123a9e81e711a92e46fba732c4264ed
Parent: 36f021b579d195cdc5fa6f3e2bab198b4bf70643
Author: Charles Pillar [EMAIL PROTECTED]
AuthorDate: Thu May 3 17:30:12 2007 +0200
Committer:  Jiri Kosina [EMAIL PROTECTED]
CommitDate: Wed May 9 02:52:51 2007 +0200

HID: add input mappings for non-working keys on Logitech S510 remote

HID-input mapping for non-working S510 remote control buttons.

Signed-off-by: Charles Pillar [EMAIL PROTECTED]
Signed-off-by: Jiri Kosina [EMAIL PROTECTED]
---
 drivers/hid/hid-input.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index a19b65e..52de9a9 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -553,6 +553,7 @@ static void hidinput_configure_usage(struct hid_input 
*hidinput, struct hid_fiel
case 0x1015: map_key_clear(KEY_RECORD); 
break;
case 0x1016: map_key_clear(KEY_PLAYER); 
break;
case 0x1017: map_key_clear(KEY_EJECTCD);
break;
+   case 0x1018: map_key_clear(KEY_MEDIA);  
break;
case 0x1019: map_key_clear(KEY_PROG1);  
break;
case 0x101a: map_key_clear(KEY_PROG2);  
break;
case 0x101b: map_key_clear(KEY_PROG3);  
break;
@@ -560,9 +561,12 @@ static void hidinput_configure_usage(struct hid_input 
*hidinput, struct hid_fiel
case 0x1020: map_key_clear(KEY_ZOOMOUT);
break;
case 0x1021: map_key_clear(KEY_ZOOMRESET);  
break;
case 0x1023: map_key_clear(KEY_CLOSE);  
break;
+   case 0x1027: map_key_clear(KEY_MENU);   
break;
/* this one is marked as 'Rotate' */
case 0x1028: map_key_clear(KEY_ANGLE);  
break;
case 0x1029: map_key_clear(KEY_SHUFFLE);
break;
+   case 0x102a: map_key_clear(KEY_BACK);   
break;
+   case 0x102b: map_key_clear(KEY_CYCLEWINDOWS);   
break;
case 0x1041: map_key_clear(KEY_BATTERY);
break;
case 0x1042: map_key_clear(KEY_WORDPROCESSOR);  
break;
case 0x1043: map_key_clear(KEY_SPREADSHEET);
break;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


USB HID: update CONFIG_USB_HIDINPUT_POWERBOOK description

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=59e7e36c325b4d447a490ee163eac23025763681
Commit: 59e7e36c325b4d447a490ee163eac23025763681
Parent: 529fa5473123a9e81e711a92e46fba732c4264ed
Author: Noel Kothe [EMAIL PROTECTED]
AuthorDate: Mon May 7 23:26:03 2007 +0200
Committer:  Jiri Kosina [EMAIL PROTECTED]
CommitDate: Wed May 9 02:52:51 2007 +0200

USB HID: update CONFIG_USB_HIDINPUT_POWERBOOK description

This option is needed on the Apple Intel Laptops too.

Signed-off-by: Noel Kothe [EMAIL PROTECTED]
Signed-off-by: Jiri Kosina [EMAIL PROTECTED]
---
 drivers/hid/usbhid/Kconfig |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/usbhid/Kconfig b/drivers/hid/usbhid/Kconfig
index 7c87bdc..1b4b572 100644
--- a/drivers/hid/usbhid/Kconfig
+++ b/drivers/hid/usbhid/Kconfig
@@ -25,12 +25,12 @@ comment Input core support is needed for USB HID input 
layer or HIDBP support
depends on USB_HID  INPUT=n
 
 config USB_HIDINPUT_POWERBOOK
-   bool Enable support for iBook/PowerBook special keys
+   bool Enable support for iBook/PowerBook/MacBook/MacBookPro special 
keys
default n
depends on USB_HID
help
  Say Y here if you want support for the special keys (Fn, Numlock) on
- Apple iBooks and PowerBooks.
+ Apple iBooks, PowerBooks, MacBooks and MacBook Pros.
 
  If unsure, say N.
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Bluetooth HID: HIDP - don't initialize force feedback

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3b180bff4c606b2596c40b26f85af6bc7d8cc50b
Commit: 3b180bff4c606b2596c40b26f85af6bc7d8cc50b
Parent: 59e7e36c325b4d447a490ee163eac23025763681
Author: Jiri Kosina [EMAIL PROTECTED]
AuthorDate: Tue May 8 19:51:23 2007 +0200
Committer:  Jiri Kosina [EMAIL PROTECTED]
CommitDate: Wed May 9 02:52:51 2007 +0200

Bluetooth HID: HIDP - don't initialize force feedback

The current implementation of force feedback for HID devices is
USB-transport only and therefore calling hid_ff_init() from hidp code is
not going to work (plus it creates unwanted dependency of hidp on usbhid).
Remove the hid_ff_init() until either the hid-ff is made
transport-independent, or at least support for bluetooth transport is
added.

Signed-off-by: Jiri Kosina [EMAIL PROTECTED]
Signed-off-by: Marcel Holtmann [EMAIL PROTECTED]
---
 net/bluetooth/hidp/core.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index d342e89..3e77e81 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -737,10 +737,8 @@ static inline void hidp_setup_hid(struct hidp_session 
*session, struct hidp_conn
list_for_each_entry(report, 
hid-report_enum[HID_FEATURE_REPORT].report_list, list)
hidp_send_report(session, report);
 
-   if (hidinput_connect(hid) == 0) {
+   if (hidinput_connect(hid) == 0)
hid-claimed |= HID_CLAIMED_INPUT;
-   hid_ff_init(hid);
-   }
 }
 
 int hidp_add_connection(struct hidp_connadd_req *req, struct socket 
*ctrl_sock, struct socket *intr_sock)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


USB HID: report descriptor of Cypress USB barcode readers needs fixup

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=66da876962f782a3974b4a957d12f20656584a4d
Commit: 66da876962f782a3974b4a957d12f20656584a4d
Parent: 3b180bff4c606b2596c40b26f85af6bc7d8cc50b
Author: Jiri Kosina [EMAIL PROTECTED]
AuthorDate: Wed May 2 11:55:42 2007 +0200
Committer:  Jiri Kosina [EMAIL PROTECTED]
CommitDate: Wed May 9 02:52:51 2007 +0200

USB HID: report descriptor of Cypress USB barcode readers needs fixup

Certain versions of Cypress USB barcode readers (this problem is known to
happen at least with PIDs 0xde61 and 0xde64) have report descriptor which
has swapped usage min and usage max tag. This results in HID parser failing
for report descriptor of these devices, as it (wrongly) requires allocating
more usages than HID_MAX_USAGES.

Solve this by walking through the report descriptor for such devices, and 
swap
the usage min and usage max items (and their values) to be in proper order.

Reported-by: Bret Towe [EMAIL PROTECTED]
Signed-off-by: Jiri Kosina [EMAIL PROTECTED]
---
 drivers/hid/usbhid/hid-core.c   |   27 +++
 drivers/hid/usbhid/hid-quirks.c |5 +
 include/linux/hid.h |1 +
 3 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 91d6103..1c0bd48 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -692,6 +692,30 @@ static void hid_fixup_logitech_descriptor(unsigned char 
*rdesc, int rsize)
}
 }
 
+/*
+ * Some USB barcode readers from cypress have usage min and usage max in
+ * the wrong order
+ */
+static void hid_fixup_cypress_descriptor(unsigned char *rdesc, int rsize)
+{
+   short fixed = 0;
+   int i;
+
+   for (i = 0; i  rsize - 4; i++) {
+   if (rdesc[i] == 0x29  rdesc [i+2] == 0x19) {
+   unsigned char tmp;
+
+   rdesc[i] = 0x19; rdesc[i+2] = 0x29;
+   tmp = rdesc[i+3];
+   rdesc[i+3] = rdesc[i+1];
+   rdesc[i+1] = tmp;
+   }
+   }
+
+   if (fixed)
+   info(Fixing up Cypress report descriptor);
+}
+
 static struct hid_device *usb_hid_configure(struct usb_interface *intf)
 {
struct usb_host_interface *interface = intf-cur_altsetting;
@@ -758,6 +782,9 @@ static struct hid_device *usb_hid_configure(struct 
usb_interface *intf)
if (quirks  HID_QUIRK_LOGITECH_DESCRIPTOR)
hid_fixup_logitech_descriptor(rdesc, rsize);
 
+   if (quirks  HID_QUIRK_SWAPPED_MIN_MAX)
+   hid_fixup_cypress_descriptor(rdesc, rsize);
+
 #ifdef CONFIG_HID_DEBUG
printk(KERN_DEBUG __FILE__ : report descriptor (size %u, read %d) = , 
rsize, n);
for (n = 0; n  rsize; n++)
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 17a8755..6216f60 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -92,6 +92,8 @@
 #define USB_DEVICE_ID_CYPRESS_MOUSE0x0001
 #define USB_DEVICE_ID_CYPRESS_HIDCOM   0x5500
 #define USB_DEVICE_ID_CYPRESS_ULTRAMOUSE   0x7417
+#define USB_DEVICE_ID_CYPRESS_BARCODE_10xde61
+#define USB_DEVICE_ID_CYPRESS_BARCODE_20xde64
 
 #define USB_VENDOR_ID_DELL 0x413c
 #define USB_DEVICE_ID_DELL_W7658   0x2005
@@ -445,6 +447,9 @@ static const struct hid_blacklist {
 
{ USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS },
 
+   { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1, 
HID_QUIRK_SWAPPED_MIN_MAX },
+   { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2, 
HID_QUIRK_SWAPPED_MIN_MAX },
+
{ 0, 0 }
 };
 
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 37076b1..827ee74 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -275,6 +275,7 @@ struct hid_item {
 #define HID_QUIRK_LOGITECH_DESCRIPTOR  0x0010
 #define HID_QUIRK_DUPLICATE_USAGES 0x0020
 #define HID_QUIRK_RESET_LEDS   0x0040
+#define HID_QUIRK_SWAPPED_MIN_MAX  0x0080
 
 /*
  * This is the global environment of the parser. This information is
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


USB HID: usb_buffer_free() cleanup

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6675c5bd2a0ec223888b42cf97bc7dc900bf31fb
Commit: 6675c5bd2a0ec223888b42cf97bc7dc900bf31fb
Parent: 66da876962f782a3974b4a957d12f20656584a4d
Author: Dmitry Torokhov [EMAIL PROTECTED]
AuthorDate: Thu May 3 01:04:52 2007 -0400
Committer:  Jiri Kosina [EMAIL PROTECTED]
CommitDate: Wed May 9 02:52:51 2007 +0200

USB HID: usb_buffer_free() cleanup

usb_buffer_free() now handles NULLs so remove unneeded checks
form callers.

Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED]
Signed-off-by: Jiri Kosina [EMAIL PROTECTED]
---
 drivers/hid/usbhid/hid-core.c |   12 
 drivers/hid/usbhid/usbkbd.c   |9 +++--
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 1c0bd48..d06b9e7 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -626,14 +626,10 @@ static void hid_free_buffers(struct usb_device *dev, 
struct hid_device *hid)
 {
struct usbhid_device *usbhid = hid-driver_data;
 
-   if (usbhid-inbuf)
-   usb_buffer_free(dev, usbhid-bufsize, usbhid-inbuf, 
usbhid-inbuf_dma);
-   if (usbhid-outbuf)
-   usb_buffer_free(dev, usbhid-bufsize, usbhid-outbuf, 
usbhid-outbuf_dma);
-   if (usbhid-cr)
-   usb_buffer_free(dev, sizeof(*(usbhid-cr)), usbhid-cr, 
usbhid-cr_dma);
-   if (usbhid-ctrlbuf)
-   usb_buffer_free(dev, usbhid-bufsize, usbhid-ctrlbuf, 
usbhid-ctrlbuf_dma);
+   usb_buffer_free(dev, usbhid-bufsize, usbhid-inbuf, usbhid-inbuf_dma);
+   usb_buffer_free(dev, usbhid-bufsize, usbhid-outbuf, 
usbhid-outbuf_dma);
+   usb_buffer_free(dev, sizeof(*(usbhid-cr)), usbhid-cr, usbhid-cr_dma);
+   usb_buffer_free(dev, usbhid-bufsize, usbhid-ctrlbuf, 
usbhid-ctrlbuf_dma);
 }
 
 /*
diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c
index 65aa12e..36ddc7a 100644
--- a/drivers/hid/usbhid/usbkbd.c
+++ b/drivers/hid/usbhid/usbkbd.c
@@ -211,12 +211,9 @@ static void usb_kbd_free_mem(struct usb_device *dev, 
struct usb_kbd *kbd)
 {
usb_free_urb(kbd-irq);
usb_free_urb(kbd-led);
-   if (kbd-new)
-   usb_buffer_free(dev, 8, kbd-new, kbd-new_dma);
-   if (kbd-cr)
-   usb_buffer_free(dev, sizeof(struct usb_ctrlrequest), kbd-cr, 
kbd-cr_dma);
-   if (kbd-leds)
-   usb_buffer_free(dev, 1, kbd-leds, kbd-leds_dma);
+   usb_buffer_free(dev, 8, kbd-new, kbd-new_dma);
+   usb_buffer_free(dev, sizeof(struct usb_ctrlrequest), kbd-cr, 
kbd-cr_dma);
+   usb_buffer_free(dev, 1, kbd-leds, kbd-leds_dma);
 }
 
 static int usb_kbd_probe(struct usb_interface *iface,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


USB HID: Logitech wheel 0x046d/0xc294 needs HID_QUIRK_NOGET quirk

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fed76ab3b206bd0c5a9e3be17cead0a22d7593c5
Commit: fed76ab3b206bd0c5a9e3be17cead0a22d7593c5
Parent: 6675c5bd2a0ec223888b42cf97bc7dc900bf31fb
Author: Jan Kratochvil [EMAIL PROTECTED]
AuthorDate: Wed May 9 02:50:49 2007 +0200
Committer:  Jiri Kosina [EMAIL PROTECTED]
CommitDate: Wed May 9 02:52:51 2007 +0200

USB HID: Logitech wheel 0x046d/0xc294 needs HID_QUIRK_NOGET quirk

Logitech wheel (product id 0xc294) doesn't like to be polled for reports,
otherwise it slows down initialization of this device to ten seconds.

This patch adds HID_QUIRK_NOGET flag for this wheel.

Signed-off-by: Jan Kratochvil [EMAIL PROTECTED]
Signed-off-by: Jiri Kosina [EMAIL PROTECTED]
---
 drivers/hid/usbhid/hid-quirks.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 6216f60..f6c4145 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -195,6 +195,7 @@
 
 #define USB_VENDOR_ID_LOGITECH 0x046d
 #define USB_DEVICE_ID_LOGITECH_RECEIVER0xc101
+#define USB_DEVICE_ID_LOGITECH_WHEEL   0xc294
 #define USB_DEVICE_ID_S510_RECEIVER0xc50c
 #define USB_DEVICE_ID_S510_RECEIVER_2  0xc517
 #define USB_DEVICE_ID_MX3000_RECEIVER  0xc513
@@ -424,6 +425,7 @@ static const struct hid_blacklist {
{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET },
+   { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL, HID_QUIRK_NOGET 
},
{ USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET 
},
{ USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET 
},
{ USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, 
HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


HID: switch to using input_dev-dev.parent

2007-05-11 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e071298589418076ef0a9813677f2d7032b65baa
Commit: e071298589418076ef0a9813677f2d7032b65baa
Parent: fed76ab3b206bd0c5a9e3be17cead0a22d7593c5
Author: Dmitry Torokhov [EMAIL PROTECTED]
AuthorDate: Wed May 9 10:17:31 2007 +0200
Committer:  Jiri Kosina [EMAIL PROTECTED]
CommitDate: Wed May 9 10:17:31 2007 +0200

HID: switch to using input_dev-dev.parent

In preparation for struct class_device - struct device input
core conversion switch to using input_dev-dev.parent when
specifying device position in sysfs tree.

Signed-off-by: Dmitry Torokhov [EMAIL PROTECTED]
Signed-off-by: Jiri Kosina [EMAIL PROTECTED]
---
 drivers/hid/hid-input.c   |   12 +++-
 drivers/hid/usbhid/hid-core.c |2 +-
 drivers/hid/usbhid/hid-lgff.c |2 +-
 drivers/hid/usbhid/hid-plff.c |2 +-
 drivers/hid/usbhid/hid-tmff.c |2 +-
 drivers/hid/usbhid/hid-zpff.c |2 +-
 drivers/hid/usbhid/usbkbd.c   |   12 ++--
 drivers/hid/usbhid/usbmouse.c |9 +
 8 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 52de9a9..a87b059 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -244,7 +244,7 @@ static void hidinput_configure_usage(struct hid_input 
*hidinput, struct hid_fiel
 struct hid_usage *usage)
 {
struct input_dev *input = hidinput-input;
-   struct hid_device *device = input-private;
+   struct hid_device *device = input_get_drvdata(input);
int max = 0, code;
unsigned long *bit = NULL;
 
@@ -859,13 +859,15 @@ EXPORT_SYMBOL_GPL(hidinput_find_field);
 
 static int hidinput_open(struct input_dev *dev)
 {
-   struct hid_device *hid = dev-private;
+   struct hid_device *hid = input_get_drvdata(dev);
+
return hid-hid_open(hid);
 }
 
 static void hidinput_close(struct input_dev *dev)
 {
-   struct hid_device *hid = dev-private;
+   struct hid_device *hid = input_get_drvdata(dev);
+
hid-hid_close(hid);
 }
 
@@ -913,7 +915,7 @@ int hidinput_connect(struct hid_device *hid)
return -1;
}
 
-   input_dev-private = hid;
+   input_set_drvdata(input_dev, hid);
input_dev-event = hid-hidinput_input_event;
input_dev-open = hidinput_open;
input_dev-close = hidinput_close;
@@ -925,7 +927,7 @@ int hidinput_connect(struct hid_device *hid)
input_dev-id.vendor  = hid-vendor;
input_dev-id.product = hid-product;
input_dev-id.version = hid-version;
-   input_dev-cdev.dev = hid-dev;
+   input_dev-dev.parent = hid-dev;
hidinput-input = input_dev;
list_add_tail(hidinput-list, hid-inputs);
}
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index d06b9e7..d91b9da 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -446,7 +446,7 @@ void usbhid_submit_report(struct hid_device *hid, struct 
hid_report *report, uns
 
 static int usb_hidinput_input_event(struct input_dev *dev, unsigned int type, 
unsigned int code, int value)
 {
-   struct hid_device *hid = dev-private;
+   struct hid_device *hid = input_get_drvdata(dev);
struct hid_field *field;
int offset;
 
diff --git a/drivers/hid/usbhid/hid-lgff.c b/drivers/hid/usbhid/hid-lgff.c
index 92d2553..c5cd410 100644
--- a/drivers/hid/usbhid/hid-lgff.c
+++ b/drivers/hid/usbhid/hid-lgff.c
@@ -60,7 +60,7 @@ static const struct dev_type devices[] = {
 
 static int hid_lgff_play(struct input_dev *dev, void *data, struct ff_effect 
*effect)
 {
-   struct hid_device *hid = dev-private;
+   struct hid_device *hid = input_get_drvdata(dev);
struct list_head *report_list = 
hid-report_enum[HID_OUTPUT_REPORT].report_list;
struct hid_report *report = list_entry(report_list-next, struct 
hid_report, list);
int x, y;
diff --git a/drivers/hid/usbhid/hid-plff.c b/drivers/hid/usbhid/hid-plff.c
index 76d2e6e..d6a8f2b 100644
--- a/drivers/hid/usbhid/hid-plff.c
+++ b/drivers/hid/usbhid/hid-plff.c
@@ -37,7 +37,7 @@ struct plff_device {
 static int hid_plff_play(struct input_dev *dev, void *data,
 struct ff_effect *effect)
 {
-   struct hid_device *hid = dev-private;
+   struct hid_device *hid = input_get_drvdata(dev);
struct plff_device *plff = data;
int left, right;
 
diff --git a/drivers/hid/usbhid/hid-tmff.c b/drivers/hid/usbhid/hid-tmff.c
index ab67331..ab5ba6e 100644
--- 

  1   2   3   4   >