lkml.org 
[lkml]   [2016]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] tpm: add sysfs attributes for tpm2
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

\
 
 \ /
  Last update: 2016-07-15 06:01    [W:0.098 / U:2.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site