mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Manish Katiyar <mkatiyar@gmail.com>
To: mingo@elte.hu, LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Cc: mkatiyar@gmail.com
Subject: [PATCH] Remove errors caught by checkpatch.pl in kernel/acct.c
Date: Mon, 16 Feb 2009 00:20:25 +0530	[thread overview]
Message-ID: <ea11fea30902151050i4b5b2e6esa0c4be519afa4127@mail.gmail.com> (raw)

Hi,

Below patch removes errors generated by checkpatch.pl in
kernel/acct.c. Caught by Ingo's code-quality script.


Signed-off-by: Manish Katiyar <mkatiyar@gmail.com>
---
 kernel/acct.c |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/kernel/acct.c b/kernel/acct.c
index 7afa315..00fbf8e 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -144,7 +144,7 @@ static int check_free_space(struct bsd_acct_struct
*acct, struct file *file)
        spin_lock(&acct_lock);
        if (file != acct->file) {
                if (act)
-                       res = act>0;
+                       res = act > 0;
                goto out;
        }

@@ -287,7 +287,7 @@ SYSCALL_DEFINE1(acct, const char __user *, name)
        if (name) {
                char *tmp = getname(name);
                if (IS_ERR(tmp))
-                       return (PTR_ERR(tmp));
+                       return PTR_ERR(tmp);
                error = acct_on(tmp);
                putname(tmp);
        } else {
@@ -403,7 +403,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)
  *
@@ -416,7 +416,7 @@ static comp_t encode_comp_t(unsigned long value)
 #define MANTSIZE2       20                      /* 20 bit mantissa. */
 #define EXPSIZE2        5                       /* 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)
 {
@@ -447,7 +447,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
  */
@@ -456,8 +456,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--;
 	}
@@ -513,13 +514,13 @@ 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);
@@ -531,15 +532,15 @@ static void do_acct_process(struct bsd_acct_struct *acct,
 	ac.ac_btime = get_seconds() - elapsed;
 	/* we really need to bite the bullet and change layout */
 	current_uid_gid(&ac.ac_uid, &ac.ac_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);
-- 
1.5.4.3

Thanks -
Manish

             reply	other threads:[~2009-02-15 18:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-15 18:50 Manish Katiyar [this message]
2009-02-16 13:19 ` Stefan Richter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea11fea30902151050i4b5b2e6esa0c4be519afa4127@mail.gmail.com \
    --to=mkatiyar@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®