snprintf(devname, sizeof(devname), "%s%d", "tpm", chip->dev_num); 
devname = kmalloc(DEVNAME_SIZE, GFP_KERNEL); scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num); 
int tpm_register_hardware(struct pci_dev *pci_dev,			  struct tpm_vendor_specific *entry){	char devname[7];	struct tpm_chip *chip;	int i, j;	/* Driver specific per-device data */	chip = kmalloc(sizeof(*chip), GFP_KERNEL);	if (chip == NULL)		return -ENOMEM;	memset(chip, 0, sizeof(struct tpm_chip));	init_MUTEX(&chip->buffer_mutex);	init_MUTEX(&chip->tpm_mutex);	INIT_LIST_HEAD(&chip->list);	init_timer(&chip->user_read_timer);	chip->user_read_timer.function = user_reader_timeout;	chip->user_read_timer.data = (unsigned long) chip;	chip->vendor = entry;	chip->dev_num = -1;	for (i = 0; i < TPM_NUM_MASK_ENTRIES; i++)		for (j = 0; j < 8 * sizeof(int); j++)			if ((dev_mask[i] & (1 << j)) == 0) {				chip->dev_num =				    i * TPM_NUM_MASK_ENTRIES + j;				dev_mask[i] |= 1 << j;				goto dev_num_search_complete;			}dev_num_search_complete:	if (chip->dev_num < 0) {		dev_err(&pci_dev->dev,			"No available tpm device numbers\n");		kfree(chip);		return -ENODEV;	} else if (chip->dev_num == 0)		chip->vendor->miscdev.minor = TPM_MINOR;	else		chip->vendor->miscdev.minor = MISC_DYNAMIC_MINOR;	snprintf(devname, sizeof(devname), "%s%d", "tpm", chip->dev_num);	chip->vendor->miscdev.name = devname;	chip->vendor->miscdev.dev = &(pci_dev->dev);	chip->pci_dev = pci_dev_get(pci_dev);	if (misc_register(&chip->vendor->miscdev)) {		dev_err(&chip->pci_dev->dev,			"unable to misc_register %s, minor %d\n",			chip->vendor->miscdev.name,			chip->vendor->miscdev.minor);		pci_dev_put(pci_dev);		kfree(chip);		dev_mask[i] &= !(1 << j);		return -ENODEV;	}	spin_lock(&driver_lock);	pci_set_drvdata(pci_dev, chip);	list_add(&chip->list, &tpm_chip_list);	spin_unlock(&driver_lock);	sysfs_create_group(&pci_dev->dev.kobj, chip->vendor->attr_group);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/6f9beccb95a47a15e446f64fbb7041dc6edce4d9/tpm.c/clean/drivers/char/tpm/tpm.c