Re: [tpmdd-devel] [PATCH 2/3] tpm: Get rid of chip->pdev

From: Jason Gunthorpe
Date: Sun Feb 14 2016 - 02:06:31 EST


On Sat, Feb 13, 2016 at 10:39:11AM -0500, Stefan Berger wrote:

> >@@ -347,8 +347,8 @@ static int i2c_nuvoton_recv(struct tpm_chip *chip, u8 *buf, size_t count)
> > */
> > static int i2c_nuvoton_send(struct tpm_chip *chip, u8 *buf, size_t len)
> > {
> >- struct device *dev = chip->pdev;
> >- struct i2c_client *client = to_i2c_client(dev);
> >+ struct device *dev = &chip->dev;
> This looks wrong or are you fixing a bug here? chip->dev.parent ?

No, in this function dev is only used for dev_err/etc so it should be
changed, like every other dev_err/etc call in this patch.

Expect for this use:

> >+ struct i2c_client *client = to_i2c_client(chip->dev.parent);
>
> Does this need to be replaced ?

Which must stay as the parent.

Jason