All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Christophe Ricard
	<christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: jean-luc.blanc-qxv4g6HH51o@public.gmane.org,
	ashley-fm2HMyfA2y6tG0bUXCXiUA@public.gmane.org,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	christophe-h.ricard-qxv4g6HH51o@public.gmane.org,
	benoit.houyere-qxv4g6HH51o@public.gmane.org
Subject: Re: [PATCH v2 01/12] tpm: tpm_tis: Share common data between phys
Date: Wed, 13 Apr 2016 14:34:11 -0600	[thread overview]
Message-ID: <20160413203411.GA3836@obsidianresearch.com> (raw)
In-Reply-To: <1460577351-24632-2-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>

On Wed, Apr 13, 2016 at 09:55:40PM +0200, Christophe Ricard wrote:
> As preliminary, split priv_data structure in common and phy specific
> structures.
> iobase field is specific to lpc bus.
> 
> Signed-off-by: Christophe Ricard <christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
>  drivers/char/tpm/tpm_tis.c      | 30 +++++++++++++++++++++++-------
>  drivers/char/tpm/tpm_tis_core.h | 38 ++++++++++++++++++++++++++++++++++++++
>  2 files changed, 61 insertions(+), 7 deletions(-)
>  create mode 100644 drivers/char/tpm/tpm_tis_core.h
> 
> diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
> index 1e45e73..cc64edb 100644
> +++ b/drivers/char/tpm/tpm_tis.c
> @@ -93,14 +93,8 @@ struct tpm_info {
>  #define	TPM_DID_VID(l)			(0x0F00 | ((l) << 12))
>  #define	TPM_RID(l)			(0x0F04 | ((l) << 12))
>  
> -struct priv_data {
> +struct tpm_tis_phy {
>  	void __iomem *iobase;

The common idiom for this sort of structure is to go like this:

struct tpm_tis_lpc_phy {
        struct tpm_tis_priv priv;
 	void __iomem *iobase;
}

And drop phy_id from the 'priv'.

Instead have the actual phy driver allocate the combined structure and
set it to drvdata. When the common code accesses it, you get a
tpm_tis_priv, and the tpm_tis_priv can be container_of casted to
tpm_tis_lpc_phy/etc for phy code.

>  #if defined(CONFIG_PNP) && defined(CONFIG_ACPI)
> @@ -133,6 +127,7 @@ static inline int is_itpm(struct acpi_device *dev)
>  static int wait_startup(struct tpm_chip *chip, int l)
>  {
>  	struct priv_data *priv = dev_get_drvdata(&chip->dev);
> +	struct tpm_tis_phy *phy = priv->phy_id;
>  	unsigned long stop = jiffies + chip->timeout_a;
>  	do {
>  		if (ioread8(priv->iobase + TPM_ACCESS(l)) &

Something went wrong here, does this patch compile? Should be

  		if (ioread8(phy->iobase + TPM_ACCESS(l)) &

Please do compile test all your patches.

Otherwise this seems like the right idea

Jason

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z

  parent reply	other threads:[~2016-04-13 20:34 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13 19:55 [PATCH v2 00/12] Rework of tpm_tis to share common logic accross phy's (lpc/spi/-i2c-) Christophe Ricard
     [not found] ` <1460577351-24632-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2016-04-13 19:55   ` [PATCH v2 01/12] tpm: tpm_tis: Share common data between phys Christophe Ricard
     [not found]     ` <1460577351-24632-2-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2016-04-13 20:34       ` Jason Gunthorpe [this message]
2016-04-13 19:55   ` [PATCH v2 02/12] tpm: tpm_tis: Rename priv_data structure tpm_tis_data Christophe Ricard
2016-04-13 19:55   ` [PATCH v2 03/12] tpm_tis: Introduce intermediate layer for TPM access Christophe Ricard
2016-04-13 19:55   ` [PATCH v2 04/12] tpm_tis: Extend low-level interface to support proper return codes Christophe Ricard
     [not found]     ` <1460577351-24632-5-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2016-04-19 13:18       ` Jarkko Sakkinen
     [not found]         ` <20160419131831.GD4796-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-04-19 13:19           ` Jarkko Sakkinen
2016-04-13 19:55   ` [PATCH v2 05/12] tpm: Use read/write_bytes for drivers without more specialized methods Christophe Ricard
     [not found]     ` <1460577351-24632-6-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2016-04-13 20:42       ` Jason Gunthorpe
     [not found]         ` <20160413204230.GB3836-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-04-14 21:46           ` Christophe Ricard
     [not found]             ` <57100FB9.5050908-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-04-14 21:50               ` Jason Gunthorpe
     [not found]                 ` <20160414215011.GC14137-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-04-14 21:51                   ` Christophe Ricard
2016-04-13 19:55   ` [PATCH v2 06/12] tpm: Manage itpm workaround with tis specific data_expect bit Christophe Ricard
     [not found]     ` <1460577351-24632-7-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2016-04-13 20:44       ` Jason Gunthorpe
2016-04-13 19:55   ` [PATCH v2 07/12] tpm: tpm_tis: Add post_probe phy handler Christophe Ricard
2016-04-13 19:55   ` [PATCH v2 08/12] tpm: Add include guards in tpm.h Christophe Ricard
2016-04-13 19:55   ` [PATCH v2 09/12] devicetree: Add infineon to vendor-prefix.txt Christophe Ricard
2016-04-13 19:55   ` [PATCH v2 10/12] devicetree: Add Trusted Computing Group " Christophe Ricard
2016-04-13 19:55   ` [PATCH v2 11/12] tpm/tpm_tis: Split tpm_tis driver into a core and TCG TIS compliant phy Christophe Ricard
     [not found]     ` <1460577351-24632-12-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2016-04-13 20:48       ` Jason Gunthorpe
     [not found]         ` <20160413204842.GD3836-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-04-13 20:55           ` Christophe Ricard
     [not found]             ` <570EB23D.8000904-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-04-13 21:09               ` Jason Gunthorpe
2016-04-13 19:55   ` [PATCH v2 12/12] tpm/tpm_tis_spi: Add support for spi phy Christophe Ricard
     [not found]     ` <1460577351-24632-13-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2016-04-14 16:39       ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160413203411.GA3836@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=ashley-fm2HMyfA2y6tG0bUXCXiUA@public.gmane.org \
    --cc=benoit.houyere-qxv4g6HH51o@public.gmane.org \
    --cc=christophe-h.ricard-qxv4g6HH51o@public.gmane.org \
    --cc=christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=jean-luc.blanc-qxv4g6HH51o@public.gmane.org \
    --cc=tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.