[PATCH] kernel:signal.c Fix coding style errors and warnings.

2014-11-14 Thread Ionut Alexa
Fix various coding style errors and warnings as:
- space before tabs
- exiting a function from different points (else after return
  ..)

Signed-off-by: Ionut Alexa 
---
 kernel/signal.c |  104 +--
 1 file changed, 55 insertions(+), 49 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 8f0876f..226b41a 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -109,25 +109,28 @@ static inline int has_pending_signals(sigset_t *signal, 
sigset_t *blocked)
switch (_NSIG_WORDS) {
default:
for (i = _NSIG_WORDS, ready = 0; --i >= 0 ;)
-   ready |= signal->sig[i] &~ blocked->sig[i];
+   ready |= signal->sig[i] & ~blocked->sig[i];
break;
 
-   case 4: ready  = signal->sig[3] &~ blocked->sig[3];
-   ready |= signal->sig[2] &~ blocked->sig[2];
-   ready |= signal->sig[1] &~ blocked->sig[1];
-   ready |= signal->sig[0] &~ blocked->sig[0];
+   case 4:
+   ready  = signal->sig[3] & ~blocked->sig[3];
+   ready |= signal->sig[2] & ~blocked->sig[2];
+   ready |= signal->sig[1] & ~blocked->sig[1];
+   ready |= signal->sig[0] & ~blocked->sig[0];
break;
 
-   case 2: ready  = signal->sig[1] &~ blocked->sig[1];
-   ready |= signal->sig[0] &~ blocked->sig[0];
+   case 2:
+   ready  = signal->sig[1] & ~blocked->sig[1];
+   ready |= signal->sig[0] & ~blocked->sig[0];
break;
 
-   case 1: ready  = signal->sig[0] &~ blocked->sig[0];
+   case 1:
+   ready  = signal->sig[0] & ~blocked->sig[0];
}
return ready != 0;
 }
 
-#define PENDING(p,b) has_pending_signals(&(p)->signal, (b))
+#define PENDING(p, b) has_pending_signals(&(p)->signal, (b))
 
 static int recalc_sigpending_tsk(struct task_struct *t)
 {
@@ -180,7 +183,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
 * Handle the first word specially: it contains the
 * synchronous signals that need to be dequeued first.
 */
-   x = *s &~ *m;
+   x = *s & ~*m;
if (x) {
if (x & SYNCHRONOUS_MASK)
x &= SYNCHRONOUS_MASK;
@@ -191,7 +194,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
switch (_NSIG_WORDS) {
default:
for (i = 1; i < _NSIG_WORDS; ++i) {
-   x = *++s &~ *++m;
+   x = *++s & ~*++m;
if (!x)
continue;
sig = ffz(~x) + i*_NSIG_BPW + 1;
@@ -200,7 +203,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
break;
 
case 2:
-   x = s[1] &~ m[1];
+   x = s[1] & ~m[1];
if (!x)
break;
sig = ffz(~x) + _NSIG_BPW + 1;
@@ -224,8 +227,8 @@ static inline void print_dropped_signal(int sig)
if (!__ratelimit(_state))
return;
 
-   printk(KERN_INFO "%s/%d: reached RLIMIT_SIGPENDING, dropped signal 
%d\n",
-   current->comm, current->pid, sig);
+   pr_info("%s/%d: reached RLIMIT_SIGPENDING, dropped signal %d\n",
+   current->comm, current->pid, sig);
 }
 
 /**
@@ -936,7 +939,7 @@ static void complete_signal(int sig, struct task_struct *p, 
int group)
 * There is just one thread and it does not need to be woken.
 * It will dequeue unblocked signals before it runs again.
 */
-   return;
+   goto exit_func;
else {
/*
 * Otherwise try to find a suitable thread.
@@ -950,7 +953,7 @@ static void complete_signal(int sig, struct task_struct *p, 
int group)
 * Any eligible threads will see
 * the signal in the queue soon.
 */
-   return;
+   goto exit_func;
}
signal->curr_target = t;
}
@@ -982,7 +985,7 @@ static void complete_signal(int sig, struct task_struct *p, 
int group)
sigaddset(>pending.signal, SIGKILL);
signal_wake_up(t, 1);
} while_each_thread(p, t);
-   return;
+   goto exit_func;
}
}
 
@@ -991,6 +994,7 @@ static void complete_signal(int sig, struct task_struct 

[PATCH] kernel:signal.c Fix coding style errors and warnings.

2014-11-14 Thread Ionut Alexa
Fix various coding style errors and warnings as:
- space before tabs
- exiting a function from different points (else after return
  ..)

Signed-off-by: Ionut Alexa ionut.m.al...@gmail.com
---
 kernel/signal.c |  104 +--
 1 file changed, 55 insertions(+), 49 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 8f0876f..226b41a 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -109,25 +109,28 @@ static inline int has_pending_signals(sigset_t *signal, 
sigset_t *blocked)
switch (_NSIG_WORDS) {
default:
for (i = _NSIG_WORDS, ready = 0; --i = 0 ;)
-   ready |= signal-sig[i] ~ blocked-sig[i];
+   ready |= signal-sig[i]  ~blocked-sig[i];
break;
 
-   case 4: ready  = signal-sig[3] ~ blocked-sig[3];
-   ready |= signal-sig[2] ~ blocked-sig[2];
-   ready |= signal-sig[1] ~ blocked-sig[1];
-   ready |= signal-sig[0] ~ blocked-sig[0];
+   case 4:
+   ready  = signal-sig[3]  ~blocked-sig[3];
+   ready |= signal-sig[2]  ~blocked-sig[2];
+   ready |= signal-sig[1]  ~blocked-sig[1];
+   ready |= signal-sig[0]  ~blocked-sig[0];
break;
 
-   case 2: ready  = signal-sig[1] ~ blocked-sig[1];
-   ready |= signal-sig[0] ~ blocked-sig[0];
+   case 2:
+   ready  = signal-sig[1]  ~blocked-sig[1];
+   ready |= signal-sig[0]  ~blocked-sig[0];
break;
 
-   case 1: ready  = signal-sig[0] ~ blocked-sig[0];
+   case 1:
+   ready  = signal-sig[0]  ~blocked-sig[0];
}
return ready != 0;
 }
 
-#define PENDING(p,b) has_pending_signals((p)-signal, (b))
+#define PENDING(p, b) has_pending_signals((p)-signal, (b))
 
 static int recalc_sigpending_tsk(struct task_struct *t)
 {
@@ -180,7 +183,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
 * Handle the first word specially: it contains the
 * synchronous signals that need to be dequeued first.
 */
-   x = *s ~ *m;
+   x = *s  ~*m;
if (x) {
if (x  SYNCHRONOUS_MASK)
x = SYNCHRONOUS_MASK;
@@ -191,7 +194,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
switch (_NSIG_WORDS) {
default:
for (i = 1; i  _NSIG_WORDS; ++i) {
-   x = *++s ~ *++m;
+   x = *++s  ~*++m;
if (!x)
continue;
sig = ffz(~x) + i*_NSIG_BPW + 1;
@@ -200,7 +203,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
break;
 
case 2:
-   x = s[1] ~ m[1];
+   x = s[1]  ~m[1];
if (!x)
break;
sig = ffz(~x) + _NSIG_BPW + 1;
@@ -224,8 +227,8 @@ static inline void print_dropped_signal(int sig)
if (!__ratelimit(ratelimit_state))
return;
 
-   printk(KERN_INFO %s/%d: reached RLIMIT_SIGPENDING, dropped signal 
%d\n,
-   current-comm, current-pid, sig);
+   pr_info(%s/%d: reached RLIMIT_SIGPENDING, dropped signal %d\n,
+   current-comm, current-pid, sig);
 }
 
 /**
@@ -936,7 +939,7 @@ static void complete_signal(int sig, struct task_struct *p, 
int group)
 * There is just one thread and it does not need to be woken.
 * It will dequeue unblocked signals before it runs again.
 */
-   return;
+   goto exit_func;
else {
/*
 * Otherwise try to find a suitable thread.
@@ -950,7 +953,7 @@ static void complete_signal(int sig, struct task_struct *p, 
int group)
 * Any eligible threads will see
 * the signal in the queue soon.
 */
-   return;
+   goto exit_func;
}
signal-curr_target = t;
}
@@ -982,7 +985,7 @@ static void complete_signal(int sig, struct task_struct *p, 
int group)
sigaddset(t-pending.signal, SIGKILL);
signal_wake_up(t, 1);
} while_each_thread(p, t);
-   return;
+   goto exit_func;
}
}
 
@@ -991,6 +994,7 @@ static void complete_signal(int sig, struct task_struct *p, 
int group)
 * Tell the chosen thread to wake up and dequeue it.
 */
signal_wake_up(t, sig == SIGKILL);
+exit_func:
return;
 }
 
@@ -1140,10 +1144,10 @@ static int send_signal(int sig, struct siginfo *info, 
struct task_struct *t,
 static void

[PATCH] kernel:module Fix coding style errors and warnings.

2014-10-17 Thread Ionut Alexa
Fixed codin style errors and warnings. Changes printk with
print_debug/warn. Changed seq_printf to seq_puts.

Signed-off-by: Ionut Alexa 
---
 kernel/module.c |   58 ---
 1 file changed, 30 insertions(+), 28 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index 65586ff..b19ea41 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -158,13 +158,13 @@ static BLOCKING_NOTIFIER_HEAD(module_notify_list);
  * Protected by module_mutex. */
 static unsigned long module_addr_min = -1UL, module_addr_max = 0;
 
-int register_module_notifier(struct notifier_block * nb)
+int register_module_notifier(struct notifier_block *nb)
 {
return blocking_notifier_chain_register(_notify_list, nb);
 }
 EXPORT_SYMBOL(register_module_notifier);
 
-int unregister_module_notifier(struct notifier_block * nb)
+int unregister_module_notifier(struct notifier_block *nb)
 {
return blocking_notifier_chain_unregister(_notify_list, nb);
 }
@@ -740,8 +740,7 @@ static inline int try_force_unload(unsigned int flags)
 }
 #endif /* CONFIG_MODULE_FORCE_UNLOAD */
 
