* [PATCH 02/15] tpm: ibmvtpm: Use %zd formatting for size_t format arguments
2013-10-22 17:53 [PATCH 01/15] tpm: MAINTAINERS: Add myself as tpm maintainer Peter Huewe
@ 2013-10-22 17:53 ` Peter Huewe
2013-10-22 17:53 ` [PATCH 03/15] tpm atmel: Call request_region with the correct base Peter Huewe
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Peter Huewe @ 2013-10-22 17:53 UTC (permalink / raw)
To: james.l.morris, tpmdd-devel, adlai
Cc: linux-kernel, Jason Gunthorpe, Peter Huewe
From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
This suppresses compile warnings on 32 bit builds.
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
Reviewed-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Acked-by: Ashley Lai <adlai@linux.vnet.ibm.com>
---
drivers/char/tpm/tpm_ibmvtpm.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
index 56b07c3..838f043 100644
--- a/drivers/char/tpm/tpm_ibmvtpm.c
+++ b/drivers/char/tpm/tpm_ibmvtpm.c
@@ -98,7 +98,7 @@ static int tpm_ibmvtpm_recv(struct tpm_chip *chip, u8 *buf, size_t count)
if (count < len) {
dev_err(ibmvtpm->dev,
- "Invalid size in recv: count=%ld, crq_size=%d\n",
+ "Invalid size in recv: count=%zd, crq_size=%d\n",
count, len);
return -EIO;
}
@@ -136,7 +136,7 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count)
if (count > ibmvtpm->rtce_size) {
dev_err(ibmvtpm->dev,
- "Invalid size in send: count=%ld, rtce_size=%d\n",
+ "Invalid size in send: count=%zd, rtce_size=%d\n",
count, ibmvtpm->rtce_size);
return -EIO;
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 03/15] tpm atmel: Call request_region with the correct base
2013-10-22 17:53 [PATCH 01/15] tpm: MAINTAINERS: Add myself as tpm maintainer Peter Huewe
2013-10-22 17:53 ` [PATCH 02/15] tpm: ibmvtpm: Use %zd formatting for size_t format arguments Peter Huewe
@ 2013-10-22 17:53 ` Peter Huewe
2013-10-22 17:53 ` [PATCH 04/15] tpm: Store devname in the tpm_chip Peter Huewe
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Peter Huewe @ 2013-10-22 17:53 UTC (permalink / raw)
To: james.l.morris, tpmdd-devel, adlai
Cc: linux-kernel, Jason Gunthorpe, Peter Huewe
From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Commit e0dd03caf20d040a0a86 ("tpm: return chip from
tpm_register_hardware") changed the code path here so that
ateml_get_base_addr no longer directly altered the tpm_vendor_specific
structure, and instead placed the base address on the stack.
The commit missed updating the request_region call, which would have
resulted in request_region being called with 0 as the base address.
I don't know if request_region(0, ..) will fail, if so the
driver has been broken since 2006 and we should remove it
from the tree as it has no users.
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
Reviewed-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
drivers/char/tpm/tpm_atmel.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c
index 99d6820..c9a528d 100644
--- a/drivers/char/tpm/tpm_atmel.c
+++ b/drivers/char/tpm/tpm_atmel.c
@@ -202,7 +202,7 @@ static int __init init_atmel(void)
have_region =
(atmel_request_region
- (tpm_atmel.base, region_size, "tpm_atmel0") == NULL) ? 0 : 1;
+ (base, region_size, "tpm_atmel0") == NULL) ? 0 : 1;
pdev = platform_device_register_simple("tpm_atmel", -1, NULL, 0);
if (IS_ERR(pdev)) {
--
1.7.5.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 04/15] tpm: Store devname in the tpm_chip
2013-10-22 17:53 [PATCH 01/15] tpm: MAINTAINERS: Add myself as tpm maintainer Peter Huewe
2013-10-22 17:53 ` [PATCH 02/15] tpm: ibmvtpm: Use %zd formatting for size_t format arguments Peter Huewe
2013-10-22 17:53 ` [PATCH 03/15] tpm atmel: Call request_region with the correct base Peter Huewe
@ 2013-10-22 17:53 ` Peter Huewe
2013-10-22 17:53 ` [PATCH 05/15] tpm: Use container_of to locate the tpm_chip in tpm_open Peter Huewe
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Peter Huewe @ 2013-10-22 17:53 UTC (permalink / raw)
To: james.l.morris, tpmdd-devel, adlai
Cc: linux-kernel, Jason Gunthorpe, Peter Huewe
From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Just put the memory directly in the chip structure, rather than
in a 2nd dedicated kmalloc.
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
Reviewed-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Acked-by: Ashley Lai <adlai@linux.vnet.ibm.com>
---
drivers/char/tpm/tpm.c | 17 ++++++-----------
drivers/char/tpm/tpm.h | 1 +
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index e3c974a..71eb8c7 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -1463,7 +1463,6 @@ void tpm_dev_vendor_release(struct tpm_chip *chip)
chip->vendor.release(chip->dev);
clear_bit(chip->dev_num, dev_mask);
- kfree(chip->vendor.miscdev.name);
}
EXPORT_SYMBOL_GPL(tpm_dev_vendor_release);
@@ -1496,17 +1495,13 @@ EXPORT_SYMBOL_GPL(tpm_dev_release);
struct tpm_chip *tpm_register_hardware(struct device *dev,
const struct tpm_vendor_specific *entry)
{
-#define DEVNAME_SIZE 7
-
- char *devname;
struct tpm_chip *chip;
/* Driver specific per-device data */
chip = kzalloc(sizeof(*chip), GFP_KERNEL);
- devname = kmalloc(DEVNAME_SIZE, GFP_KERNEL);
- if (chip == NULL || devname == NULL)
- goto out_free;
+ if (chip == NULL)
+ return NULL;
mutex_init(&chip->buffer_mutex);
mutex_init(&chip->tpm_mutex);
@@ -1531,8 +1526,9 @@ struct tpm_chip *tpm_register_hardware(struct device *dev,
set_bit(chip->dev_num, dev_mask);
- scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num);
- chip->vendor.miscdev.name = devname;
+ scnprintf(chip->devname, sizeof(chip->devname), "%s%d", "tpm",
+ chip->dev_num);
+ chip->vendor.miscdev.name = chip->devname;
chip->vendor.miscdev.parent = dev;
chip->dev = get_device(dev);
@@ -1558,7 +1554,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev,
goto put_device;
}
- chip->bios_dir = tpm_bios_log_setup(devname);
+ chip->bios_dir = tpm_bios_log_setup(chip->devname);
/* Make chip available */
spin_lock(&driver_lock);
@@ -1571,7 +1567,6 @@ put_device:
put_device(chip->dev);
out_free:
kfree(chip);
- kfree(devname);
return NULL;
}
EXPORT_SYMBOL_GPL(tpm_register_hardware);
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index a7bfc17..0df18b5 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -122,6 +122,7 @@ struct tpm_chip {
struct device *dev; /* Device stuff */
int dev_num; /* /dev/tpm# */
+ char devname[7];
unsigned long is_open; /* only one allowed */
int time_expired;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 05/15] tpm: Use container_of to locate the tpm_chip in tpm_open
2013-10-22 17:53 [PATCH 01/15] tpm: MAINTAINERS: Add myself as tpm maintainer Peter Huewe
` (2 preceding siblings ...)
2013-10-22 17:53 ` [PATCH 04/15] tpm: Store devname in the tpm_chip Peter Huewe
@ 2013-10-22 17:53 ` Peter Huewe
2013-10-22 17:55 ` [tpmdd-devel] [PATCH 01/15] tpm: MAINTAINERS: Add myself as tpm maintainer Luigi Semenzato
2013-10-22 19:22 ` Ashley D Lai
5 siblings, 0 replies; 8+ messages in thread
From: Peter Huewe @ 2013-10-22 17:53 UTC (permalink / raw)
To: james.l.morris, tpmdd-devel, adlai
Cc: linux-kernel, Jason Gunthorpe, Peter Huewe
From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
misc_open sets the file->private_date to the misc_dev when calling
open. We can use container_of to go from the misc_dev back to the
tpm_chip.
Future clean ups will move tpm_open into a new file and this change
means we do not have to export the tpm_chip list.
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
Reviewed-by: Peter Huewe <peterhuewe@gmx.de>
Acked-by: Ashley Lai <adlai@linux.vnet.ibm.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
drivers/char/tpm/tpm.c | 21 ++++-----------------
1 files changed, 4 insertions(+), 17 deletions(-)
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 71eb8c7..c3ab508 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -1170,38 +1170,25 @@ EXPORT_SYMBOL_GPL(wait_for_tpm_stat);
*/
int tpm_open(struct inode *inode, struct file *file)
{
- int minor = iminor(inode);
- struct tpm_chip *chip = NULL, *pos;
-
- rcu_read_lock();
- list_for_each_entry_rcu(pos, &tpm_chip_list, list) {
- if (pos->vendor.miscdev.minor == minor) {
- chip = pos;
- get_device(chip->dev);
- break;
- }
- }
- rcu_read_unlock();
-
- if (!chip)
- return -ENODEV;
+ struct miscdevice *misc = file->private_data;
+ struct tpm_chip *chip = container_of(misc, struct tpm_chip,
+ vendor.miscdev);
if (test_and_set_bit(0, &chip->is_open)) {
dev_dbg(chip->dev, "Another process owns this TPM\n");
- put_device(chip->dev);
return -EBUSY;
}
chip->data_buffer = kzalloc(TPM_BUFSIZE, GFP_KERNEL);
if (chip->data_buffer == NULL) {
clear_bit(0, &chip->is_open);
- put_device(chip->dev);
return -ENOMEM;
}
atomic_set(&chip->data_pending, 0);
file->private_data = chip;
+ get_device(chip->dev);
return 0;
}
EXPORT_SYMBOL_GPL(tpm_open);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [tpmdd-devel] [PATCH 01/15] tpm: MAINTAINERS: Add myself as tpm maintainer
2013-10-22 17:53 [PATCH 01/15] tpm: MAINTAINERS: Add myself as tpm maintainer Peter Huewe
` (3 preceding siblings ...)
2013-10-22 17:53 ` [PATCH 05/15] tpm: Use container_of to locate the tpm_chip in tpm_open Peter Huewe
@ 2013-10-22 17:55 ` Luigi Semenzato
2013-10-22 19:22 ` Ashley D Lai
5 siblings, 0 replies; 8+ messages in thread
From: Luigi Semenzato @ 2013-10-22 17:55 UTC (permalink / raw)
To: Peter Huewe; +Cc: james.l.morris, tpmdd-devel, adlai, linux-kernel
I completely support Peter's request, and many thanks to Peter for volunteering.
On Tue, Oct 22, 2013 at 10:53 AM, Peter Huewe <peterhuewe@gmx.de> wrote:
> Since I'm actively maintaining the tpm subsystem for a few months now,
> it's time to step up and be an official maintainer for the tpm subsystem,
> atleast until I hear something different from my company.
>
> The maintaining is done solely in my private time, out of private interest.
> Speaking only on behalf of myself, trying to be as vendor neutral as possible.
>
> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
> ---
> MAINTAINERS | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 4fde706..936adb4 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -8475,6 +8475,7 @@ F: drivers/media/usb/tm6000/
> TPM DEVICE DRIVER
> M: Leonidas Da Silva Barbosa <leosilva@linux.vnet.ibm.com>
> M: Ashley Lai <ashley@ashleylai.com>
> +M: Peter Huewe <peterhuewe@gmx.de>
> M: Rajiv Andrade <mail@srajiv.net>
> W: http://tpmdd.sourceforge.net
> M: Marcel Selhorst <tpmdd@selhorst.net>
> --
> 1.7.5.4
>
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
> _______________________________________________
> tpmdd-devel mailing list
> tpmdd-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tpmdd-devel
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 01/15] tpm: MAINTAINERS: Add myself as tpm maintainer
2013-10-22 17:53 [PATCH 01/15] tpm: MAINTAINERS: Add myself as tpm maintainer Peter Huewe
` (4 preceding siblings ...)
2013-10-22 17:55 ` [tpmdd-devel] [PATCH 01/15] tpm: MAINTAINERS: Add myself as tpm maintainer Luigi Semenzato
@ 2013-10-22 19:22 ` Ashley D Lai
2013-10-22 19:29 ` Joe Perches
5 siblings, 1 reply; 8+ messages in thread
From: Ashley D Lai @ 2013-10-22 19:22 UTC (permalink / raw)
To: Peter Huewe; +Cc: james.l.morris, tpmdd-devel, linux-kernel
On Tue, 2013-10-22 at 19:53 +0200, Peter Huewe wrote:
> Since I'm actively maintaining the tpm subsystem for a few months now,
> it's time to step up and be an official maintainer for the tpm subsystem,
> atleast until I hear something different from my company.
>
> The maintaining is done solely in my private time, out of private interest.
> Speaking only on behalf of myself, trying to be as vendor neutral as possible.
>
> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
> ---
> MAINTAINERS | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 4fde706..936adb4 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -8475,6 +8475,7 @@ F: drivers/media/usb/tm6000/
> TPM DEVICE DRIVER
> M: Leonidas Da Silva Barbosa <leosilva@linux.vnet.ibm.com>
> M: Ashley Lai <ashley@ashleylai.com>
> +M: Peter Huewe <peterhuewe@gmx.de>
> M: Rajiv Andrade <mail@srajiv.net>
> W: http://tpmdd.sourceforge.net
> M: Marcel Selhorst <tpmdd@selhorst.net>
Peter has been a great help on maintaining the tpm driver. Thanks for
volunteering, you have my support on this.
--Ashley Lai
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 01/15] tpm: MAINTAINERS: Add myself as tpm maintainer
2013-10-22 19:22 ` Ashley D Lai
@ 2013-10-22 19:29 ` Joe Perches
0 siblings, 0 replies; 8+ messages in thread
From: Joe Perches @ 2013-10-22 19:29 UTC (permalink / raw)
To: Ashley D Lai; +Cc: Peter Huewe, james.l.morris, tpmdd-devel, linux-kernel
On Tue, 2013-10-22 at 14:22 -0500, Ashley D Lai wrote:
> On Tue, 2013-10-22 at 19:53 +0200, Peter Huewe wrote:
> > Since I'm actively maintaining the tpm subsystem for a few months now,
> > it's time to step up and be an official maintainer for the tpm subsystem,
> > atleast until I hear something different from my company.
> >
> > The maintaining is done solely in my private time, out of private interest.
> > Speaking only on behalf of myself, trying to be as vendor neutral as possible.
> >
> > Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
> > ---
> > MAINTAINERS | 1 +
> > 1 files changed, 1 insertions(+), 0 deletions(-)
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 4fde706..936adb4 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -8475,6 +8475,7 @@ F: drivers/media/usb/tm6000/
> > TPM DEVICE DRIVER
> > M: Leonidas Da Silva Barbosa <leosilva@linux.vnet.ibm.com>
> > M: Ashley Lai <ashley@ashleylai.com>
> > +M: Peter Huewe <peterhuewe@gmx.de>
> > M: Rajiv Andrade <mail@srajiv.net>
> > W: http://tpmdd.sourceforge.net
> > M: Marcel Selhorst <tpmdd@selhorst.net>
>
> Peter has been a great help on maintaining the tpm driver. Thanks for
> volunteering, you have my support on this.
It'd be nice if all the M entries were clustered
together and probably nice too if the
W: http://www.sirrix.com
entry removed. I didn't notice anything useful
there about the driver.
Maybe there's a specific page about the driver
buried on the corporate website. If so, that
specific page should be linked instead.
^ permalink raw reply [flat|nested] 8+ messages in thread