Skip to contentSkip to conversation

staging: kernel: fixed style warnings in acct.c

PATCH In review Joshua I. James 3 participants 3 messages Dec 5, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: kernel: fixed style warnings in acct.c

From: "Joshua I. James" <[email protected]>

Fixed style errors identified by checkpatch.

Output of checkpatch:
WARNING: Missing a blank line after declarations
WARNING: line over 80 characters
ERROR: spaces required around that '==' (ctx:VxV)
+#if ACCT_VERSION==2

---
 kernel/acct.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
kernel/acct.c +16 -6
index 33738ef..322159c 100644
@@ -105,6 +105,7 @@ static int check_free_space(struct bsd_acct_struct *acct)
 
 	if (acct->active) {
 		u64 suspend = sbuf.f_blocks * SUSPEND;
+
 		do_div(suspend, 100);
 		if (sbuf.f_bavail <= suspend) {
 			acct->active = 0;
@@ -112,6 +113,7 @@ static int check_free_space(struct bsd_acct_struct *acct)
 		}
 	} else {
 		u64 resume = sbuf.f_blocks * RESUME;
+
 		do_div(resume, 100);
 		if (sbuf.f_bavail >= resume) {
 			acct->active = 1;
@@ -152,8 +154,10 @@ again:
 
 static void close_work(struct work_struct *work)
 {
-	struct bsd_acct_struct *acct = container_of(work, struct bsd_acct_struct, work);
+	struct bsd_acct_struct *acct =
+		container_of(work, struct bsd_acct_struct, work);
 	struct file *file = acct->file;
+
 	if (file->f_op->flush)
 		file->f_op->flush(file, NULL);
 	__fput_sync(file);
@@ -165,6 +169,7 @@ static void acct_kill(struct bsd_acct_struct *acct,
 {
 	if (acct) {
 		struct pid_namespace *ns = acct->ns;
+
 		do_acct_process(acct);
 		INIT_WORK(&acct->work, close_work);
 		init_completion(&acct->done);
@@ -182,6 +187,7 @@ static void acct_kill(struct bsd_acct_struct *acct,
 static void acct_pin_kill(struct fs_pin *pin)
 {
 	struct bsd_acct_struct *acct;
+
 	acct = container_of(pin, struct bsd_acct_struct, pin);
 	mutex_lock(&acct->lock);
 	if (!acct->ns) {
@@ -448,15 +454,17 @@ static void fill_ac(acct_t *ac)
 #endif
 	do_div(elapsed, AHZ);
 	ac->ac_btime = get_seconds() - elapsed;
-#if ACCT_VERSION==2
+#if ACCT_VERSION == 2
 	ac->ac_ahz = AHZ;
 #endif
 
 	spin_lock_irq(&current->sighand->siglock);
 	tty = current->signal->tty;	/* Safe as we hold the siglock */
 	ac->ac_tty = tty ? old_encode_dev(tty_devnum(tty)) : 0;
-	ac->ac_utime = encode_comp_t(jiffies_to_AHZ(cputime_to_jiffies(pacct->ac_utime)));
-	ac->ac_stime = encode_comp_t(jiffies_to_AHZ(cputime_to_jiffies(pacct->ac_stime)));
+	ac->ac_utime = encode_comp_t(jiffies_to_AHZ(
+		cputime_to_jiffies(pacct->ac_utime)));
+	ac->ac_stime = encode_comp_t(jiffies_to_AHZ(
+		cputime_to_jiffies(pacct->ac_stime)));
 	ac->ac_flag = pacct->ac_flag;
 	ac->ac_mem = encode_comp_t(pacct->ac_mem);
 	ac->ac_minflt = encode_comp_t(pacct->ac_minflt);
@@ -504,8 +512,8 @@ static void do_acct_process(struct bsd_acct_struct *acct)
 
 		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);
+		ac.ac_ppid = task_tgid_nr_ns(rcu_dereference(
+			current->real_parent), ns);
 		rcu_read_unlock();
 	}
 #endif
@@ -516,6 +524,7 @@ static void do_acct_process(struct bsd_acct_struct *acct)
 	if (file_start_write_trylock(file)) {
 		/* it's been opened O_APPEND, so position is irrelevant */
 		loff_t pos = 0;
+
 		__kernel_write(file, (char *)&ac, sizeof(acct_t), &pos);
 		file_end_write(file);
 	}
@@ -573,6 +582,7 @@ static void slow_acct_process(struct pid_namespace *ns)
 {
 	for ( ; ns; ns = ns->parent) {
 		struct bsd_acct_struct *acct = acct_get(ns);
+
 		if (acct) {
 			do_acct_process(acct);
 			mutex_unlock(&acct->lock);
Signature · 1 line
1.9.1
#1 lore raw

Joshua,

Quoted 10 lines · Joshua I. James

From: "Joshua I. James" <[email protected]>

Fixed style errors identified by checkpatch.

Output of checkpatch:
WARNING: Missing a blank line after declarations
WARNING: line over 80 characters
ERROR: spaces required around that '==' (ctx:VxV)
+#if ACCT_VERSION==2

It looks like your patch is making three types of changes. A single patch should make a single type of change. For example, you might fix all the "blank line after declaration" warnings in one patch.

Doing this helps make your patches easier to review, and if a problem arises later, easier to bisect.

kernel/acct.c

Quoted 8 lines
---
 kernel/acct.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
kernel/acct.c +0 -1
index 33738ef..322159c 100644
--- a/kernel/acct.c

[...]

It also looks like you only sent this to the linux-kernel mailing list. You should use scripts/get_maintainer.pl to find who to send it to.

Hope that helps :-)

Signature · 1 line
- Jeremiah Mahler
#2 lore raw
In reply to Joshua I. James
Quoted 11 lines · Joshua I. James

From: "Joshua I. James" <[email protected]>

Fixed style errors identified by checkpatch.

Output of checkpatch:
WARNING: Missing a blank line after declarations
WARNING: line over 80 characters
ERROR: spaces required around that '==' (ctx:VxV)
+#if ACCT_VERSION==2

1) kernel is not part of staging. Give your subject properly.
2) Do not use Initials in your From and Signed-off.

thanks
sudip

Quoted 108 lines
---
 kernel/acct.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
kernel/acct.c +16 -6
index 33738ef..322159c 100644
@@ -105,6 +105,7 @@ static int check_free_space(struct bsd_acct_struct *acct)
 
 	if (acct->active) {
 		u64 suspend = sbuf.f_blocks * SUSPEND;
+
 		do_div(suspend, 100);
 		if (sbuf.f_bavail <= suspend) {
 			acct->active = 0;
@@ -112,6 +113,7 @@ static int check_free_space(struct bsd_acct_struct *acct)
 		}
 	} else {
 		u64 resume = sbuf.f_blocks * RESUME;
+
 		do_div(resume, 100);
 		if (sbuf.f_bavail >= resume) {
 			acct->active = 1;
@@ -152,8 +154,10 @@ again:
 
 static void close_work(struct work_struct *work)
 {
-	struct bsd_acct_struct *acct = container_of(work, struct bsd_acct_struct, work);
+	struct bsd_acct_struct *acct =
+		container_of(work, struct bsd_acct_struct, work);
 	struct file *file = acct->file;
+
 	if (file->f_op->flush)
 		file->f_op->flush(file, NULL);
 	__fput_sync(file);
@@ -165,6 +169,7 @@ static void acct_kill(struct bsd_acct_struct *acct,
 {
 	if (acct) {
 		struct pid_namespace *ns = acct->ns;
+
 		do_acct_process(acct);
 		INIT_WORK(&acct->work, close_work);
 		init_completion(&acct->done);
@@ -182,6 +187,7 @@ static void acct_kill(struct bsd_acct_struct *acct,
 static void acct_pin_kill(struct fs_pin *pin)
 {
 	struct bsd_acct_struct *acct;
+
 	acct = container_of(pin, struct bsd_acct_struct, pin);
 	mutex_lock(&acct->lock);
 	if (!acct->ns) {
@@ -448,15 +454,17 @@ static void fill_ac(acct_t *ac)
 #endif
 	do_div(elapsed, AHZ);
 	ac->ac_btime = get_seconds() - elapsed;
-#if ACCT_VERSION==2
+#if ACCT_VERSION == 2
 	ac->ac_ahz = AHZ;
 #endif
 
 	spin_lock_irq(&current->sighand->siglock);
 	tty = current->signal->tty;	/* Safe as we hold the siglock */
 	ac->ac_tty = tty ? old_encode_dev(tty_devnum(tty)) : 0;
-	ac->ac_utime = encode_comp_t(jiffies_to_AHZ(cputime_to_jiffies(pacct->ac_utime)));
-	ac->ac_stime = encode_comp_t(jiffies_to_AHZ(cputime_to_jiffies(pacct->ac_stime)));
+	ac->ac_utime = encode_comp_t(jiffies_to_AHZ(
+		cputime_to_jiffies(pacct->ac_utime)));
+	ac->ac_stime = encode_comp_t(jiffies_to_AHZ(
+		cputime_to_jiffies(pacct->ac_stime)));
 	ac->ac_flag = pacct->ac_flag;
 	ac->ac_mem = encode_comp_t(pacct->ac_mem);
 	ac->ac_minflt = encode_comp_t(pacct->ac_minflt);
@@ -504,8 +512,8 @@ static void do_acct_process(struct bsd_acct_struct *acct)
 
 		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);
+		ac.ac_ppid = task_tgid_nr_ns(rcu_dereference(
+			current->real_parent), ns);
 		rcu_read_unlock();
 	}
 #endif
@@ -516,6 +524,7 @@ static void do_acct_process(struct bsd_acct_struct *acct)
 	if (file_start_write_trylock(file)) {
 		/* it's been opened O_APPEND, so position is irrelevant */
 		loff_t pos = 0;
+
 		__kernel_write(file, (char *)&ac, sizeof(acct_t), &pos);
 		file_end_write(file);
 	}
@@ -573,6 +582,7 @@ static void slow_acct_process(struct pid_namespace *ns)
 {
 	for ( ; ns; ns = ns->parent) {
 		struct bsd_acct_struct *acct = acct_get(ns);
+
 		if (acct) {
 			do_acct_process(acct);
 			mutex_unlock(&acct->lock);
Signature · 7 lines
1.9.1

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