public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/13] TPM cleanup
@ 2013-09-23 18:14 Jason Gunthorpe
  2013-09-23 18:14 ` [PATCH 01/13] tpm: ibmvtpm: Use %zd formatting for size_t format arguments Jason Gunthorpe
                   ` (13 more replies)
  0 siblings, 14 replies; 54+ messages in thread
From: Jason Gunthorpe @ 2013-09-23 18:14 UTC (permalink / raw)
  To: tpmdd-devel
  Cc: linux-kernel, Ashley Lai, Rajiv Andrade,
	Leonidas Da Silva Barbosa, Marcel Selhorst, Sirrix AG,
	Peter Huewe

While writing two new TPM drivers I noticed that there was a big and growing
mess in drivers/char/tpm. This series of patches is the first batch of patches
containing my attempt to fix it.

This series makes several small repetitive changes to all the drivers. These
are bundled in with the commits changing the core, because the core API is
changed and everything must be kept together to retain bisect-ability.

I have decided not to tackle the lifetime issues in this series. My
first attempt was flawed.

I have presented the series in the full linear format. It is available on
my github:
  https://github.com/jgunthorpe/linux/commits/tpm-devel
The branch is not stable, I will rebase and rewrite history as needed.

All patches have been compile tested on x86-64 (including vtpm, I have a hack
to make that happen) and all patches are checkpatch.pl clean.

I have tested tpm_tis (PPC32), tpm_i2c_atmel and tpm_i2c_nuvoton (ARM32) on my
hardware here.

There is very little new code here, the majority of lines is just code motion
to remove duplication.

Patches 1 -> 6, 12
 - These are just simple cleanups that I discovered while doing the other
   work.

Patch 7
 - This is important to unify the sysfs code. I've choosen to simplify
   and not make the TPM version bus-dependent.

Patch 8-9
 - The drivers have this duplication of the file_operations
   and sysfs code. This series pulls all of that code out of the drivers
   and into the core

Patches 10->11
 - This is the first step in making the TPM subsystem be like other
   subsystems in the kernel.

Patches 13
 - This cleans up the struct tpm_chip by hiding stuff that isn't
   public

This is already a fair clean up, but there is still more to do someday:
 * The lifetime issues around struct tpm_chip/etc and the way userspace
   can hold /dev/tpmX open even after the driver has detached.
 * struct tpm_chip and struct tpm_vendor_specific need to be merged
 * The above two structs have many members that are never used by the
   core code. These members need to be migrated into driver
   private structures
 * The resulting merged struct should live in linux/include/tpm.h
   like all other device classes in the kernel.
 * Several drivers need clean up to move singleton static
   variables into dynamic structures
 * Consolidate TCG defined constants that are duplicated in many
   drivers
 * Consolidate device startup (tpm_startup, tpm_get_timeoutes)
   into core code

If this series is successful I may be able to do some of the above as well.

Jason Gunthorpe (13):
  tpm: ibmvtpm: Use %zd formatting for size_t format arguments
  tpm atmel: Call request_region with the correct base
  tpm: xen-tpmfront: Fix default durations
  tpm: Store devname in the tpm_chip
  tpm: Use container_of to locate the tpm_chip in tpm_open
  tpm: Remove redundant dev_set_drvdata
  tpm: Remove tpm_show_caps_1_2
  tpm: Pull everything related to /dev/tpmX into tpm-dev.c
  tpm: Pull everything related to sysfs into tpm-sysfs.c
  tpm: Create a tpm_class_ops structure and use it in the drivers
  tpm: Use the ops structure instead of a copy in tpm_vendor_specific
  tpm: st33: Remove chip->data_buffer access from this driver
  tpm: Make tpm-dev allocate a per-file structure

 drivers/char/tpm/Makefile           |   2 +-
 drivers/char/tpm/tpm-dev.c          | 213 +++++++++++++++
 drivers/char/tpm/tpm-sysfs.c        | 318 ++++++++++++++++++++++
 drivers/char/tpm/tpm.c              | 524 +++---------------------------------
 drivers/char/tpm/tpm.h              |  86 +++---
 drivers/char/tpm/tpm_atmel.c        |  30 +--
 drivers/char/tpm/tpm_i2c_atmel.c    |  42 +--
 drivers/char/tpm/tpm_i2c_infineon.c |  44 +--
 drivers/char/tpm/tpm_i2c_nuvoton.c  |  42 +--
 drivers/char/tpm/tpm_i2c_stm_st33.c |  51 +---
 drivers/char/tpm/tpm_ibmvtpm.c      |  44 +--
 drivers/char/tpm/tpm_infineon.c     |  28 +-
 drivers/char/tpm/tpm_nsc.c          |  28 +-
 drivers/char/tpm/tpm_spi_stm_st33.c |  50 +---
 drivers/char/tpm/tpm_tis.c          |  43 +--
 drivers/char/tpm/xen-tpmfront.c     |  57 +---
 include/linux/tpm.h                 |  15 ++
 17 files changed, 638 insertions(+), 979 deletions(-)
 create mode 100644 drivers/char/tpm/tpm-dev.c
 create mode 100644 drivers/char/tpm/tpm-sysfs.c

