All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: Peter Huewe <peterhuewe@gmx.de>,
	Ashley Lai <ashley@ashleylai.com>,
	Marcel Selhorst <tpmdd@selhorst.net>,
	tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org,
	christophe.ricard@gmail.com,
	jason.gunthorpe@obsidianresearch.com, stefanb@linux.vnet.ibm.com
Subject: Re: [PATCH] tpm: unified PPI interface for TPM 1.x/2.0 devices
Date: Wed, 1 Apr 2015 12:19:25 -0600	[thread overview]
Message-ID: <20150401181925.GA20550@obsidianresearch.com> (raw)
In-Reply-To: <1427891332-16709-1-git-send-email-jarkko.sakkinen@linux.intel.com>

On Wed, Apr 01, 2015 at 03:28:52PM +0300, Jarkko Sakkinen wrote:
> Added PPI interface to the character device. PPI interface is also kept
> in the pdev for backwards compatibility.

Could you look at just completely moving the PPI interface to the char
dev and then adding a symlink from the pdev? That would be really
ideal.

symlinks have the advantage that they actually fully fix the lifetime
issues.

This seems doable, if we replace the ppi_attrs group with a bunch of
calls to sysfs_create_link it should work ?

> +static struct tpm_chip *ppi_dev_to_chip(struct device *dev)
> +{
> +	struct tpm_chip *chip = dev_get_drvdata(dev);
> +
> +	if (chip == NULL)
> +		chip = to_tpm_chip(chip);
> +
> +	return chip;
> +}

If symlinks don't work out, we should probably just set the drvdata on
the tpm_chip itself to avoid this.

> +	if (!(chip->flags & TPM_CHIP_FLAG_PPI))
> +		return -EINVAL;

Hum, I don't think the PPI files should be created if there is no PPI
support..

> +void __init tpm_ppi_init(struct class *tpm_class)
> +{
> +	tpm_class->dev_groups = tpm_groups;
>  }

So this shouldn't be unconditional.

Also, ultimately PPI can't just claim the dev_groups, other parts of
the driver will need to add groups too.

I think it makes more sense to do

struct attribute_group *tpm_ppi_get_sysfs(struct tpm_chip *chip)
{
}

And take care of building the list in the caller.

And tpm_ppi_get_sysfs should be called after the driver is readied but
before adding the device.

Jason

  reply	other threads:[~2015-04-01 18:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-01 12:28 [PATCH] tpm: unified PPI interface for TPM 1.x/2.0 devices Jarkko Sakkinen
2015-04-01 18:19 ` Jason Gunthorpe [this message]
2015-04-08  7:26   ` Jarkko Sakkinen
2015-04-08  9:32     ` [tpmdd-devel] " Jarkko Sakkinen
2015-04-08 16:28     ` Jason Gunthorpe
2015-04-09  6:02       ` Jarkko Sakkinen

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=20150401181925.GA20550@obsidianresearch.com \
    --to=jgunthorpe@obsidianresearch.com \
    --cc=ashley@ashleylai.com \
    --cc=christophe.ricard@gmail.com \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jason.gunthorpe@obsidianresearch.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=tpmdd-devel@lists.sourceforge.net \
    --cc=tpmdd@selhorst.net \
    /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.