Re: [tpmdd-devel] [PATCH 06/13] tpm: Remove redundantdev_set_drvdata

From: Ashley Lai
Date: Fri Oct 04 2013 - 22:14:36 EST


On Mon, 2013-09-23 at 12:14 -0600, Jason Gunthorpe wrote:
> TPM drivers should not call dev_set_drvdata (or aliases), only the core
> code is allowed to call dev_set_drvdata, and it does it during
> tpm_register_hardware.
>
> These extra sets are harmless, but are an anti-pattern that many drivers
> have copied.
>
> Signed-off-by: Jason Gunthorpe <jgunthorpe@xxxxxxxxxxxxxxxxxxxx>

> diff --git a/drivers/char/tpm/tpm_spi_stm_st33.c b/drivers/char/tpm/tpm_spi_stm_st33.c
> index 8d3e8e2..f5e3cd6 100644
> --- a/drivers/char/tpm/tpm_spi_stm_st33.c
> +++ b/drivers/char/tpm/tpm_spi_stm_st33.c
> @@ -779,7 +779,6 @@ tpm_st33_spi_probe(struct spi_device *dev)
> tpm_get_timeouts(chip);
>
> /* attach chip datas to client */
Looks good except this comment needs to be removed. Since this driver
is not merged, please remove this line in the new driver.

> - spi_set_drvdata(dev, chip);
> platform_data->bchipf = false;
>

Acked-by: Ashley Lai <adlai@xxxxxxxxxxxxxxxxxx>

Thanks,
--Ashley Lai


--
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/