Quoting Jarkko Sakkinen (2019-08-29 09:32:21) > On Wed, Aug 28, 2019 at 01:21:50AM -0700, Stephen Boyd wrote: > > diff --git a/drivers/char/tpm/cr50_spi.c b/drivers/char/tpm/cr50_spi.c > > new file mode 100644 > > index 000000000000..535674f4b02a > > --- /dev/null > > +++ b/drivers/char/tpm/cr50_spi.c > > @@ -0,0 +1,327 @@ [...] > > + > > +#ifdef CONFIG_PM_SLEEP > > +int tpm_tis_spi_resume(struct device *dev) > > +{ > > + struct tpm_chip *chip = dev_get_drvdata(dev); > > + struct tpm_tis_data *data = dev_get_drvdata(&chip->dev); > > + struct tpm_tis_spi_phy *phy = to_tpm_tis_spi_phy(data); > > + struct cr50_spi_phy *cr50_phy; > > + > > + if (phy->is_cr50) { > > + cr50_phy = to_cr50_spi_phy(phy); > > + /* > > + * Jiffies not increased during suspend, so we need to reset > > + * the time to wake Cr50 after resume. > > + */ > > + cr50_phy->wake_after = jiffies; > > + } > > To simplify the code I would just put also wake_after to > tpm_tis_spi_phy. Ok. But keep the other members in cr50_spi_phy as they are? > > > + > > + return tpm_tis_resume(dev); > > +} > > +#endif > > diff --git a/drivers/char/tpm/tpm_tis_spi.c b/drivers/char/tpm/tpm_tis_spi.c > > index b3ed85671dd8..fdac842a61ed 100644 > > --- a/drivers/char/tpm/tpm_tis_spi.c > > +++ b/drivers/char/tpm/tpm_tis_spi.c > > @@ -215,17 +219,18 @@ static int tpm_tis_spi_probe(struct spi_device *dev) > > { > > struct tpm_tis_spi_phy *phy; > > int irq; > > + struct device_node *np = dev->dev.of_node; > > + const struct spi_device_id *spi_dev_id = spi_get_device_id(dev); > > + > > + if (of_device_is_compatible(np, "google,cr50") || > > + (spi_dev_id && spi_dev_id->driver_data == TPM_IS_CR50)) > > + return cr50_spi_probe(dev); > > You could keep pointers to probes directly in driver_data. Ok. Will do.