-struct stopref
-{
+struct stopref {
struct module *mod;
int flags;
int *forced;
@@ -877,8 +876,10 @@ static inline void print_unload_info(struct seq_file *m, 
struct module *mod)
 
seq_printf(m, " %lu ", module_refcount(mod));
 
-   /* Always include a trailing , so userspace can differentiate
-   between this and the old multi-field proc format. */
+   /*
+* Always include a trailing , so userspace can differentiate
+* between this and the old multi-field proc format.
+*/
list_for_each_entry(use, >source_list, source_list) {
printed_something = 1;
seq_printf(m, "%s,", use->source->name);
@@ -886,11 +887,11 @@ static inline void print_unload_info(struct seq_file *m, 
struct module *mod)
 
if (mod->init != NULL && mod->exit == NULL) {
printed_something = 1;
-   seq_printf(m, "[permanent],");
+   seq_puts(m, "[permanent],");
}
 
if (!printed_something)
-   seq_printf(m, "-");
+   seq_puts(m, "-");
 }
 
 void __symbol_put(const char *symbol)
@@ -978,7 +979,7 @@ EXPORT_SYMBOL(module_put);
 static inline void print_unload_info(struct seq_file *m, struct module *mod)
 {
/* We don't know the usage count, or what modules are using. */
-   seq_printf(m, " - -");
+   seq_puts(m, " - -");
 }
 
 static inline void module_unload_free(struct module *mod)
@@ -1131,7 +1132,7 @@ static unsigned long maybe_relocated(unsigned long crc,
 static int check_version(Elf_Shdr *sechdrs,
 unsigned int versindex,
 const char *symname,
-struct module *mod, 
+struct module *mod,
 const unsigned long *crc,
 const struct module *crc_owner)
 {
@@ -1165,7 +1166,7 @@ static int check_version(Elf_Shdr *sechdrs,
return 0;
 
 bad_version:
-   printk("%s: disagrees about version of symbol %s\n",
+   pr_warn("%s: disagrees about version of symbol %s\n",
   mod->name, symname);
return 0;
 }
@@ -1200,7 +1201,7 @@ static inline int same_magic(const char *amagic, const 
char *bmagic,
 static inline int check_version(Elf_Shdr *sechdrs,
unsigned int versindex,
const char *symname,
-   struct module *mod, 
+   struct module *mod,
const unsigned long *crc,
const struct module *crc_owner)
 {
@@ -1288,15 +1289,13 @@ static inline bool sect_empty(const Elf_Shdr *sect)
return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0;
 }
 
-struct module_sect_attr
-{
+struct module_sect_attr {
struct module_attribute mattr;
char *name;
unsigned long address;
 };
 
-struct module_sect_attrs
-{
+struct module_sect_attrs {
struct attribute_group grp;
unsigned int nsections;
struct module_sect_attr attrs[0];
@@ -1550,7 +1549,8 @@ static int module_add_modinfo_attrs(struct module *mod)
(attr->test && attr->test(mod))) {
memcpy(temp_attr, attr, sizeof(*temp_attr));
sysfs_attr_init(_attr->attr);
-   error = 
sysfs_create_file(>mkobj.kobj,_attr->attr);
+   error = sysfs_create_file(>mkobj.kobj,
+   _attr->attr);
++temp_attr;
}
}
@@ -1566,7 +1566,7 @@ static void module_rem

[PATCH] kernel:module Fix coding style errors and warnings.

2014-10-17 Thread Ionut Alexa
Fixed codin style errors and warnings. Changes printk with
print_debug/warn. Changed seq_printf to seq_puts.

Signed-off-by: Ionut Alexa ionut.m.al...@gmail.com
---
 kernel/module.c |   58 ---
 1 file changed, 30 insertions(+), 28 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index 65586ff..b19ea41 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -158,13 +158,13 @@ static BLOCKING_NOTIFIER_HEAD(module_notify_list);
  * Protected by module_mutex. */
 static unsigned long module_addr_min = -1UL, module_addr_max = 0;
 
-int register_module_notifier(struct notifier_block * nb)
+int register_module_notifier(struct notifier_block *nb)
 {
return blocking_notifier_chain_register(module_notify_list, nb);
 }
 EXPORT_SYMBOL(register_module_notifier);
 
-int unregister_module_notifier(struct notifier_block * nb)
+int unregister_module_notifier(struct notifier_block *nb)
 {
return blocking_notifier_chain_unregister(module_notify_list, nb);
 }
@@ -740,8 +740,7 @@ static inline int try_force_unload(unsigned int flags)
 }
 #endif /* CONFIG_MODULE_FORCE_UNLOAD */
 
-struct stopref
-{
+struct stopref {
struct module *mod;
int flags;
int *forced;
@@ -877,8 +876,10 @@ static inline void print_unload_info(struct seq_file *m, 
struct module *mod)
 
seq_printf(m,  %lu , module_refcount(mod));
 
-   /* Always include a trailing , so userspace can differentiate
-   between this and the old multi-field proc format. */
+   /*
+* Always include a trailing , so userspace can differentiate
+* between this and the old multi-field proc format.
+*/
list_for_each_entry(use, mod-source_list, source_list) {
printed_something = 1;
seq_printf(m, %s,, use-source-name);
@@ -886,11 +887,11 @@ static inline void print_unload_info(struct seq_file *m, 
struct module *mod)
 
if (mod-init != NULL  mod-exit == NULL) {
printed_something = 1;
-   seq_printf(m, [permanent],);
+   seq_puts(m, [permanent],);
}
 
if (!printed_something)
-   seq_printf(m, -);
+   seq_puts(m, -);
 }
 
 void __symbol_put(const char *symbol)
@@ -978,7 +979,7 @@ EXPORT_SYMBOL(module_put);
 static inline void print_unload_info(struct seq_file *m, struct module *mod)
 {
/* We don't know the usage count, or what modules are using. */
-   seq_printf(m,  - -);
+   seq_puts(m,  - -);
 }
 
 static inline void module_unload_free(struct module *mod)
@@ -1131,7 +1132,7 @@ static unsigned long maybe_relocated(unsigned long crc,
 static int check_version(Elf_Shdr *sechdrs,
 unsigned int versindex,
 const char *symname,
-struct module *mod, 
+struct module *mod,
 const unsigned long *crc,
 const struct module *crc_owner)
 {
@@ -1165,7 +1166,7 @@ static int check_version(Elf_Shdr *sechdrs,
return 0;
 
 bad_version:
-   printk(%s: disagrees about version of symbol %s\n,
+   pr_warn(%s: disagrees about version of symbol %s\n,
   mod-name, symname);
return 0;
 }
@@ -1200,7 +1201,7 @@ static inline int same_magic(const char *amagic, const 
char *bmagic,
 static inline int check_version(Elf_Shdr *sechdrs,
unsigned int versindex,
const char *symname,
-   struct module *mod, 
+   struct module *mod,
const unsigned long *crc,
const struct module *crc_owner)
 {
@@ -1288,15 +1289,13 @@ static inline bool sect_empty(const Elf_Shdr *sect)
return !(sect-sh_flags  SHF_ALLOC) || sect-sh_size == 0;
 }
 
-struct module_sect_attr
-{
+struct module_sect_attr {
struct module_attribute mattr;
char *name;
unsigned long address;
 };
 
-struct module_sect_attrs
-{
+struct module_sect_attrs {
struct attribute_group grp;
unsigned int nsections;
struct module_sect_attr attrs[0];
@@ -1550,7 +1549,8 @@ static int module_add_modinfo_attrs(struct module *mod)
(attr-test  attr-test(mod))) {
memcpy(temp_attr, attr, sizeof(*temp_attr));
sysfs_attr_init(temp_attr-attr);
-   error = 
sysfs_create_file(mod-mkobj.kobj,temp_attr-attr);
+   error = sysfs_create_file(mod-mkobj.kobj,
+   temp_attr-attr);
++temp_attr;
}
}
@@ -1566,7 +1566,7 @@ static void module_remove_modinfo_attrs(struct module 
*mod)
/* pick a field to test for end of list */
if (!attr-attr.name)
break

[PATCH] kernel:module Fix coding style errors and warnings.

2014-10-16 Thread Ionut Alexa
Fixed codin style errors and warnings. Changes printk with
print_debug/warn. Changed seq_printf to seq_puts.

Signed-off-by: Ionut Alexa 
---
 kernel/module.c |   54 ++
 1 file changed, 26 insertions(+), 28 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index 65586ff..9fb16f7 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -110,7 +110,7 @@ struct list_head *kdb_modules =  /* kdb needs the 
list of modules */
 #ifdef CONFIG_MODULE_SIG_FORCE
 static bool sig_enforce = true;
 #else
-static bool sig_enforce = false;
+static bool sig_enforce; /* by default set to false */
 
 static int param_set_bool_enable_only(const char *val,
  const struct kernel_param *kp)
@@ -156,15 +156,15 @@ static BLOCKING_NOTIFIER_HEAD(module_notify_list);
 
 /* Bounds of module allocation, for speeding __module_address.
  * Protected by module_mutex. */
-static unsigned long module_addr_min = -1UL, module_addr_max = 0;
+static unsigned long module_addr_min = -1UL, module_addr_max; /* addr_max=0 */
 
-int register_module_notifier(struct notifier_block * nb)
+int register_module_notifier(struct notifier_block *nb)
 {
return blocking_notifier_chain_register(_notify_list, nb);
 }
 EXPORT_SYMBOL(register_module_notifier);
 
-int unregister_module_notifier(struct notifier_block * nb)
+int unregister_module_notifier(struct notifier_block *nb)
 {
return blocking_notifier_chain_unregister(_notify_list, nb);
 }
@@ -740,8 +740,7 @@ static inline int try_force_unload(unsigned int flags)
 }
 #endif /* CONFIG_MODULE_FORCE_UNLOAD */
 
-struct stopref
-{
+struct stopref {
struct module *mod;
int flags;
int *forced;
@@ -878,7 +877,7 @@ static inline void print_unload_info(struct seq_file *m, 
struct module *mod)
seq_printf(m, " %lu ", module_refcount(mod));
 
/* Always include a trailing , so userspace can differentiate
-   between this and the old multi-field proc format. */
+* between this and the old multi-field proc format. */
list_for_each_entry(use, >source_list, source_list) {
printed_something = 1;
seq_printf(m, "%s,", use->source->name);
@@ -886,11 +885,11 @@ static inline void print_unload_info(struct seq_file *m, 
struct module *mod)
 
if (mod->init != NULL && mod->exit == NULL) {
printed_something = 1;
-   seq_printf(m, "[permanent],");
+   seq_puts(m, "[permanent],");
}
 
if (!printed_something)
-   seq_printf(m, "-");
+   seq_puts(m, "-");
 }
 
 void __symbol_put(const char *symbol)
@@ -978,7 +977,7 @@ EXPORT_SYMBOL(module_put);
 static inline void print_unload_info(struct seq_file *m, struct module *mod)
 {
/* We don't know the usage count, or what modules are using. */
-   seq_printf(m, " - -");
+   seq_puts(m, " - -");
 }
 
 static inline void module_unload_free(struct module *mod)
@@ -1131,7 +1130,7 @@ static unsigned long maybe_relocated(unsigned long crc,
 static int check_version(Elf_Shdr *sechdrs,
 unsigned int versindex,
 const char *symname,
-struct module *mod, 
+struct module *mod,
 const unsigned long *crc,
 const struct module *crc_owner)
 {
@@ -1165,7 +1164,7 @@ static int check_version(Elf_Shdr *sechdrs,
return 0;
 
 bad_version:
-   printk("%s: disagrees about version of symbol %s\n",
+   pr_warn("%s: disagrees about version of symbol %s\n",
   mod->name, symname);
return 0;
 }
@@ -1200,7 +1199,7 @@ static inline int same_magic(const char *amagic, const 
char *bmagic,
 static inline int check_version(Elf_Shdr *sechdrs,
unsigned int versindex,
const char *symname,
-   struct module *mod, 
+   struct module *mod,
const unsigned long *crc,
const struct module *crc_owner)
 {
@@ -1288,15 +1287,13 @@ static inline bool sect_empty(const Elf_Shdr *sect)
return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0;
 }
 
-struct module_sect_attr
-{
+struct module_sect_attr {
struct module_attribute mattr;
char *name;
unsigned long address;
 };
 
-struct module_sect_attrs
-{
+struct module_sect_attrs {
struct attribute_group grp;
unsigned int nsections;
struct module_sect_attr attrs[0];
@@ -1550,7 +1547,8 @@ static int module_add_modinfo_attrs(struct module *mod)
(attr->test && attr->test(mod))) {
memcpy(temp

[PATCH] kernel:module Fix coding style errors and warnings.

2014-10-16 Thread Ionut Alexa
Fixed codin style errors and warnings. Changes printk with
print_debug/warn. Changed seq_printf to seq_puts.

Signed-off-by: Ionut Alexa 
---
 kernel/module.c |   53 +
 1 file changed, 25 insertions(+), 28 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index 65586ff..bd159b5 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -110,7 +110,7 @@ struct list_head *kdb_modules =  /* kdb needs the 
list of modules */
 #ifdef CONFIG_MODULE_SIG_FORCE
 static bool sig_enforce = true;
 #else
-static bool sig_enforce = false;
+static bool sig_enforce; /* by default set to false */
 
 static int param_set_bool_enable_only(const char *val,
  const struct kernel_param *kp)
@@ -156,15 +156,15 @@ static BLOCKING_NOTIFIER_HEAD(module_notify_list);
 
 /* Bounds of module allocation, for speeding __module_address.
  * Protected by module_mutex. */
-static unsigned long module_addr_min = -1UL, module_addr_max = 0;
+static unsigned long module_addr_min = -1UL, module_addr_max; /* addr_max=0 */
 
-int register_module_notifier(struct notifier_block * nb)
+int register_module_notifier(struct notifier_block *nb)
 {
return blocking_notifier_chain_register(_notify_list, nb);
 }
 EXPORT_SYMBOL(register_module_notifier);
 
-int unregister_module_notifier(struct notifier_block * nb)
+int unregister_module_notifier(struct notifier_block *nb)
 {
return blocking_notifier_chain_unregister(_notify_list, nb);
 }
@@ -740,8 +740,7 @@ static inline int try_force_unload(unsigned int flags)
 }
 #endif /* CONFIG_MODULE_FORCE_UNLOAD */
 
-struct stopref
-{
+struct stopref{
struct module *mod;
int flags;
int *forced;
@@ -878,7 +877,7 @@ static inline void print_unload_info(struct seq_file *m, 
struct module *mod)
seq_printf(m, " %lu ", module_refcount(mod));
 
/* Always include a trailing , so userspace can differentiate
-   between this and the old multi-field proc format. */
+* between this and the old multi-field proc format. */
list_for_each_entry(use, >source_list, source_list) {
printed_something = 1;
seq_printf(m, "%s,", use->source->name);
@@ -886,11 +885,11 @@ static inline void print_unload_info(struct seq_file *m, 
struct module *mod)
 
if (mod->init != NULL && mod->exit == NULL) {
printed_something = 1;
-   seq_printf(m, "[permanent],");
+   seq_puts(m, "[permanent],");
}
 
if (!printed_something)
-   seq_printf(m, "-");
+   seq_puts(m, "-");
 }
 
 void __symbol_put(const char *symbol)
@@ -978,7 +977,7 @@ EXPORT_SYMBOL(module_put);
 static inline void print_unload_info(struct seq_file *m, struct module *mod)
 {
/* We don't know the usage count, or what modules are using. */
-   seq_printf(m, " - -");
+   seq_puts(m, " - -");
 }
 
 static inline void module_unload_free(struct module *mod)
@@ -1131,7 +1130,7 @@ static unsigned long maybe_relocated(unsigned long crc,
 static int check_version(Elf_Shdr *sechdrs,
 unsigned int versindex,
 const char *symname,
-struct module *mod, 
+struct module *mod,
 const unsigned long *crc,
 const struct module *crc_owner)
 {
@@ -1165,7 +1164,7 @@ static int check_version(Elf_Shdr *sechdrs,
return 0;
 
 bad_version:
-   printk("%s: disagrees about version of symbol %s\n",
+   pr_warn("%s: disagrees about version of symbol %s\n",
   mod->name, symname);
return 0;
 }
@@ -1200,7 +1199,7 @@ static inline int same_magic(const char *amagic, const 
char *bmagic,
 static inline int check_version(Elf_Shdr *sechdrs,
unsigned int versindex,
const char *symname,
-   struct module *mod, 
+   struct module *mod,
const unsigned long *crc,
const struct module *crc_owner)
 {
@@ -1288,15 +1287,13 @@ static inline bool sect_empty(const Elf_Shdr *sect)
return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0;
 }
 
-struct module_sect_attr
-{
+struct module_sect_attr {
struct module_attribute mattr;
char *name;
unsigned long address;
 };
 
-struct module_sect_attrs
-{
+struct module_sect_attrs {
struct attribute_group grp;
unsigned int nsections;
struct module_sect_attr attrs[0];
@@ -1550,7 +1547,7 @@ static int module_add_modinfo_attrs(struct module *mod)
(attr->test && attr->test(mod))) {
memcpy(temp

[PATCH] kernel:module Fix coding style errors and warnings.

2014-10-16 Thread Ionut Alexa
Fixed codin style errors and warnings. Changes printk with
print_debug/warn. Changed seq_printf to seq_puts.

Signed-off-by: Ionut Alexa ionut.m.al...@gmail.com
---
 kernel/module.c |   53 +
 1 file changed, 25 insertions(+), 28 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index 65586ff..bd159b5 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -110,7 +110,7 @@ struct list_head *kdb_modules = modules; /* kdb needs the 
list of modules */
 #ifdef CONFIG_MODULE_SIG_FORCE
 static bool sig_enforce = true;
 #else
-static bool sig_enforce = false;
+static bool sig_enforce; /* by default set to false */
 
 static int param_set_bool_enable_only(const char *val,
  const struct kernel_param *kp)
@@ -156,15 +156,15 @@ static BLOCKING_NOTIFIER_HEAD(module_notify_list);
 
 /* Bounds of module allocation, for speeding __module_address.
  * Protected by module_mutex. */
-static unsigned long module_addr_min = -1UL, module_addr_max = 0;
+static unsigned long module_addr_min = -1UL, module_addr_max; /* addr_max=0 */
 
-int register_module_notifier(struct notifier_block * nb)
+int register_module_notifier(struct notifier_block *nb)
 {
return blocking_notifier_chain_register(module_notify_list, nb);
 }
 EXPORT_SYMBOL(register_module_notifier);
 
-int unregister_module_notifier(struct notifier_block * nb)
+int unregister_module_notifier(struct notifier_block *nb)
 {
return blocking_notifier_chain_unregister(module_notify_list, nb);
 }
@@ -740,8 +740,7 @@ static inline int try_force_unload(unsigned int flags)
 }
 #endif /* CONFIG_MODULE_FORCE_UNLOAD */
 
-struct stopref
-{
+struct stopref{
struct module *mod;
int flags;
int *forced;
@@ -878,7 +877,7 @@ static inline void print_unload_info(struct seq_file *m, 
struct module *mod)
seq_printf(m,  %lu , module_refcount(mod));
 
/* Always include a trailing , so userspace can differentiate
-   between this and the old multi-field proc format. */
+* between this and the old multi-field proc format. */
list_for_each_entry(use, mod-source_list, source_list) {
printed_something = 1;
seq_printf(m, %s,, use-source-name);
@@ -886,11 +885,11 @@ static inline void print_unload_info(struct seq_file *m, 
struct module *mod)
 
if (mod-init != NULL  mod-exit == NULL) {
printed_something = 1;
-   seq_printf(m, [permanent],);
+   seq_puts(m, [permanent],);
}
 
if (!printed_something)
-   seq_printf(m, -);
+   seq_puts(m, -);
 }
 
 void __symbol_put(const char *symbol)
@@ -978,7 +977,7 @@ EXPORT_SYMBOL(module_put);
 static inline void print_unload_info(struct seq_file *m, struct module *mod)
 {
/* We don't know the usage count, or what modules are using. */
-   seq_printf(m,  - -);
+   seq_puts(m,  - -);
 }
 
 static inline void module_unload_free(struct module *mod)
@@ -1131,7 +1130,7 @@ static unsigned long maybe_relocated(unsigned long crc,
 static int check_version(Elf_Shdr *sechdrs,
 unsigned int versindex,
 const char *symname,
-struct module *mod, 
+struct module *mod,
 const unsigned long *crc,
 const struct module *crc_owner)
 {
@@ -1165,7 +1164,7 @@ static int check_version(Elf_Shdr *sechdrs,
return 0;
 
 bad_version:
-   printk(%s: disagrees about version of symbol %s\n,
+   pr_warn(%s: disagrees about version of symbol %s\n,
   mod-name, symname);
return 0;
 }
@@ -1200,7 +1199,7 @@ static inline int same_magic(const char *amagic, const 
char *bmagic,
 static inline int check_version(Elf_Shdr *sechdrs,
unsigned int versindex,
const char *symname,
-   struct module *mod, 
+   struct module *mod,
const unsigned long *crc,
const struct module *crc_owner)
 {
@@ -1288,15 +1287,13 @@ static inline bool sect_empty(const Elf_Shdr *sect)
return !(sect-sh_flags  SHF_ALLOC) || sect-sh_size == 0;
 }
 
-struct module_sect_attr
-{
+struct module_sect_attr {
struct module_attribute mattr;
char *name;
unsigned long address;
 };
 
-struct module_sect_attrs
-{
+struct module_sect_attrs {
struct attribute_group grp;
unsigned int nsections;
struct module_sect_attr attrs[0];
@@ -1550,7 +1547,7 @@ static int module_add_modinfo_attrs(struct module *mod)
(attr-test  attr-test(mod))) {
memcpy(temp_attr, attr, sizeof(*temp_attr));
sysfs_attr_init(temp_attr-attr);
-   error = 
sysfs_create_file

[PATCH] kernel:module Fix coding style errors and warnings.

2014-10-16 Thread Ionut Alexa
Fixed codin style errors and warnings. Changes printk with
print_debug/warn. Changed seq_printf to seq_puts.

Signed-off-by: Ionut Alexa ionut.m.al...@gmail.com
---
 kernel/module.c |   54 ++
 1 file changed, 26 insertions(+), 28 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index 65586ff..9fb16f7 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -110,7 +110,7 @@ struct list_head *kdb_modules = modules; /* kdb needs the 
list of modules */
 #ifdef CONFIG_MODULE_SIG_FORCE
 static bool sig_enforce = true;
 #else
-static bool sig_enforce = false;
+static bool sig_enforce; /* by default set to false */
 
 static int param_set_bool_enable_only(const char *val,
  const struct kernel_param *kp)
@@ -156,15 +156,15 @@ static BLOCKING_NOTIFIER_HEAD(module_notify_list);
 
 /* Bounds of module allocation, for speeding __module_address.
  * Protected by module_mutex. */
-static unsigned long module_addr_min = -1UL, module_addr_max = 0;
+static unsigned long module_addr_min = -1UL, module_addr_max; /* addr_max=0 */
 
-int register_module_notifier(struct notifier_block * nb)
+int register_module_notifier(struct notifier_block *nb)
 {
return blocking_notifier_chain_register(module_notify_list, nb);
 }
 EXPORT_SYMBOL(register_module_notifier);
 
-int unregister_module_notifier(struct notifier_block * nb)
+int unregister_module_notifier(struct notifier_block *nb)
 {
return blocking_notifier_chain_unregister(module_notify_list, nb);
 }
@@ -740,8 +740,7 @@ static inline int try_force_unload(unsigned int flags)
 }
 #endif /* CONFIG_MODULE_FORCE_UNLOAD */
 
-struct stopref
-{
+struct stopref {
struct module *mod;
int flags;
int *forced;
@@ -878,7 +877,7 @@ static inline void print_unload_info(struct seq_file *m, 
struct module *mod)
seq_printf(m,  %lu , module_refcount(mod));
 
/* Always include a trailing , so userspace can differentiate
-   between this and the old multi-field proc format. */
+* between this and the old multi-field proc format. */
list_for_each_entry(use, mod-source_list, source_list) {
printed_something = 1;
seq_printf(m, %s,, use-source-name);
@@ -886,11 +885,11 @@ static inline void print_unload_info(struct seq_file *m, 
struct module *mod)
 
if (mod-init != NULL  mod-exit == NULL) {
printed_something = 1;
-   seq_printf(m, [permanent],);
+   seq_puts(m, [permanent],);
}
 
if (!printed_something)
-   seq_printf(m, -);
+   seq_puts(m, -);
 }
 
 void __symbol_put(const char *symbol)
@@ -978,7 +977,7 @@ EXPORT_SYMBOL(module_put);
 static inline void print_unload_info(struct seq_file *m, struct module *mod)
 {
/* We don't know the usage count, or what modules are using. */
-   seq_printf(m,  - -);
+   seq_puts(m,  - -);
 }
 
 static inline void module_unload_free(struct module *mod)
@@ -1131,7 +1130,7 @@ static unsigned long maybe_relocated(unsigned long crc,
 static int check_version(Elf_Shdr *sechdrs,
 unsigned int versindex,
 const char *symname,
-struct module *mod, 
+struct module *mod,
 const unsigned long *crc,
 const struct module *crc_owner)
 {
@@ -1165,7 +1164,7 @@ static int check_version(Elf_Shdr *sechdrs,
return 0;
 
 bad_version:
-   printk(%s: disagrees about version of symbol %s\n,
+   pr_warn(%s: disagrees about version of symbol %s\n,
   mod-name, symname);
return 0;
 }
@@ -1200,7 +1199,7 @@ static inline int same_magic(const char *amagic, const 
char *bmagic,
 static inline int check_version(Elf_Shdr *sechdrs,
unsigned int versindex,
const char *symname,
-   struct module *mod, 
+   struct module *mod,
const unsigned long *crc,
const struct module *crc_owner)
 {
@@ -1288,15 +1287,13 @@ static inline bool sect_empty(const Elf_Shdr *sect)
return !(sect-sh_flags  SHF_ALLOC) || sect-sh_size == 0;
 }
 
-struct module_sect_attr
-{
+struct module_sect_attr {
struct module_attribute mattr;
char *name;
unsigned long address;
 };
 
-struct module_sect_attrs
-{
+struct module_sect_attrs {
struct attribute_group grp;
unsigned int nsections;
struct module_sect_attr attrs[0];
@@ -1550,7 +1547,8 @@ static int module_add_modinfo_attrs(struct module *mod)
(attr-test  attr-test(mod))) {
memcpy(temp_attr, attr, sizeof(*temp_attr));
sysfs_attr_init(temp_attr-attr);
-   error = 
sysfs_create_file

[PATCH] kernel:audit Fixed some coding style errors and warnings.

2014-08-12 Thread Ionut Alexa
Fixed coding style errors and warning. Changed 'printk_ratelimit' to
pr__ratelimited. Changed 'simple_strtol' to 'kstrtol'.

Signed-off-by: Ionut Alexa 
---
 kernel/audit.c |   63 ++--
 1 file changed, 38 insertions(+), 25 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index ba2ff5a..69ec6bd 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -55,6 +55,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -80,10 +81,10 @@ static int  audit_initialized;
 #define AUDIT_ON   1
 #define AUDIT_LOCKED   2
 u32audit_enabled;
-u32audit_ever_enabled;
-
 EXPORT_SYMBOL_GPL(audit_enabled);
 
+u32audit_ever_enabled;
+
 /* Default state when kernel boots without any parameters. */
 static u32 audit_default;
 
@@ -108,7 +109,7 @@ static u32  audit_rate_limit;
 static u32 audit_backlog_limit = 64;
 #define AUDIT_BACKLOG_WAIT_TIME (60 * HZ)
 static u32 audit_backlog_wait_time = AUDIT_BACKLOG_WAIT_TIME;
-static u32 audit_backlog_wait_overflow = 0;
+static u32 audit_backlog_wait_overflow;
 
 /* The identity of the user shutting down the audit system. */
 kuid_t audit_sig_uid = INVALID_UID;
@@ -190,6 +191,7 @@ static void audit_set_portid(struct audit_buffer *ab, __u32 
portid)
 {
if (ab) {
struct nlmsghdr *nlh = nlmsg_hdr(ab->skb);
+
nlh->nlmsg_pid = portid;
}
 }
@@ -200,8 +202,7 @@ void audit_panic(const char *message)
case AUDIT_FAIL_SILENT:
break;
case AUDIT_FAIL_PRINTK:
-   if (printk_ratelimit())
-   pr_err("%s\n", message);
+   pr_err_ratelimited("%s\n", message);
break;
case AUDIT_FAIL_PANIC:
/* test audit_pid since printk is always losey, why bother? */
@@ -213,15 +214,16 @@ void audit_panic(const char *message)
 
 static inline int audit_rate_check(void)
 {
-   static unsigned longlast_check = 0;
-   static int  messages   = 0;
+   static unsigned longlast_check;
+   static int  messages;
static DEFINE_SPINLOCK(lock);
unsigned long   flags;
unsigned long   now;
unsigned long   elapsed;
int retval = 0;
 
-   if (!audit_rate_limit) return 1;
+   if (!audit_rate_limit)
+   return 1;
 
spin_lock_irqsave(, flags);
if (++messages < audit_rate_limit) {
@@ -250,7 +252,7 @@ static inline int audit_rate_check(void)
 */
 void audit_log_lost(const char *message)
 {
-   static unsigned longlast_msg = 0;
+   static unsigned longlast_msg;
static DEFINE_SPINLOCK(lock);
unsigned long   flags;
unsigned long   now;
@@ -271,8 +273,7 @@ void audit_log_lost(const char *message)
}
 
if (print) {
-   if (printk_ratelimit())
-   pr_warn("audit_lost=%u audit_rate_limit=%u 
audit_backlog_limit=%u\n",
+   pr_warn_ratelimited("audit_lost=%u audit_rate_limit=%u 
audit_backlog_limit=%u\n",
atomic_read(_lost),
audit_rate_limit,
audit_backlog_limit);
@@ -344,6 +345,7 @@ static int audit_set_backlog_wait_time(u32 timeout)
 static int audit_set_enabled(u32 state)
 {
int rc;
+
if (state < AUDIT_OFF || state > AUDIT_LOCKED)
return -EINVAL;
 
@@ -393,8 +395,9 @@ static void audit_printk_skb(struct sk_buff *skb)
char *data = nlmsg_data(nlh);
 
if (nlh->nlmsg_type != AUDIT_EOE) {
-   if (printk_ratelimit())
-   pr_notice("type=%d %s\n", nlh->nlmsg_type, data);
+   if (__printk_ratelimit(__func__))
+   pr_notice_ratelimited("type=%d %s\n", nlh->nlmsg_type,
+   data);
else
audit_log_lost("printk limit exceeded");
}
@@ -672,7 +675,7 @@ static int audit_netlink_ok(struct sk_buff *skb, u16 
msg_type)
case AUDIT_MAKE_EQUIV:
/* Only support auditd and auditctl in initial pid namespace
 * for now. */
-   if ((task_active_pid_ns(current) != _pid_ns))
+   if (task_active_pid_ns(current) != _pid_ns)
return -EPERM;
 
if (!netlink_capable(skb, CAP_AUDIT_CONTROL))
@@ -834,6 +837,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct 
nlmsghdr *nlh)
switch (msg_type) {
case AUDIT_GET: {
struct audit_status s;
+
memset(, 0, sizeof(s));
s.enabled   = audit_enabled;
s.failure  

[PATCH] kernel:async Fixed coding style issues.

2014-08-12 Thread Ionut Alexa
Fixed coding style errors and warning in kernel/async.c

Signed-off-by: Ionut Alexa 
---
 kernel/async.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/async.c b/kernel/async.c
index 61f023c..4c3773c 100644
--- a/kernel/async.c
+++ b/kernel/async.c
@@ -115,7 +115,7 @@ static void async_run_entry_fn(struct work_struct *work)
 
/* 1) run (and print duration) */
if (initcall_debug && system_state == SYSTEM_BOOTING) {
-   printk(KERN_DEBUG "calling  %lli_%pF @ %i\n",
+   pr_debug("calling  %lli_%pF @ %i\n",
(long long)entry->cookie,
entry->func, task_pid_nr(current));
calltime = ktime_get();
@@ -124,7 +124,7 @@ static void async_run_entry_fn(struct work_struct *work)
if (initcall_debug && system_state == SYSTEM_BOOTING) {
rettime = ktime_get();
delta = ktime_sub(rettime, calltime);
-   printk(KERN_DEBUG "initcall %lli_%pF returned 0 after %lld 
usecs\n",
+   pr_debug("initcall %lli_%pF returned 0 after %lld usecs\n",
(long long)entry->cookie,
entry->func,
(long long)ktime_to_ns(delta) >> 10);
@@ -285,7 +285,7 @@ void async_synchronize_cookie_domain(async_cookie_t cookie, 
struct async_domain
ktime_t uninitialized_var(starttime), delta, endtime;
 
if (initcall_debug && system_state == SYSTEM_BOOTING) {
-   printk(KERN_DEBUG "async_waiting @ %i\n", task_pid_nr(current));
+   pr_debug("async_waiting @ %i\n", task_pid_nr(current));
starttime = ktime_get();
}
 
@@ -295,7 +295,7 @@ void async_synchronize_cookie_domain(async_cookie_t cookie, 
struct async_domain
endtime = ktime_get();
delta = ktime_sub(endtime, starttime);
 
-   printk(KERN_DEBUG "async_continuing @ %i after %lli usec\n",
+   pr_debug("async_continuing @ %i after %lli usec\n",
task_pid_nr(current),
(long long)ktime_to_ns(delta) >> 10);
}
-- 
1.7.10.4

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


[PATCH] kernel:async Fixed coding style issues.

2014-08-12 Thread Ionut Alexa
Fixed coding style errors and warning in kernel/async.c

Signed-off-by: Ionut Alexa ionut.m.al...@gmail.com
---
 kernel/async.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/async.c b/kernel/async.c
index 61f023c..4c3773c 100644
--- a/kernel/async.c
+++ b/kernel/async.c
@@ -115,7 +115,7 @@ static void async_run_entry_fn(struct work_struct *work)
 
/* 1) run (and print duration) */
if (initcall_debug  system_state == SYSTEM_BOOTING) {
-   printk(KERN_DEBUG calling  %lli_%pF @ %i\n,
+   pr_debug(calling  %lli_%pF @ %i\n,
(long long)entry-cookie,
entry-func, task_pid_nr(current));
calltime = ktime_get();
@@ -124,7 +124,7 @@ static void async_run_entry_fn(struct work_struct *work)
if (initcall_debug  system_state == SYSTEM_BOOTING) {
rettime = ktime_get();
delta = ktime_sub(rettime, calltime);
-   printk(KERN_DEBUG initcall %lli_%pF returned 0 after %lld 
usecs\n,
+   pr_debug(initcall %lli_%pF returned 0 after %lld usecs\n,
(long long)entry-cookie,
entry-func,
(long long)ktime_to_ns(delta)  10);
@@ -285,7 +285,7 @@ void async_synchronize_cookie_domain(async_cookie_t cookie, 
struct async_domain
ktime_t uninitialized_var(starttime), delta, endtime;
 
if (initcall_debug  system_state == SYSTEM_BOOTING) {
-   printk(KERN_DEBUG async_waiting @ %i\n, task_pid_nr(current));
+   pr_debug(async_waiting @ %i\n, task_pid_nr(current));
starttime = ktime_get();
}
 
@@ -295,7 +295,7 @@ void async_synchronize_cookie_domain(async_cookie_t cookie, 
struct async_domain
endtime = ktime_get();
delta = ktime_sub(endtime, starttime);
 
-   printk(KERN_DEBUG async_continuing @ %i after %lli usec\n,
+   pr_debug(async_continuing @ %i after %lli usec\n,
task_pid_nr(current),
(long long)ktime_to_ns(delta)  10);
}
-- 
1.7.10.4

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


[PATCH] kernel:audit Fixed some coding style errors and warnings.

2014-08-12 Thread Ionut Alexa
Fixed coding style errors and warning. Changed 'printk_ratelimit' to
pr_level_ratelimited. Changed 'simple_strtol' to 'kstrtol'.

Signed-off-by: Ionut Alexa ionut.m.al...@gmail.com
---
 kernel/audit.c |   63 ++--
 1 file changed, 38 insertions(+), 25 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index ba2ff5a..69ec6bd 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -55,6 +55,7 @@
 #include linux/syscalls.h
 
 #include linux/audit.h
+#include linux/ratelimit.h
 
 #include net/sock.h
 #include net/netlink.h
@@ -80,10 +81,10 @@ static int  audit_initialized;
 #define AUDIT_ON   1
 #define AUDIT_LOCKED   2
 u32audit_enabled;
-u32audit_ever_enabled;
-
 EXPORT_SYMBOL_GPL(audit_enabled);
 
+u32audit_ever_enabled;
+
 /* Default state when kernel boots without any parameters. */
 static u32 audit_default;
 
@@ -108,7 +109,7 @@ static u32  audit_rate_limit;
 static u32 audit_backlog_limit = 64;
 #define AUDIT_BACKLOG_WAIT_TIME (60 * HZ)
 static u32 audit_backlog_wait_time = AUDIT_BACKLOG_WAIT_TIME;
-static u32 audit_backlog_wait_overflow = 0;
+static u32 audit_backlog_wait_overflow;
 
 /* The identity of the user shutting down the audit system. */
 kuid_t audit_sig_uid = INVALID_UID;
@@ -190,6 +191,7 @@ static void audit_set_portid(struct audit_buffer *ab, __u32 
portid)
 {
if (ab) {
struct nlmsghdr *nlh = nlmsg_hdr(ab-skb);
+
nlh-nlmsg_pid = portid;
}
 }
@@ -200,8 +202,7 @@ void audit_panic(const char *message)
case AUDIT_FAIL_SILENT:
break;
case AUDIT_FAIL_PRINTK:
-   if (printk_ratelimit())
-   pr_err(%s\n, message);
+   pr_err_ratelimited(%s\n, message);
break;
case AUDIT_FAIL_PANIC:
/* test audit_pid since printk is always losey, why bother? */
@@ -213,15 +214,16 @@ void audit_panic(const char *message)
 
 static inline int audit_rate_check(void)
 {
-   static unsigned longlast_check = 0;
-   static int  messages   = 0;
+   static unsigned longlast_check;
+   static int  messages;
static DEFINE_SPINLOCK(lock);
unsigned long   flags;
unsigned long   now;
unsigned long   elapsed;
int retval = 0;
 
-   if (!audit_rate_limit) return 1;
+   if (!audit_rate_limit)
+   return 1;
 
spin_lock_irqsave(lock, flags);
if (++messages  audit_rate_limit) {
@@ -250,7 +252,7 @@ static inline int audit_rate_check(void)
 */
 void audit_log_lost(const char *message)
 {
-   static unsigned longlast_msg = 0;
+   static unsigned longlast_msg;
static DEFINE_SPINLOCK(lock);
unsigned long   flags;
unsigned long   now;
@@ -271,8 +273,7 @@ void audit_log_lost(const char *message)
}
 
if (print) {
-   if (printk_ratelimit())
-   pr_warn(audit_lost=%u audit_rate_limit=%u 
audit_backlog_limit=%u\n,
+   pr_warn_ratelimited(audit_lost=%u audit_rate_limit=%u 
audit_backlog_limit=%u\n,
atomic_read(audit_lost),
audit_rate_limit,
audit_backlog_limit);
@@ -344,6 +345,7 @@ static int audit_set_backlog_wait_time(u32 timeout)
 static int audit_set_enabled(u32 state)
 {
int rc;
+
if (state  AUDIT_OFF || state  AUDIT_LOCKED)
return -EINVAL;
 
@@ -393,8 +395,9 @@ static void audit_printk_skb(struct sk_buff *skb)
char *data = nlmsg_data(nlh);
 
if (nlh-nlmsg_type != AUDIT_EOE) {
-   if (printk_ratelimit())
-   pr_notice(type=%d %s\n, nlh-nlmsg_type, data);
+   if (__printk_ratelimit(__func__))
+   pr_notice_ratelimited(type=%d %s\n, nlh-nlmsg_type,
+   data);
else
audit_log_lost(printk limit exceeded);
}
@@ -672,7 +675,7 @@ static int audit_netlink_ok(struct sk_buff *skb, u16 
msg_type)
case AUDIT_MAKE_EQUIV:
/* Only support auditd and auditctl in initial pid namespace
 * for now. */
-   if ((task_active_pid_ns(current) != init_pid_ns))
+   if (task_active_pid_ns(current) != init_pid_ns)
return -EPERM;
 
if (!netlink_capable(skb, CAP_AUDIT_CONTROL))
@@ -834,6 +837,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct 
nlmsghdr *nlh)
switch (msg_type) {
case AUDIT_GET: {
struct audit_status s;
+
memset(s, 0, sizeof(s));
s.enabled   = audit_enabled;
s.failure

[PATCH] kernel: signal : fix coding style errors and reduce warnings.

2014-07-18 Thread Ionut Alexa
Fix coding style errors and reduced codign style warnings.

Signed-off-by: Ionut Alexa 
---
 kernel/signal.c |  150 ---
 1 file changed, 88 insertions(+), 62 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index a4077e9..e69daec 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -109,25 +109,28 @@ static inline int has_pending_signals(sigset_t *signal, 
sigset_t *blocked)
switch (_NSIG_WORDS) {
default:
for (i = _NSIG_WORDS, ready = 0; --i >= 0 ;)
-   ready |= signal->sig[i] &~ blocked->sig[i];
+   ready |= signal->sig[i] & ~blocked->sig[i];
break;
 
-   case 4: ready  = signal->sig[3] &~ blocked->sig[3];
-   ready |= signal->sig[2] &~ blocked->sig[2];
-   ready |= signal->sig[1] &~ blocked->sig[1];
-   ready |= signal->sig[0] &~ blocked->sig[0];
+   case 4:
+   ready  = signal->sig[3] & ~blocked->sig[3];
+   ready |= signal->sig[2] & ~blocked->sig[2];
+   ready |= signal->sig[1] & ~blocked->sig[1];
+   ready |= signal->sig[0] & ~blocked->sig[0];
break;
 
-   case 2: ready  = signal->sig[1] &~ blocked->sig[1];
-   ready |= signal->sig[0] &~ blocked->sig[0];
+   case 2:
+   ready  = signal->sig[1] & ~blocked->sig[1];
+   ready |= signal->sig[0] & ~blocked->sig[0];
break;
 
-   case 1: ready  = signal->sig[0] &~ blocked->sig[0];
+   case 1:
+   ready  = signal->sig[0] & ~blocked->sig[0];
}
return ready != 0;
 }
 
-#define PENDING(p,b) has_pending_signals(&(p)->signal, (b))
+#define PENDING(p, b) has_pending_signals(&(p)->signal, (b))
 
 static int recalc_sigpending_tsk(struct task_struct *t)
 {
@@ -161,6 +164,7 @@ void recalc_sigpending(void)
clear_thread_flag(TIF_SIGPENDING);
 
 }
+EXPORT_SYMBOL(recalc_sigpending);
 
 /* Given the mask, find the first available signal that should be serviced. */
 
@@ -180,7 +184,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
 * Handle the first word specially: it contains the
 * synchronous signals that need to be dequeued first.
 */
-   x = *s &~ *m;
+   x = (*s) & ~(*m);
if (x) {
if (x & SYNCHRONOUS_MASK)
x &= SYNCHRONOUS_MASK;
@@ -191,7 +195,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
switch (_NSIG_WORDS) {
default:
for (i = 1; i < _NSIG_WORDS; ++i) {
-   x = *++s &~ *++m;
+   x = (*++s) & ~(*++m);
if (!x)
continue;
sig = ffz(~x) + i*_NSIG_BPW + 1;
@@ -200,7 +204,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
break;
 
case 2:
-   x = s[1] &~ m[1];
+   x = s[1] & ~m[1];
if (!x)
break;
sig = ffz(~x) + _NSIG_BPW + 1;
@@ -224,8 +228,8 @@ static inline void print_dropped_signal(int sig)
if (!__ratelimit(_state))
return;
 
-   printk(KERN_INFO "%s/%d: reached RLIMIT_SIGPENDING, dropped signal 
%d\n",
-   current->comm, current->pid, sig);
+   pr_info("%s/%d: reached RLIMIT_SIGPENDING, dropped signal %d\n",
+   current->comm, current->pid, sig);
 }
 
 /**
@@ -358,7 +362,8 @@ static bool task_participate_group_stop(struct task_struct 
*task)
  *   appropriate lock must be held to stop the target task from exiting
  */
 static struct sigqueue *
-__sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int 
override_rlimit)
+__sigqueue_alloc(int sig, struct task_struct *t,
+   gfp_t flags, int override_rlimit)
 {
struct sigqueue *q = NULL;
struct user_struct *user;
@@ -431,6 +436,7 @@ void flush_signals(struct task_struct *t)
__flush_signals(t);
spin_unlock_irqrestore(>sighand->siglock, flags);
 }
+EXPORT_SYMBOL(flush_signals);
 
 static void __flush_itimer_signals(struct sigpending *pending)
 {
@@ -485,6 +491,7 @@ flush_signal_handlers(struct task_struct *t, int 
force_default)
 {
int i;
struct k_sigaction *ka = >sighand->action[0];
+
for (i = _NSIG ; i != 0 ; i--) {
if (force_default || ka->sa.sa_handler != SIG_IGN)
ka->sa.sa_handler = SIG_DFL;
@@ -500,6 +507,7 @@ flush_signal_handlers(struct task_struct *t, int 
force_default)
 int unhandled_signal(struct task_stru

[PATCH] kernel: signal : fix coding style errors and reduce warnings.

2014-07-18 Thread Ionut Alexa
Fix coding style errors and reduced codign style warnings.

Signed-off-by: Ionut Alexa ionut.m.al...@gmail.com
---
 kernel/signal.c |  150 ---
 1 file changed, 88 insertions(+), 62 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index a4077e9..e69daec 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -109,25 +109,28 @@ static inline int has_pending_signals(sigset_t *signal, 
sigset_t *blocked)
switch (_NSIG_WORDS) {
default:
for (i = _NSIG_WORDS, ready = 0; --i = 0 ;)
-   ready |= signal-sig[i] ~ blocked-sig[i];
+   ready |= signal-sig[i]  ~blocked-sig[i];
break;
 
-   case 4: ready  = signal-sig[3] ~ blocked-sig[3];
-   ready |= signal-sig[2] ~ blocked-sig[2];
-   ready |= signal-sig[1] ~ blocked-sig[1];
-   ready |= signal-sig[0] ~ blocked-sig[0];
+   case 4:
+   ready  = signal-sig[3]  ~blocked-sig[3];
+   ready |= signal-sig[2]  ~blocked-sig[2];
+   ready |= signal-sig[1]  ~blocked-sig[1];
+   ready |= signal-sig[0]  ~blocked-sig[0];
break;
 
-   case 2: ready  = signal-sig[1] ~ blocked-sig[1];
-   ready |= signal-sig[0] ~ blocked-sig[0];
+   case 2:
+   ready  = signal-sig[1]  ~blocked-sig[1];
+   ready |= signal-sig[0]  ~blocked-sig[0];
break;
 
-   case 1: ready  = signal-sig[0] ~ blocked-sig[0];
+   case 1:
+   ready  = signal-sig[0]  ~blocked-sig[0];
}
return ready != 0;
 }
 
-#define PENDING(p,b) has_pending_signals((p)-signal, (b))
+#define PENDING(p, b) has_pending_signals((p)-signal, (b))
 
 static int recalc_sigpending_tsk(struct task_struct *t)
 {
@@ -161,6 +164,7 @@ void recalc_sigpending(void)
clear_thread_flag(TIF_SIGPENDING);
 
 }
+EXPORT_SYMBOL(recalc_sigpending);
 
 /* Given the mask, find the first available signal that should be serviced. */
 
@@ -180,7 +184,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
 * Handle the first word specially: it contains the
 * synchronous signals that need to be dequeued first.
 */
-   x = *s ~ *m;
+   x = (*s)  ~(*m);
if (x) {
if (x  SYNCHRONOUS_MASK)
x = SYNCHRONOUS_MASK;
@@ -191,7 +195,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
switch (_NSIG_WORDS) {
default:
for (i = 1; i  _NSIG_WORDS; ++i) {
-   x = *++s ~ *++m;
+   x = (*++s)  ~(*++m);
if (!x)
continue;
sig = ffz(~x) + i*_NSIG_BPW + 1;
@@ -200,7 +204,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
break;
 
case 2:
-   x = s[1] ~ m[1];
+   x = s[1]  ~m[1];
if (!x)
break;
sig = ffz(~x) + _NSIG_BPW + 1;
@@ -224,8 +228,8 @@ static inline void print_dropped_signal(int sig)
if (!__ratelimit(ratelimit_state))
return;
 
-   printk(KERN_INFO %s/%d: reached RLIMIT_SIGPENDING, dropped signal 
%d\n,
-   current-comm, current-pid, sig);
+   pr_info(%s/%d: reached RLIMIT_SIGPENDING, dropped signal %d\n,
+   current-comm, current-pid, sig);
 }
 
 /**
@@ -358,7 +362,8 @@ static bool task_participate_group_stop(struct task_struct 
*task)
  *   appropriate lock must be held to stop the target task from exiting
  */
 static struct sigqueue *
-__sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int 
override_rlimit)
+__sigqueue_alloc(int sig, struct task_struct *t,
+   gfp_t flags, int override_rlimit)
 {
struct sigqueue *q = NULL;
struct user_struct *user;
@@ -431,6 +436,7 @@ void flush_signals(struct task_struct *t)
__flush_signals(t);
spin_unlock_irqrestore(t-sighand-siglock, flags);
 }
+EXPORT_SYMBOL(flush_signals);
 
 static void __flush_itimer_signals(struct sigpending *pending)
 {
@@ -485,6 +491,7 @@ flush_signal_handlers(struct task_struct *t, int 
force_default)
 {
int i;
struct k_sigaction *ka = t-sighand-action[0];
+
for (i = _NSIG ; i != 0 ; i--) {
if (force_default || ka-sa.sa_handler != SIG_IGN)
ka-sa.sa_handler = SIG_DFL;
@@ -500,6 +507,7 @@ flush_signal_handlers(struct task_struct *t, int 
force_default)
 int unhandled_signal(struct task_struct *tsk, int sig)
 {
void __user *handler = tsk-sighand-action[sig-1].sa.sa_handler;
+
if (is_global_init(tsk))
return 1;
if (handler != SIG_IGN  handler != SIG_DFL)
@@ -528,6 +536,7 @@ block_all_signals(int (*notifier)(void *priv), void *priv, 
sigset_t *mask

[PATCH] kernel:async :changed printk to pr_debug to respect coding style.

2014-07-14 Thread Ionut Alexa
Fixed coding style issues by replacing printk with pr_debug.

Signed-off-by: Ionut Alexa 
---
 kernel/async.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/kernel/async.c b/kernel/async.c
index 61f023c..c82276c 100644
--- a/kernel/async.c
+++ b/kernel/async.c
@@ -111,11 +111,12 @@ static void async_run_entry_fn(struct work_struct *work)
struct async_entry *entry =
container_of(work, struct async_entry, work);
unsigned long flags;
+
ktime_t uninitialized_var(calltime), delta, rettime;
 
/* 1) run (and print duration) */
if (initcall_debug && system_state == SYSTEM_BOOTING) {
-   printk(KERN_DEBUG "calling  %lli_%pF @ %i\n",
+   pr_debug("calling  %lli_%pF @ %i\n",
(long long)entry->cookie,
entry->func, task_pid_nr(current));
calltime = ktime_get();
@@ -124,7 +125,7 @@ static void async_run_entry_fn(struct work_struct *work)
if (initcall_debug && system_state == SYSTEM_BOOTING) {
rettime = ktime_get();
delta = ktime_sub(rettime, calltime);
-   printk(KERN_DEBUG "initcall %lli_%pF returned 0 after %lld 
usecs\n",
+   pr_debug("initcall %lli_%pF returned 0 after %lld usecs\n",
(long long)entry->cookie,
entry->func,
(long long)ktime_to_ns(delta) >> 10);
@@ -285,7 +286,7 @@ void async_synchronize_cookie_domain(async_cookie_t cookie, 
struct async_domain
ktime_t uninitialized_var(starttime), delta, endtime;
 
if (initcall_debug && system_state == SYSTEM_BOOTING) {
-   printk(KERN_DEBUG "async_waiting @ %i\n", task_pid_nr(current));
+   pr_debug("async_waiting @ %i\n", task_pid_nr(current));
starttime = ktime_get();
}
 
@@ -295,7 +296,7 @@ void async_synchronize_cookie_domain(async_cookie_t cookie, 
struct async_domain
endtime = ktime_get();
delta = ktime_sub(endtime, starttime);
 
-   printk(KERN_DEBUG "async_continuing @ %i after %lli usec\n",
+   pr_debug("async_continuing @ %i after %lli usec\n",
task_pid_nr(current),
(long long)ktime_to_ns(delta) >> 10);
}
-- 
1.7.10.4

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


[PATCH] kernel:async :changed printk to pr_debug to respect coding style.

2014-07-14 Thread Ionut Alexa
Fixed coding style issues by replacing printk with pr_debug.

Signed-off-by: Ionut Alexa 
---
 kernel/async.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/kernel/async.c b/kernel/async.c
index 61f023c..c82276c 100644
--- a/kernel/async.c
+++ b/kernel/async.c
@@ -111,11 +111,12 @@ static void async_run_entry_fn(struct work_struct *work)
struct async_entry *entry =
container_of(work, struct async_entry, work);
unsigned long flags;
+
ktime_t uninitialized_var(calltime), delta, rettime;
 
/* 1) run (and print duration) */
if (initcall_debug && system_state == SYSTEM_BOOTING) {
-   printk(KERN_DEBUG "calling  %lli_%pF @ %i\n",
+   pr_debug("calling  %lli_%pF @ %i\n",
(long long)entry->cookie,
entry->func, task_pid_nr(current));
calltime = ktime_get();
@@ -124,7 +125,7 @@ static void async_run_entry_fn(struct work_struct *work)
if (initcall_debug && system_state == SYSTEM_BOOTING) {
rettime = ktime_get();
delta = ktime_sub(rettime, calltime);
-   printk(KERN_DEBUG "initcall %lli_%pF returned 0 after %lld 
usecs\n",
+   pr_debug("initcall %lli_%pF returned 0 after %lld usecs\n",
(long long)entry->cookie,
entry->func,
(long long)ktime_to_ns(delta) >> 10);
@@ -285,7 +286,7 @@ void async_synchronize_cookie_domain(async_cookie_t cookie, 
struct async_domain
ktime_t uninitialized_var(starttime), delta, endtime;
 
if (initcall_debug && system_state == SYSTEM_BOOTING) {
-   printk(KERN_DEBUG "async_waiting @ %i\n", task_pid_nr(current));
+   pr_debug("async_waiting @ %i\n", task_pid_nr(current));
starttime = ktime_get();
}
 
@@ -295,7 +296,7 @@ void async_synchronize_cookie_domain(async_cookie_t cookie, 
struct async_domain
endtime = ktime_get();
delta = ktime_sub(endtime, starttime);
 
-   printk(KERN_DEBUG "async_continuing @ %i after %lli usec\n",
+   pr_debug("async_continuing @ %i after %lli usec\n",
task_pid_nr(current),
(long long)ktime_to_ns(delta) >> 10);
}
-- 
1.7.10.4

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


[PATCH] kernel:async :changed printk to pr_debug to respect coding style.

2014-07-14 Thread Ionut Alexa
Fixed coding style issues by replacing printk with pr_debug.

Signed-off-by: Ionut Alexa ionut.m.al...@gmail.com
---
 kernel/async.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/kernel/async.c b/kernel/async.c
index 61f023c..c82276c 100644
--- a/kernel/async.c
+++ b/kernel/async.c
@@ -111,11 +111,12 @@ static void async_run_entry_fn(struct work_struct *work)
struct async_entry *entry =
container_of(work, struct async_entry, work);
unsigned long flags;
+
ktime_t uninitialized_var(calltime), delta, rettime;
 
/* 1) run (and print duration) */
if (initcall_debug  system_state == SYSTEM_BOOTING) {
-   printk(KERN_DEBUG calling  %lli_%pF @ %i\n,
+   pr_debug(calling  %lli_%pF @ %i\n,
(long long)entry-cookie,
entry-func, task_pid_nr(current));
calltime = ktime_get();
@@ -124,7 +125,7 @@ static void async_run_entry_fn(struct work_struct *work)
if (initcall_debug  system_state == SYSTEM_BOOTING) {
rettime = ktime_get();
delta = ktime_sub(rettime, calltime);
-   printk(KERN_DEBUG initcall %lli_%pF returned 0 after %lld 
usecs\n,
+   pr_debug(initcall %lli_%pF returned 0 after %lld usecs\n,
(long long)entry-cookie,
entry-func,
(long long)ktime_to_ns(delta)  10);
@@ -285,7 +286,7 @@ void async_synchronize_cookie_domain(async_cookie_t cookie, 
struct async_domain
ktime_t uninitialized_var(starttime), delta, endtime;
 
if (initcall_debug  system_state == SYSTEM_BOOTING) {
-   printk(KERN_DEBUG async_waiting @ %i\n, task_pid_nr(current));
+   pr_debug(async_waiting @ %i\n, task_pid_nr(current));
starttime = ktime_get();
}
 
@@ -295,7 +296,7 @@ void async_synchronize_cookie_domain(async_cookie_t cookie, 
struct async_domain
endtime = ktime_get();
delta = ktime_sub(endtime, starttime);
 
-   printk(KERN_DEBUG async_continuing @ %i after %lli usec\n,
+   pr_debug(async_continuing @ %i after %lli usec\n,
task_pid_nr(current),
(long long)ktime_to_ns(delta)  10);
}
-- 
1.7.10.4

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


[PATCH] kernel:async :changed printk to pr_debug to respect coding style.

2014-07-14 Thread Ionut Alexa
Fixed coding style issues by replacing printk with pr_debug.

Signed-off-by: Ionut Alexa ionut.m.al...@gmail.com
---
 kernel/async.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/kernel/async.c b/kernel/async.c
index 61f023c..c82276c 100644
--- a/kernel/async.c
+++ b/kernel/async.c
@@ -111,11 +111,12 @@ static void async_run_entry_fn(struct work_struct *work)
struct async_entry *entry =
container_of(work, struct async_entry, work);
unsigned long flags;
+
ktime_t uninitialized_var(calltime), delta, rettime;
 
/* 1) run (and print duration) */
if (initcall_debug  system_state == SYSTEM_BOOTING) {
-   printk(KERN_DEBUG calling  %lli_%pF @ %i\n,
+   pr_debug(calling  %lli_%pF @ %i\n,
(long long)entry-cookie,
entry-func, task_pid_nr(current));
calltime = ktime_get();
@@ -124,7 +125,7 @@ static void async_run_entry_fn(struct work_struct *work)
if (initcall_debug  system_state == SYSTEM_BOOTING) {
rettime = ktime_get();
delta = ktime_sub(rettime, calltime);
-   printk(KERN_DEBUG initcall %lli_%pF returned 0 after %lld 
usecs\n,
+   pr_debug(initcall %lli_%pF returned 0 after %lld usecs\n,
(long long)entry-cookie,
entry-func,
(long long)ktime_to_ns(delta)  10);
@@ -285,7 +286,7 @@ void async_synchronize_cookie_domain(async_cookie_t cookie, 
struct async_domain
ktime_t uninitialized_var(starttime), delta, endtime;
 
if (initcall_debug  system_state == SYSTEM_BOOTING) {
-   printk(KERN_DEBUG async_waiting @ %i\n, task_pid_nr(current));
+   pr_debug(async_waiting @ %i\n, task_pid_nr(current));
starttime = ktime_get();
}
 
@@ -295,7 +296,7 @@ void async_synchronize_cookie_domain(async_cookie_t cookie, 
struct async_domain
endtime = ktime_get();
delta = ktime_sub(endtime, starttime);
 
-   printk(KERN_DEBUG async_continuing @ %i after %lli usec\n,
+   pr_debug(async_continuing @ %i after %lli usec\n,
task_pid_nr(current),
(long long)ktime_to_ns(delta)  10);
}
-- 
1.7.10.4

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


[PATCH] :kernel :acct :fix coding style warnings and errors

2014-07-13 Thread Ionut Alexa
Fixed coding style warnings and errors.

Signed-off-by: Ionut Alexa 
---
 kernel/acct.c |   30 +-
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/kernel/acct.c b/kernel/acct.c
index 808a86f..1bfdda0 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -141,12 +141,12 @@ static int check_free_space(struct bsd_acct_struct *acct, 
struct file *file)
if (acct->active) {
if (act < 0) {
acct->active = 0;
-   printk(KERN_INFO "Process accounting paused\n");
+   pr_info("Process accounting paused\n");
}
} else {
if (act > 0) {
acct->active = 1;
-   printk(KERN_INFO "Process accounting resumed\n");
+   pr_info("Process accounting resumed\n");
}
}
 
@@ -261,6 +261,7 @@ SYSCALL_DEFINE1(acct, const char __user *, name)
 
if (name) {
struct filename *tmp = getname(name);
+
if (IS_ERR(tmp))
return PTR_ERR(tmp);
error = acct_on(tmp);
@@ -376,7 +377,7 @@ static comp_t encode_comp_t(unsigned long value)
return exp;
 }
 
-#if ACCT_VERSION==1 || ACCT_VERSION==2
+#if ACCT_VERSION == 1 || ACCT_VERSION == 2
 /*
  * encode an u64 into a comp2_t (24 bits)
  *
@@ -389,7 +390,7 @@ static comp_t encode_comp_t(unsigned long value)
 #define MANTSIZE2   20  /* 20 bit mantissa. */
 #define EXPSIZE25   /* 5 bit base 2 exponent. */
 #define MAXFRACT2   ((1ul << MANTSIZE2) - 1) /* Maximum fractional value. 
*/
-#define MAXEXP2 ((1 < 0){
+   if (value == 0)
+   return 0;
+   while ((s64)value > 0) {
value <<= 1;
exp--;
}
@@ -490,16 +492,17 @@ static void do_acct_process(struct bsd_acct_struct *acct,
   + current->group_leader->start_time.tv_nsec;
/* convert nsec -> AHZ */
elapsed = nsec_to_AHZ(run_time);
-#if ACCT_VERSION==3
+#if ACCT_VERSION == 3
ac.ac_etime = encode_float(elapsed);
 #else
ac.ac_etime = encode_comp_t(elapsed < (unsigned long) -1l ?
-  (unsigned long) elapsed : (unsigned long) -1l);
+   (unsigned long) elapsed : (unsigned long) -1l);
 #endif
-#if ACCT_VERSION==1 || ACCT_VERSION==2
+#if ACCT_VERSION == 1 || ACCT_VERSION == 2
{
/* new enlarged etime field */
comp2_t etime = encode_comp2_t(elapsed);
+
ac.ac_etime_hi = etime >> 16;
ac.ac_etime_lo = (u16) etime;
}
@@ -509,15 +512,15 @@ static void do_acct_process(struct bsd_acct_struct *acct,
/* we really need to bite the bullet and change layout */
ac.ac_uid = from_kuid_munged(file->f_cred->user_ns, orig_cred->uid);
ac.ac_gid = from_kgid_munged(file->f_cred->user_ns, orig_cred->gid);
-#if ACCT_VERSION==2
+#if ACCT_VERSION == 2
ac.ac_ahz = AHZ;
 #endif
-#if ACCT_VERSION==1 || ACCT_VERSION==2
+#if ACCT_VERSION == 1 || ACCT_VERSION == 2
/* backward-compatible 16 bit fields */
ac.ac_uid16 = ac.ac_uid;
ac.ac_gid16 = ac.ac_gid;
 #endif
-#if ACCT_VERSION==3
+#if ACCT_VERSION == 3
ac.ac_pid = task_tgid_nr_ns(current, ns);
rcu_read_lock();
ac.ac_ppid = task_tgid_nr_ns(rcu_dereference(current->real_parent), ns);
@@ -578,6 +581,7 @@ void acct_collect(long exitcode, int group_dead)
 
if (group_dead && current->mm) {
struct vm_area_struct *vma;
+
down_read(>mm->mmap_sem);
vma = current->mm->mmap;
while (vma) {
-- 
1.7.10.4

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


[PATCH] :kernel :acct :fix coding style warnings and errors

2014-07-13 Thread Ionut Alexa
Fixed coding style warnings and errors.

Signed-off-by: Ionut Alexa ionut.m.al...@gmail.com
---
 kernel/acct.c |   30 +-
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/kernel/acct.c b/kernel/acct.c
index 808a86f..1bfdda0 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -141,12 +141,12 @@ static int check_free_space(struct bsd_acct_struct *acct, 
struct file *file)
if (acct-active) {
if (act  0) {
acct-active = 0;
-   printk(KERN_INFO Process accounting paused\n);
+   pr_info(Process accounting paused\n);
}
} else {
if (act  0) {
acct-active = 1;
-   printk(KERN_INFO Process accounting resumed\n);
+   pr_info(Process accounting resumed\n);
}
}
 
@@ -261,6 +261,7 @@ SYSCALL_DEFINE1(acct, const char __user *, name)
 
if (name) {
struct filename *tmp = getname(name);
+
if (IS_ERR(tmp))
return PTR_ERR(tmp);
error = acct_on(tmp);
@@ -376,7 +377,7 @@ static comp_t encode_comp_t(unsigned long value)
return exp;
 }
 
-#if ACCT_VERSION==1 || ACCT_VERSION==2
+#if ACCT_VERSION == 1 || ACCT_VERSION == 2
 /*
  * encode an u64 into a comp2_t (24 bits)
  *
@@ -389,7 +390,7 @@ static comp_t encode_comp_t(unsigned long value)
 #define MANTSIZE2   20  /* 20 bit mantissa. */
 #define EXPSIZE25   /* 5 bit base 2 exponent. */
 #define MAXFRACT2   ((1ul  MANTSIZE2) - 1) /* Maximum fractional value. 
*/
-#define MAXEXP2 ((1 EXPSIZE2) - 1)/* Maximum exponent. */
+#define MAXEXP2 ((1  EXPSIZE2) - 1)/* Maximum exponent. */
 
 static comp2_t encode_comp2_t(u64 value)
 {
@@ -420,7 +421,7 @@ static comp2_t encode_comp2_t(u64 value)
 }
 #endif
 
-#if ACCT_VERSION==3
+#if ACCT_VERSION == 3
 /*
  * encode an u64 into a 32 bit IEEE float
  */
@@ -429,8 +430,9 @@ static u32 encode_float(u64 value)
unsigned exp = 190;
unsigned u;
 
-   if (value==0) return 0;
-   while ((s64)value  0){
+   if (value == 0)
+   return 0;
+   while ((s64)value  0) {
value = 1;
exp--;
}
@@ -490,16 +492,17 @@ static void do_acct_process(struct bsd_acct_struct *acct,
   + current-group_leader-start_time.tv_nsec;
/* convert nsec - AHZ */
elapsed = nsec_to_AHZ(run_time);
-#if ACCT_VERSION==3
+#if ACCT_VERSION == 3
ac.ac_etime = encode_float(elapsed);
 #else
ac.ac_etime = encode_comp_t(elapsed  (unsigned long) -1l ?
-  (unsigned long) elapsed : (unsigned long) -1l);
+   (unsigned long) elapsed : (unsigned long) -1l);
 #endif
-#if ACCT_VERSION==1 || ACCT_VERSION==2
+#if ACCT_VERSION == 1 || ACCT_VERSION == 2
{
/* new enlarged etime field */
comp2_t etime = encode_comp2_t(elapsed);
+
ac.ac_etime_hi = etime  16;
ac.ac_etime_lo = (u16) etime;
}
@@ -509,15 +512,15 @@ static void do_acct_process(struct bsd_acct_struct *acct,
/* we really need to bite the bullet and change layout */
ac.ac_uid = from_kuid_munged(file-f_cred-user_ns, orig_cred-uid);
ac.ac_gid = from_kgid_munged(file-f_cred-user_ns, orig_cred-gid);
-#if ACCT_VERSION==2
+#if ACCT_VERSION == 2
ac.ac_ahz = AHZ;
 #endif
-#if ACCT_VERSION==1 || ACCT_VERSION==2
+#if ACCT_VERSION == 1 || ACCT_VERSION == 2
/* backward-compatible 16 bit fields */
ac.ac_uid16 = ac.ac_uid;
ac.ac_gid16 = ac.ac_gid;
 #endif
-#if ACCT_VERSION==3
+#if ACCT_VERSION == 3
ac.ac_pid = task_tgid_nr_ns(current, ns);
rcu_read_lock();
ac.ac_ppid = task_tgid_nr_ns(rcu_dereference(current-real_parent), ns);
@@ -578,6 +581,7 @@ void acct_collect(long exitcode, int group_dead)
 
if (group_dead  current-mm) {
struct vm_area_struct *vma;
+
down_read(current-mm-mmap_sem);
vma = current-mm-mmap;
while (vma) {
-- 
1.7.10.4

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


[PATCH] kernel:dma : fix coding style errors

2014-07-11 Thread Ionut Alexa
Fixed coding style errors.

Signed-off-by: Ionut Alexa 
---
 kernel/dma.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/kernel/dma.c b/kernel/dma.c
index 6c6262f..ae9ba17 100644
--- a/kernel/dma.c
+++ b/kernel/dma.c
@@ -66,7 +66,7 @@ static struct dma_chan dma_chan_busy[MAX_DMA_CHANNELS] = {
  * @dmanr: DMA channel number
  * @device_id: reserving device ID string, used in /proc/dma
  */
-int request_dma(unsigned int dmanr, const char * device_id)
+int request_dma(unsigned int dmanr, const char *device_id)
 {
if (dmanr >= MAX_DMA_CHANNELS)
return -EINVAL;
@@ -87,12 +87,12 @@ int request_dma(unsigned int dmanr, const char * device_id)
 void free_dma(unsigned int dmanr)
 {
if (dmanr >= MAX_DMA_CHANNELS) {
-   printk(KERN_WARNING "Trying to free DMA%d\n", dmanr);
+   pr_warn("Trying to free DMA%d\n", dmanr);
return;
}
 
if (xchg(_chan_busy[dmanr].lock, 0) == 0) {
-   printk(KERN_WARNING "Trying to free free DMA%d\n", dmanr);
+   pr_warn("Trying to free free DMA%d\n", dmanr);
return;
}
 
@@ -152,9 +152,10 @@ static int __init proc_dma_init(void)
return 0;
 }
 
-__initcall(proc_dma_init);
+device_initcall(proc_dma_init);
 #endif
 
 EXPORT_SYMBOL(request_dma);
 EXPORT_SYMBOL(free_dma);
 EXPORT_SYMBOL(dma_spin_lock);
+
-- 
1.7.10.4

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


[PATCH] kernel:exit :fix coding style warnings and errors.

2014-07-11 Thread Ionut Alexa
Fixed coding style warnings and errors.

Signed-off-by: Ionut Alexa 
---
 kernel/exit.c |   49 ++---
 1 file changed, 26 insertions(+), 23 deletions(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index e5c4668..20a9c10 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -59,7 +59,7 @@
 #include 
 #include 
 
-static void exit_mm(struct task_struct * tsk);
+static void exit_mm(struct task_struct *tsk);
 
 static void __unhash_process(struct task_struct *p, bool group_dead)
 {
@@ -151,7 +151,7 @@ static void __exit_signal(struct task_struct *tsk)
spin_unlock(>siglock);
 
__cleanup_sighand(sighand);
-   clear_tsk_thread_flag(tsk,TIF_SIGPENDING);
+   clear_tsk_thread_flag(tsk, TIF_SIGPENDING);
if (group_dead) {
flush_sigqueue(>shared_pending);
tty_kref_put(tty);
@@ -168,7 +168,7 @@ static void delayed_put_task_struct(struct rcu_head *rhp)
 }
 
 
-void release_task(struct task_struct * p)
+void release_task(struct task_struct *p)
 {
struct task_struct *leader;
int zap_leader;
@@ -192,7 +192,8 @@ repeat:
 */
zap_leader = 0;
leader = p->group_leader;
-   if (leader != p && thread_group_empty(leader) && leader->exit_state == 
EXIT_ZOMBIE) {
+   if (leader != p && thread_group_empty(leader)
+   && leader->exit_state == EXIT_ZOMBIE) {
/*
 * If we were the last child thread and the leader has
 * exited already, and the leader's parent ignores SIGCHLD,
@@ -241,7 +242,8 @@ struct pid *session_of_pgrp(struct pid *pgrp)
  *
  * "I ask you, have you ever known what it is to be an orphan?"
  */
-static int will_become_orphaned_pgrp(struct pid *pgrp, struct task_struct 
*ignored_task)
+static int will_become_orphaned_pgrp(struct pid *pgrp,
+   struct task_struct *ignored_task)
 {
struct task_struct *p;
 
@@ -294,9 +296,9 @@ kill_orphaned_pgrp(struct task_struct *tsk, struct 
task_struct *parent)
struct task_struct *ignored_task = tsk;
 
if (!parent)
-/* exit: our father is in a different pgrp than
- * we are and we were the only connection outside.
- */
+   /* exit: our father is in a different pgrp than
+* we are and we were the only connection outside.
+*/
parent = tsk->real_parent;
else
/* reparent: our child is in a different pgrp than
@@ -405,7 +407,7 @@ assign_new_owner:
  * Turn us into a lazy TLB process if we
  * aren't already..
  */
-static void exit_mm(struct task_struct * tsk)
+static void exit_mm(struct task_struct *tsk)
 {
struct mm_struct *mm = tsk->mm;
struct core_state *core_state;
@@ -425,6 +427,7 @@ static void exit_mm(struct task_struct * tsk)
core_state = mm->core_state;
if (core_state) {
struct core_thread self;
+
up_read(>mmap_sem);
 
self.task = tsk;
@@ -565,6 +568,7 @@ static void forget_original_parent(struct task_struct 
*father)
 
list_for_each_entry_safe(p, n, >children, sibling) {
struct task_struct *t = p;
+
do {
t->real_parent = reaper;
if (t->parent == father) {
@@ -598,7 +602,7 @@ static void exit_notify(struct task_struct *tsk, int 
group_dead)
/*
 * This does two things:
 *
-* A.  Make init inherit all the child processes
+* A.  Make init inherit all the child processes
 * B.  Check to see if any process groups have become orphaned
 *  as a result of our exiting, and if they have any stopped
 *  jobs, send them a SIGHUP and then a SIGCONT.  (POSIX 3.2.2.2)
@@ -648,9 +652,8 @@ static void check_stack_usage(void)
 
spin_lock(_water_lock);
if (free < lowest_to_date) {
-   printk(KERN_WARNING "%s (%d) used greatest stack depth: "
-   "%lu bytes left\n",
-   current->comm, task_pid_nr(current), free);
+   pr_warn("%s (%d) used greatest stack depth: %lu bytes left\n",
+   current->comm, task_pid_nr(current), free);
lowest_to_date = free;
}
spin_unlock(_water_lock);
@@ -691,8 +694,7 @@ void do_exit(long code)
 * leave this task alone and wait for reboot.
 */
if (unlikely(tsk->flags & PF_EXITING)) {
-   printk(KERN_ALERT
-   "Fixing recursive fault but reboot is needed!\n");
+   pr_alert("Fixing recursive fault but reboot is needed!\n");
/*
 * We can do thi

[PATCH] tools:thermal:tmon :fix coding style issues

2014-07-11 Thread Ionut Alexa
From: Ionut Alexa 

Fixed coding style issues.

Signed-off-by: Ionut Alexa 
---
 tools/thermal/tmon/tmon.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/thermal/tmon/tmon.c b/tools/thermal/tmon/tmon.c
index 09b7c32..bffd3d9 100644
--- a/tools/thermal/tmon/tmon.c
+++ b/tools/thermal/tmon/tmon.c
@@ -55,7 +55,7 @@ static void   start_daemon_mode(void);
 
 pthread_t event_tid;
 pthread_mutex_t input_lock;
-void usage()
+void usage(void)
 {
printf("Usage: tmon [OPTION...]\n");
printf("  -c, --control cooling device in control\n");
@@ -70,7 +70,7 @@ void usage()
exit(0);
 }
 
-void version()
+void version(void)
 {
printf("TMON version %s\n", VERSION);
exit(EXIT_SUCCESS);
@@ -340,11 +340,12 @@ int main(int argc, char **argv)
return 0;
 }
 
-static void start_daemon_mode()
+static void start_daemon_mode(void)
 {
daemon_mode = 1;
/* fork */
pid_t   sid, pid = fork();
+
if (pid < 0) {
exit(EXIT_FAILURE);
} else if (pid > 0)
-- 
1.7.10.4

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


[PATCH] kernel:cgroup :fixed coding style issues

2014-07-11 Thread Ionut Alexa
From: Ionut Alexa 

Fixed coding style issues.

Signed-off-by: Ionut Alexa 
---
 kernel/cgroup.c |   36 ++--
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 70776ae..fb6a4fd 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -83,8 +83,8 @@
  */
 #ifdef CONFIG_PROVE_RCU
 DEFINE_MUTEX(cgroup_mutex);
-DECLARE_RWSEM(css_set_rwsem);
 EXPORT_SYMBOL_GPL(cgroup_mutex);
+DECLARE_RWSEM(css_set_rwsem);
 EXPORT_SYMBOL_GPL(css_set_rwsem);
 #else
 static DEFINE_MUTEX(cgroup_mutex);
@@ -106,7 +106,7 @@ static DEFINE_SPINLOCK(release_agent_path_lock);
 #define cgroup_assert_mutex_or_rcu_locked()\
rcu_lockdep_assert(rcu_read_lock_held() ||  \
   lockdep_is_held(_mutex),  \
-  "cgroup_mutex or RCU read lock required");
+  "cgroup_mutex or RCU read lock required")
 
 /*
  * cgroup destruction makes heavy use of work items and there can be a lot
@@ -123,15 +123,17 @@ static struct workqueue_struct *cgroup_destroy_wq;
 static struct workqueue_struct *cgroup_pidlist_destroy_wq;
 
 /* generate an array of cgroup subsystem pointers */
-#define SUBSYS(_x) [_x ## _cgrp_id] = &_x ## _cgrp_subsys,
+#define SUBSYS(_x) \
+   [_x ## _cgrp_id] = &_x ## _cgrp_subsys,
 static struct cgroup_subsys *cgroup_subsys[] = {
 #include 
 };
 #undef SUBSYS
 
 /* array of cgroup subsystem names */
-#define SUBSYS(_x) [_x ## _cgrp_id] = #_x,
-static const char *cgroup_subsys_name[] = {
+#define SUBSYS(_x) \
+   [_x ## _cgrp_id] = #_x,
+static const char * const cgroup_subsys_name[] = {
 #include 
 };
 #undef SUBSYS
@@ -1325,6 +1327,7 @@ static int parse_cgroupfs_options(char *data, struct 
cgroup_sb_opts *opts)
/* Must match [\w.-]+ */
for (i = 0; i < strlen(name); i++) {
char c = name[i];
+
if (isalnum(c))
continue;
if ((c == '.') || (c == '-') || (c == '_'))
@@ -1694,7 +1697,7 @@ static struct dentry *cgroup_mount(struct 
file_system_type *fs_type,
 
if (!percpu_ref_tryget_live(>root->cgrp.self.refcnt)) {
mutex_unlock(_mutex);
-   msleep(10);
+   usleep_range(1, 11000);
ret = restart_syscall();
goto out_free;
}
@@ -1758,7 +1761,7 @@ static struct dentry *cgroup_mount(struct 
file_system_type *fs_type,
mutex_unlock(_mutex);
if (!IS_ERR_OR_NULL(pinned_sb))
deactivate_super(pinned_sb);
-   msleep(10);
+   usleep_range(1, 11000);
ret = restart_syscall();
goto out_free;
}
@@ -2191,7 +2194,7 @@ static int cgroup_migrate(struct cgroup *cgrp, struct 
task_struct *leader,
if (list_empty(>mg_dst_cset->mg_node))
list_move_tail(>mg_dst_cset->mg_node,
   _csets);
-   next:
+next:
if (!threadgroup)
break;
} while_each_thread(leader, task);
@@ -2764,6 +2767,7 @@ err_undo_css:
 
cgroup_for_each_live_child(child, cgrp) {
struct cgroup_subsys_state *css = cgroup_css(child, ss);
+
if (css)
kill_css(css);
}
@@ -2800,12 +2804,16 @@ static ssize_t cgroup_file_write(struct 
kernfs_open_file *of, char *buf,
 
if (cft->write_u64) {
unsigned long long v;
+
ret = kstrtoull(buf, 0, );
+
if (!ret)
ret = cft->write_u64(css, cft, v);
} else if (cft->write_s64) {
long long v;
+
ret = kstrtoll(buf, 0, );
+
if (!ret)
ret = cft->write_s64(css, cft, v);
} else {
@@ -3954,6 +3962,7 @@ static void *cgroup_pidlist_start(struct seq_file *s, 
loff_t *pos)
 
while (index < end) {
int mid = (index + end) / 2;
+
if (cgroup_pid_fry(cgrp, l->list[mid]) == pid) {
index = mid;
break;
@@ -4682,7 +4691,7 @@ static void __init cgroup_init_subsys(struct 
cgroup_subsys *ss, bool early)
 {
struct cgroup_subsys_state *css;
 
-   printk(KERN_INFO "Initializing cgroup subsys %s\n", ss->name);
+   pr_info("Initializi

[PATCH] kernel:cgroup :fixed coding style issues

2014-07-11 Thread Ionut Alexa
From: Ionut Alexa johnnyal...@yahoo.com

Fixed coding style issues.

Signed-off-by: Ionut Alexa johnnyal...@yahoo.com
---
 kernel/cgroup.c |   36 ++--
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 70776ae..fb6a4fd 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -83,8 +83,8 @@
  */
 #ifdef CONFIG_PROVE_RCU
 DEFINE_MUTEX(cgroup_mutex);
-DECLARE_RWSEM(css_set_rwsem);
 EXPORT_SYMBOL_GPL(cgroup_mutex);
+DECLARE_RWSEM(css_set_rwsem);
 EXPORT_SYMBOL_GPL(css_set_rwsem);
 #else
 static DEFINE_MUTEX(cgroup_mutex);
@@ -106,7 +106,7 @@ static DEFINE_SPINLOCK(release_agent_path_lock);
 #define cgroup_assert_mutex_or_rcu_locked()\
rcu_lockdep_assert(rcu_read_lock_held() ||  \
   lockdep_is_held(cgroup_mutex),  \
-  cgroup_mutex or RCU read lock required);
+  cgroup_mutex or RCU read lock required)
 
 /*
  * cgroup destruction makes heavy use of work items and there can be a lot
@@ -123,15 +123,17 @@ static struct workqueue_struct *cgroup_destroy_wq;
 static struct workqueue_struct *cgroup_pidlist_destroy_wq;
 
 /* generate an array of cgroup subsystem pointers */
-#define SUBSYS(_x) [_x ## _cgrp_id] = _x ## _cgrp_subsys,
+#define SUBSYS(_x) \
+   [_x ## _cgrp_id] = _x ## _cgrp_subsys,
 static struct cgroup_subsys *cgroup_subsys[] = {
 #include linux/cgroup_subsys.h
 };
 #undef SUBSYS
 
 /* array of cgroup subsystem names */
-#define SUBSYS(_x) [_x ## _cgrp_id] = #_x,
-static const char *cgroup_subsys_name[] = {
+#define SUBSYS(_x) \
+   [_x ## _cgrp_id] = #_x,
+static const char * const cgroup_subsys_name[] = {
 #include linux/cgroup_subsys.h
 };
 #undef SUBSYS
@@ -1325,6 +1327,7 @@ static int parse_cgroupfs_options(char *data, struct 
cgroup_sb_opts *opts)
/* Must match [\w.-]+ */
for (i = 0; i  strlen(name); i++) {
char c = name[i];
+
if (isalnum(c))
continue;
if ((c == '.') || (c == '-') || (c == '_'))
@@ -1694,7 +1697,7 @@ static struct dentry *cgroup_mount(struct 
file_system_type *fs_type,
 
if (!percpu_ref_tryget_live(ss-root-cgrp.self.refcnt)) {
mutex_unlock(cgroup_mutex);
-   msleep(10);
+   usleep_range(1, 11000);
ret = restart_syscall();
goto out_free;
}
@@ -1758,7 +1761,7 @@ static struct dentry *cgroup_mount(struct 
file_system_type *fs_type,
mutex_unlock(cgroup_mutex);
if (!IS_ERR_OR_NULL(pinned_sb))
deactivate_super(pinned_sb);
-   msleep(10);
+   usleep_range(1, 11000);
ret = restart_syscall();
goto out_free;
}
@@ -2191,7 +2194,7 @@ static int cgroup_migrate(struct cgroup *cgrp, struct 
task_struct *leader,
if (list_empty(cset-mg_dst_cset-mg_node))
list_move_tail(cset-mg_dst_cset-mg_node,
   tset.dst_csets);
-   next:
+next:
if (!threadgroup)
break;
} while_each_thread(leader, task);
@@ -2764,6 +2767,7 @@ err_undo_css:
 
cgroup_for_each_live_child(child, cgrp) {
struct cgroup_subsys_state *css = cgroup_css(child, ss);
+
if (css)
kill_css(css);
}
@@ -2800,12 +2804,16 @@ static ssize_t cgroup_file_write(struct 
kernfs_open_file *of, char *buf,
 
if (cft-write_u64) {
unsigned long long v;
+
ret = kstrtoull(buf, 0, v);
+
if (!ret)
ret = cft-write_u64(css, cft, v);
} else if (cft-write_s64) {
long long v;
+
ret = kstrtoll(buf, 0, v);
+
if (!ret)
ret = cft-write_s64(css, cft, v);
} else {
@@ -3954,6 +3962,7 @@ static void *cgroup_pidlist_start(struct seq_file *s, 
loff_t *pos)
 
while (index  end) {
int mid = (index + end) / 2;
+
if (cgroup_pid_fry(cgrp, l-list[mid]) == pid) {
index = mid;
break;
@@ -4682,7 +4691,7 @@ static void __init cgroup_init_subsys(struct 
cgroup_subsys *ss, bool early)
 {
struct cgroup_subsys_state *css;
 
-   printk(KERN_INFO Initializing cgroup subsys %s\n, ss-name

[PATCH] tools:thermal:tmon :fix coding style issues

2014-07-11 Thread Ionut Alexa
From: Ionut Alexa johnnyal...@yahoo.com

Fixed coding style issues.

Signed-off-by: Ionut Alexa johnnyal...@yahoo.com
---
 tools/thermal/tmon/tmon.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/thermal/tmon/tmon.c b/tools/thermal/tmon/tmon.c
index 09b7c32..bffd3d9 100644
--- a/tools/thermal/tmon/tmon.c
+++ b/tools/thermal/tmon/tmon.c
@@ -55,7 +55,7 @@ static void   start_daemon_mode(void);
 
 pthread_t event_tid;
 pthread_mutex_t input_lock;
-void usage()
+void usage(void)
 {
printf(Usage: tmon [OPTION...]\n);
printf(  -c, --control cooling device in control\n);
@@ -70,7 +70,7 @@ void usage()
exit(0);
 }
 
-void version()
+void version(void)
 {
printf(TMON version %s\n, VERSION);
exit(EXIT_SUCCESS);
@@ -340,11 +340,12 @@ int main(int argc, char **argv)
return 0;
 }
 
-static void start_daemon_mode()
+static void start_daemon_mode(void)
 {
daemon_mode = 1;
/* fork */
pid_t   sid, pid = fork();
+
if (pid  0) {
exit(EXIT_FAILURE);
} else if (pid  0)
-- 
1.7.10.4

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


[PATCH] kernel:exit :fix coding style warnings and errors.

2014-07-11 Thread Ionut Alexa
Fixed coding style warnings and errors.

Signed-off-by: Ionut Alexa ionut.m.al...@gmail.com
---
 kernel/exit.c |   49 ++---
 1 file changed, 26 insertions(+), 23 deletions(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index e5c4668..20a9c10 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -59,7 +59,7 @@
 #include asm/pgtable.h
 #include asm/mmu_context.h
 
-static void exit_mm(struct task_struct * tsk);
+static void exit_mm(struct task_struct *tsk);
 
 static void __unhash_process(struct task_struct *p, bool group_dead)
 {
@@ -151,7 +151,7 @@ static void __exit_signal(struct task_struct *tsk)
spin_unlock(sighand-siglock);
 
__cleanup_sighand(sighand);
-   clear_tsk_thread_flag(tsk,TIF_SIGPENDING);
+   clear_tsk_thread_flag(tsk, TIF_SIGPENDING);
if (group_dead) {
flush_sigqueue(sig-shared_pending);
tty_kref_put(tty);
@@ -168,7 +168,7 @@ static void delayed_put_task_struct(struct rcu_head *rhp)
 }
 
 
-void release_task(struct task_struct * p)
+void release_task(struct task_struct *p)
 {
struct task_struct *leader;
int zap_leader;
@@ -192,7 +192,8 @@ repeat:
 */
zap_leader = 0;
leader = p-group_leader;
-   if (leader != p  thread_group_empty(leader)  leader-exit_state == 
EXIT_ZOMBIE) {
+   if (leader != p  thread_group_empty(leader)
+leader-exit_state == EXIT_ZOMBIE) {
/*
 * If we were the last child thread and the leader has
 * exited already, and the leader's parent ignores SIGCHLD,
@@ -241,7 +242,8 @@ struct pid *session_of_pgrp(struct pid *pgrp)
  *
  * I ask you, have you ever known what it is to be an orphan?
  */
-static int will_become_orphaned_pgrp(struct pid *pgrp, struct task_struct 
*ignored_task)
+static int will_become_orphaned_pgrp(struct pid *pgrp,
+   struct task_struct *ignored_task)
 {
struct task_struct *p;
 
@@ -294,9 +296,9 @@ kill_orphaned_pgrp(struct task_struct *tsk, struct 
task_struct *parent)
struct task_struct *ignored_task = tsk;
 
if (!parent)
-/* exit: our father is in a different pgrp than
- * we are and we were the only connection outside.
- */
+   /* exit: our father is in a different pgrp than
+* we are and we were the only connection outside.
+*/
parent = tsk-real_parent;
else
/* reparent: our child is in a different pgrp than
@@ -405,7 +407,7 @@ assign_new_owner:
  * Turn us into a lazy TLB process if we
  * aren't already..
  */
-static void exit_mm(struct task_struct * tsk)
+static void exit_mm(struct task_struct *tsk)
 {
struct mm_struct *mm = tsk-mm;
struct core_state *core_state;
@@ -425,6 +427,7 @@ static void exit_mm(struct task_struct * tsk)
core_state = mm-core_state;
if (core_state) {
struct core_thread self;
+
up_read(mm-mmap_sem);
 
self.task = tsk;
@@ -565,6 +568,7 @@ static void forget_original_parent(struct task_struct 
*father)
 
list_for_each_entry_safe(p, n, father-children, sibling) {
struct task_struct *t = p;
+
do {
t-real_parent = reaper;
if (t-parent == father) {
@@ -598,7 +602,7 @@ static void exit_notify(struct task_struct *tsk, int 
group_dead)
/*
 * This does two things:
 *
-* A.  Make init inherit all the child processes
+* A.  Make init inherit all the child processes
 * B.  Check to see if any process groups have become orphaned
 *  as a result of our exiting, and if they have any stopped
 *  jobs, send them a SIGHUP and then a SIGCONT.  (POSIX 3.2.2.2)
@@ -648,9 +652,8 @@ static void check_stack_usage(void)
 
spin_lock(low_water_lock);
if (free  lowest_to_date) {
-   printk(KERN_WARNING %s (%d) used greatest stack depth: 
-   %lu bytes left\n,
-   current-comm, task_pid_nr(current), free);
+   pr_warn(%s (%d) used greatest stack depth: %lu bytes left\n,
+   current-comm, task_pid_nr(current), free);
lowest_to_date = free;
}
spin_unlock(low_water_lock);
@@ -691,8 +694,7 @@ void do_exit(long code)
 * leave this task alone and wait for reboot.
 */
if (unlikely(tsk-flags  PF_EXITING)) {
-   printk(KERN_ALERT
-   Fixing recursive fault but reboot is needed!\n);
+   pr_alert(Fixing recursive fault but reboot is needed!\n);
/*
 * We can do this unlocked here. The futex code uses
 * this flag just to verify whether the pi state
@@ -716,9

[PATCH] kernel:dma : fix coding style errors

2014-07-11 Thread Ionut Alexa
Fixed coding style errors.

Signed-off-by: Ionut Alexa ionut.m.al...@gmail.com
---
 kernel/dma.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/kernel/dma.c b/kernel/dma.c
index 6c6262f..ae9ba17 100644
--- a/kernel/dma.c
+++ b/kernel/dma.c
@@ -66,7 +66,7 @@ static struct dma_chan dma_chan_busy[MAX_DMA_CHANNELS] = {
  * @dmanr: DMA channel number
  * @device_id: reserving device ID string, used in /proc/dma
  */
-int request_dma(unsigned int dmanr, const char * device_id)
+int request_dma(unsigned int dmanr, const char *device_id)
 {
if (dmanr = MAX_DMA_CHANNELS)
return -EINVAL;
@@ -87,12 +87,12 @@ int request_dma(unsigned int dmanr, const char * device_id)
 void free_dma(unsigned int dmanr)
 {
if (dmanr = MAX_DMA_CHANNELS) {
-   printk(KERN_WARNING Trying to free DMA%d\n, dmanr);
+   pr_warn(Trying to free DMA%d\n, dmanr);
return;
}
 
if (xchg(dma_chan_busy[dmanr].lock, 0) == 0) {
-   printk(KERN_WARNING Trying to free free DMA%d\n, dmanr);
+   pr_warn(Trying to free free DMA%d\n, dmanr);
return;
}
 
@@ -152,9 +152,10 @@ static int __init proc_dma_init(void)
return 0;
 }
 
-__initcall(proc_dma_init);
+device_initcall(proc_dma_init);
 #endif
 
 EXPORT_SYMBOL(request_dma);
 EXPORT_SYMBOL(free_dma);
 EXPORT_SYMBOL(dma_spin_lock);
+
-- 
1.7.10.4

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