-- 
1.8.1.2


^ permalink raw reply	[flat|nested] 54+ messages in thread

end of thread, other threads:[~2013-10-10 16:50 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-23 18:14 [PATCH 00/13] TPM cleanup Jason Gunthorpe
2013-09-23 18:14 ` [PATCH 01/13] tpm: ibmvtpm: Use %zd formatting for size_t format arguments Jason Gunthorpe
2013-10-01 21:58   ` Peter Hüwe
2013-10-02 19:37   ` [tpmdd-devel] " Ashley D Lai
2013-09-23 18:14 ` [PATCH 02/13] tpm atmel: Call request_region with the correct base Jason Gunthorpe
     [not found]   ` <201310020000.13490.PeterHuewe@gmx.de>
2013-10-03  0:11     ` [tpmdd-devel] " Ashley D Lai
2013-10-03  4:36       ` Jason Gunthorpe
2013-10-04 17:21         ` Joel Schopp
2013-09-23 18:14 ` [PATCH 03/13] tpm: xen-tpmfront: Fix default durations Jason Gunthorpe
2013-09-23 18:51   ` Konrad Rzeszutek Wilk
2013-09-23 18:57     ` Daniel De Graaf
2013-09-23 18:14 ` [PATCH 04/13] tpm: Store devname in the tpm_chip Jason Gunthorpe
2013-10-04 15:57   ` [tpmdd-devel] " Ashley Lai
2013-09-23 18:14 ` [PATCH 05/13] tpm: Use container_of to locate the tpm_chip in tpm_open Jason Gunthorpe
2013-10-05  1:47   ` [tpmdd-devel] " Ashley Lai
2013-09-23 18:14 ` [PATCH 06/13] tpm: Remove redundant dev_set_drvdata Jason Gunthorpe
2013-10-05  2:14   ` [tpmdd-devel] " Ashley Lai
2013-09-23 18:14 ` [PATCH 07/13] tpm: Remove tpm_show_caps_1_2 Jason Gunthorpe
     [not found]   ` <201310020009.22952.PeterHuewe@gmx.de>
2013-10-01 22:21     ` Jason Gunthorpe
2013-10-01 22:38       ` [tpmdd-devel] " Peter Hüwe
2013-09-23 18:14 ` [PATCH 08/13] tpm: Pull everything related to /dev/tpmX into tpm-dev.c Jason Gunthorpe
2013-10-01 22:52   ` Peter Hüwe
2013-10-01 22:57     ` Jason Gunthorpe
2013-10-01 23:14       ` Peter Hüwe
2013-10-01 23:23         ` Jason Gunthorpe
2013-10-03  5:05         ` Jason Gunthorpe
2013-10-04 15:50           ` TPM.ko module rename (was tpm: Pull everything related to /dev/tpmX into tpm-dev.c) Peter Hüwe
2013-10-04 16:28             ` Jason Gunthorpe
2013-10-04 16:45               ` Ashley Lai
2013-09-23 18:14 ` [PATCH 09/13] tpm: Pull everything related to sysfs into tpm-sysfs.c Jason Gunthorpe
2013-09-23 18:54   ` [tpmdd-devel] " Daniel De Graaf
2013-09-23 19:36     ` Jason Gunthorpe
2013-09-23 20:20       ` Daniel De Graaf
2013-09-23 20:42         ` Jason Gunthorpe
2013-09-23 22:00           ` Daniel De Graaf
2013-09-23 22:23             ` Jason Gunthorpe
2013-09-24 14:28               ` Daniel De Graaf
2013-09-30 18:10                 ` Jason Gunthorpe
2013-09-30 20:36                   ` Daniel De Graaf
2013-09-30 21:20                     ` Jason Gunthorpe
2013-09-30 22:09                     ` Joel Schopp
2013-10-04 17:08                       ` Jason Gunthorpe
2013-10-04 19:17                         ` Stefan Berger
2013-10-04 22:02                           ` Peter Hüwe
2013-10-07 15:06                           ` Daniel De Graaf
2013-10-08  9:15                         ` AW: [TrouSerS-tech] " Fuchs, Andreas
2013-10-09 17:38                           ` Jason Gunthorpe
2013-10-10  7:42                             ` AW: " Fuchs, Andreas
2013-10-10 16:50                               ` Jason Gunthorpe
2013-09-23 18:14 ` [PATCH 10/13] tpm: Create a tpm_class_ops structure and use it in the drivers Jason Gunthorpe
2013-09-23 18:14 ` [PATCH 11/13] tpm: Use the ops structure instead of a copy in tpm_vendor_specific Jason Gunthorpe
2013-09-23 18:14 ` [PATCH 12/13] tpm: st33: Remove chip->data_buffer access from this driver Jason Gunthorpe
2013-09-23 18:14 ` [PATCH 13/13] tpm: Make tpm-dev allocate a per-file structure Jason Gunthorpe
2013-09-23 21:27 ` [tpmdd-devel] [PATCH 00/13] TPM cleanup Joel Schopp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox