From: Kylene Jo Hall <kjhall@us.ibm.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
TPM Device Driver List <tpmdd-devel@lists.sourceforge.net>
Subject: [PATCH] tpm: use clear_bit
Date: Tue, 11 Apr 2006 17:42:25 -0500 [thread overview]
Message-ID: <1144795345.12054.36.camel@localhost.localdomain> (raw)
In-Reply-To: <20060410145030.0b719e18.akpm@osdl.org>
On Mon, 2006-04-10 at 14:50 -0700, Andrew Morton wrote:
> Kylene Jo Hall <kjhall@us.ibm.com> wrote:
> >
> > + dev_mask[chip->dev_num / TPM_NUM_MASK_ENTRIES] &=
> > + ~(1 << (chip->dev_num % TPM_NUM_MASK_ENTRIES));
>
> If you were to make dev_mask[] an array of longs, this could perhaps become
>
> clear_bit(dev_mask, chip->dev_num);
>
Use set_bit and clear_bit for dev_mask manipulation.
Signed-off-by: Kylie Hall <kjhall@us.ibm.com>
---
drivers/char/tpm/tpm.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
--- linux-2.6.17-rc1-mm2/drivers/char/tpm/tpm.c 2006-04-11 17:30:57.612009250 -0500
+++ linux-2.6.17-rc1/drivers/char/tpm/tpm.c 2006-04-11 17:47:23.097598250 -0500
@@ -32,7 +32,7 @@ enum tpm_const {
TPM_MINOR = 224, /* officially assigned */
TPM_BUFSIZE = 2048,
TPM_NUM_DEVICES = 256,
- TPM_NUM_MASK_ENTRIES = TPM_NUM_DEVICES / (8 * sizeof(int))
+ TPM_NUM_MASK_ENTRIES = TPM_NUM_DEVICES / (8 * sizeof(unsigned long))
};
enum tpm_duration {
@@ -48,7 +48,7 @@ enum tpm_duration {
static LIST_HEAD(tpm_chip_list);
static DEFINE_SPINLOCK(driver_lock);
-static int dev_mask[TPM_NUM_MASK_ENTRIES];
+static unsigned long dev_mask[TPM_NUM_MASK_ENTRIES];
/*
* Array with one entry per ordinal defining the maximum amount
@@ -1033,8 +1033,7 @@ void tpm_remove_hardware(struct device *
sysfs_remove_group(&dev->kobj, chip->vendor.attr_group);
tpm_bios_log_teardown(chip->bios_dir);
- dev_mask[chip->dev_num / TPM_NUM_MASK_ENTRIES] &=
- ~(1 << (chip->dev_num % TPM_NUM_MASK_ENTRIES));
+ clear_bit(chip->dev_num , dev_mask);
kfree(chip);
@@ -1118,7 +1117,7 @@ struct tpm_chip *tpm_register_hardware(s
if ((dev_mask[i] & (1 << j)) == 0) {
chip->dev_num =
i * TPM_NUM_MASK_ENTRIES + j;
- dev_mask[i] |= 1 << j;
+ set_bit(chip->dev_num, dev_mask);
goto dev_num_search_complete;
}
next prev parent reply other threads:[~2006-04-11 22:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-10 14:37 [PATCH 3/7] tpm: chip struct update Kylene Jo Hall
2006-04-10 21:50 ` Andrew Morton
2006-04-11 22:42 ` Kylene Jo Hall [this message]
2006-04-11 23:02 ` [PATCH] tpm: use clear_bit Andrew Morton
2006-04-11 23:21 ` Andrew Morton
2006-04-12 21:47 ` [PATCH] tpm: use find_first_zero_bit Kylene Jo Hall
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=1144795345.12054.36.camel@localhost.localdomain \
--to=kjhall@us.ibm.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tpmdd-devel@lists.sourceforge.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.