Re: [PATCH 1/1] TPM: new stm i2c device driver

From: Rajiv Andrade
Date: Fri Sep 16 2011 - 15:01:28 EST



On 02-09-2011 11:46, Rajiv Andrade wrote:
>>>>> +static int wait_for_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout,
>>>>> >>>> + wait_queue_head_t *queue)
> Sounds a copy & paste issue here, but *queue isn't being used here.
>>>>> >>>> +{
>>>>> >>>> + unsigned long stop;
>>>>> >>>> + u8 status;
>>>>> >>>> +
>>>>> >>>> + FUNC_ENTER();
>>>>> >>>> +
>>>>> >>>> + /* check current status */
>>>>> >>>> + status = tpm_stm_i2c_status(chip);
>>>>> >>>> + if (status == mask)
>>>>> >>>> + return 0;
>>>>> >>>> + if (status == TPM_STS_CANCEL)
>>>>> >>>> + goto end;
>>>>> >>>> + stop = jiffies + timeout;
>>>>> >>>> + do {
>>>>> >>>> + msleep(TPM_TIMEOUT);
>>>>> >>>> + status = tpm_stm_i2c_status(chip);
>>>>> >>>> + if ((status & mask) == mask)
>>>>> >>>> + return 0;
>>>>> >>>> + } while (time_before(jiffies, stop));
>>>>> >>>> +end:
>>>>> >>>> + return -ETIME;
>>>>> >>>> +}
>>>>> >>>> +
> This is very similar to what's in tpm_tis.c, given there's one more user for it now, it's a good time
> to move it to tpm.c and provide it tpm_stm_i2c_status or tpm_tis_status as a function pointer.
Just moved wait_for_stat to tpm.c so other drivers can use it. The changes were committed to:

github.com:srajiv/tpm.git

Rajiv
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/