From: Aniroop Mathur <aniroop.mathur@gmail.com>
To: <schwidefsky@de.ibm.com>, <heiko.carstens@de.ibm.com>,
<linux390@de.ibm.com>, <linux-s390@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: <aniroop.mathur@gmail.com>, <a.mathur@samsung.com>
Subject: [PATCH] s390: Initialize nr_devices count variable to -1
Date: Sun, 28 Dec 2014 21:42:53 +0530 [thread overview]
Message-ID: <1419783173-3066-1-git-send-email-aniroop.mathur@gmail.com> (raw)
From: Aniroop Mathur <a.mathur@samsung.com>
This patch initializes nr_device count variable to -1 to avoid extra
subtraction operation performed everytime scm block device is set up.
Signed-off-by: Aniroop Mathur <a.mathur@samsung.com>
---
drivers/s390/block/scm_blk.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/s390/block/scm_blk.c b/drivers/s390/block/scm_blk.c
index 76bed17..ee2bd6f 100644
--- a/drivers/s390/block/scm_blk.c
+++ b/drivers/s390/block/scm_blk.c
@@ -23,7 +23,7 @@ static int scm_major;
static DEFINE_SPINLOCK(list_lock);
static LIST_HEAD(inactive_requests);
static unsigned int nr_requests = 64;
-static atomic_t nr_devices = ATOMIC_INIT(0);
+static atomic_t nr_devices = ATOMIC_INIT(-1);
module_param(nr_requests, uint, S_IRUGO);
MODULE_PARM_DESC(nr_requests, "Number of parallel requests.");
@@ -357,7 +357,7 @@ int scm_blk_dev_setup(struct scm_blk_dev *bdev, struct scm_device *scmdev)
int len, ret = -ENOMEM;
unsigned int devindex, nr_max_blk;
- devindex = atomic_inc_return(&nr_devices) - 1;
+ devindex = atomic_inc_return(&nr_devices);
/* scma..scmz + scmaa..scmzz */
if (devindex > 701) {
ret = -ENODEV;
--
1.9.1
next reply other threads:[~2014-12-28 16:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-28 16:12 Aniroop Mathur [this message]
2014-12-29 9:56 ` [PATCH] s390: Initialize nr_devices count variable to -1 Martin Schwidefsky
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=1419783173-3066-1-git-send-email-aniroop.mathur@gmail.com \
--to=aniroop.mathur@gmail.com \
--cc=a.mathur@samsung.com \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux390@de.ibm.com \
--cc=schwidefsky@de.ibm.com \
/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