[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160715033201.GA27104@apronin>
Date: Thu, 14 Jul 2016 20:32:01 -0700
From: Andrey Pronin <apronin@...omium.org>
To: Jason Gunthorpe <jgunthorpe@...idianresearch.com>
Cc: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
Peter Huewe <peterhuewe@....de>,
Marcel Selhorst <tpmdd@...horst.net>,
tpmdd-devel@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
groeck@...omium.org, smbarber@...omium.org, dianders@...omium.org
Subject: Re: [PATCH 1/2] tpm: add sysfs attributes for tpm2
On Thu, Jul 14, 2016 at 09:21:45PM -0600, Jason Gunthorpe wrote:
> On Thu, Jul 14, 2016 at 06:51:35PM -0700, Andrey Pronin wrote:
> > - sysfs_remove_link(&chip->dev.parent->kobj, "ppi");
> > -
> > - for (i = chip->groups[0]->attrs; *i != NULL; ++i)
> > - sysfs_remove_link(&chip->dev.parent->kobj, (*i)->name);
> > + for (ngrp = 0; ngrp < chip->groups_cnt; ++ngrp) {
> > + if (chip->groups[ngrp]->name) {
> > + sysfs_remove_link(&chip->dev.parent->kobj,
> > + chip->groups[ngrp]->name);
> > + } else {
> > + for (i = chip->groups[ngrp]->attrs; *i != NULL; ++i)
> > + sysfs_remove_link(&chip->dev.parent->kobj,
> > + (*i)->name);
> > + }
> > + }
>
> NAK
>
> No new compat symlinks. Only the existing set of links are permitted.
>
> Any new sysfs entries must use only the new location.
>
> > +static struct attribute *tpm2_dev_attrs[] = {
> > NULL,
> > };
>
> > +static const struct attribute_group tpm2_dev_group = {
> > + .attrs = tpm2_dev_attrs,
> > +};
>
> Don't add dead code, add this and related in the patch that requires it.
>
> > void tpm_sysfs_add_device(struct tpm_chip *chip)
> > {
> > /* The sysfs routines rely on an implicit tpm_try_get_ops, device_del
> > @@ -290,4 +306,8 @@ void tpm_sysfs_add_device(struct tpm_chip *chip)
> > */
> > WARN_ON(chip->groups_cnt != 0);
> > chip->groups[chip->groups_cnt++] = &tpm_dev_group;
> > + if (chip->flags & TPM_CHIP_FLAG_TPM2)
> > + chip->groups[chip->groups_cnt++] = &tpm2_dev_group;
> > + else
> > + chip->groups[chip->groups_cnt++] = &tpm1_dev_group;
>
> .. and this can't really happen either..
>
> To make things simple you can just have tpm2 not ever create any links
> for any files by never using groups[0]. There is no need to try and
> create a shared 'tpm_dev_group'.
>
> Jason
Hi Jason,
Mostly understood. One question.
tpm2 shares some of the attributes with tpm1 (e.g. timeouts). Do I still
just add those separately for tpm2 to groups[1] and keep groups[0] empty?
Andrey
Powered by blists - more mailing lists