On Mon, 2006-04-10 at 14:50 -0700, Andrew Morton wrote:
> Kylene Jo Hall <[email protected]> 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 <[email protected]>
---
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;
}
-
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/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]