* [PATCH] tpm/tpm_tis: Add missing ifdef CONFIG_ACPI for pnp_acpi_device
@ 2015-01-21 20:40 Peter Huewe
2015-01-21 21:23 ` Stephen Rothwell
0 siblings, 1 reply; 7+ messages in thread
From: Peter Huewe @ 2015-01-21 20:40 UTC (permalink / raw)
To: Stephen Rothwell
Cc: linux-next, tpmdd-devel, Jarkko Sakkinen, Jim Davis, Peter Huewe
This fixes a build failure if CONFIG_PNP is set but CONFIG_ACPI is not:
drivers/char/tpm/tpm_tis.c: In function ‘tpm_tis_pnp_init’:
drivers/char/tpm/tpm_tis.c:912:45: error: invalid type argument of
‘->’ (have ‘int’)
acpi_dev_handle = pnp_acpi_device(pnp_dev)->handle;
If CONFIG_PNPACPI is not set pnp_acpi_device is defined as 0 and thus
accesing the handle is not possible.
Fixes: 0dc553652102 ("tpm: fix raciness of PPI interface lookup")
Reported-by: Jim Davis <jim.epost@gmail.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
drivers/char/tpm/tpm_tis.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 20a61bc98db8..6725bef7cb96 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -908,8 +908,10 @@ static int tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
if (is_itpm(pnp_dev))
itpm = true;
+#ifdef CONFIG_ACPI
if (pnp_acpi_device(pnp_dev))
acpi_dev_handle = pnp_acpi_device(pnp_dev)->handle;
+#endif
return tpm_tis_init(&pnp_dev->dev, acpi_dev_handle, start, len, irq);
}
--
2.0.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] tpm/tpm_tis: Add missing ifdef CONFIG_ACPI for pnp_acpi_device
2015-01-21 20:40 [PATCH] tpm/tpm_tis: Add missing ifdef CONFIG_ACPI for pnp_acpi_device Peter Huewe
@ 2015-01-21 21:23 ` Stephen Rothwell
2015-01-21 21:34 ` Stephen Rothwell
0 siblings, 1 reply; 7+ messages in thread
From: Stephen Rothwell @ 2015-01-21 21:23 UTC (permalink / raw)
To: Peter Huewe; +Cc: linux-next, tpmdd-devel, Jarkko Sakkinen, Jim Davis
[-- Attachment #1: Type: text/plain, Size: 1679 bytes --]
Hi Peter,
On Wed, 21 Jan 2015 21:40:15 +0100 Peter Huewe <peterhuewe@gmx.de> wrote:
>
> This fixes a build failure if CONFIG_PNP is set but CONFIG_ACPI is not:
> drivers/char/tpm/tpm_tis.c: In function ‘tpm_tis_pnp_init’:
> drivers/char/tpm/tpm_tis.c:912:45: error: invalid type argument of
> ‘->’ (have ‘int’)
> acpi_dev_handle = pnp_acpi_device(pnp_dev)->handle;
>
> If CONFIG_PNPACPI is not set pnp_acpi_device is defined as 0 and thus
> accesing the handle is not possible.
>
> Fixes: 0dc553652102 ("tpm: fix raciness of PPI interface lookup")
> Reported-by: Jim Davis <jim.epost@gmail.com>
> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
> ---
> drivers/char/tpm/tpm_tis.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
> index 20a61bc98db8..6725bef7cb96 100644
> --- a/drivers/char/tpm/tpm_tis.c
> +++ b/drivers/char/tpm/tpm_tis.c
> @@ -908,8 +908,10 @@ static int tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
> if (is_itpm(pnp_dev))
> itpm = true;
>
> +#ifdef CONFIG_ACPI
> if (pnp_acpi_device(pnp_dev))
> acpi_dev_handle = pnp_acpi_device(pnp_dev)->handle;
> +#endif
>
> return tpm_tis_init(&pnp_dev->dev, acpi_dev_handle, start, len, irq);
> }
To save on the ifdef, why not
struct acpi_device *acpi;
.
.
acpi = pnp_acpi_device(dev);
if (acpi)
acpi_dev_handle = acpi->handle;
As an aside, the dummy pnp_acpi_device() should be returning NULL not
0, and could be a static inline function (as could several other things
in that header.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] tpm/tpm_tis: Add missing ifdef CONFIG_ACPI for pnp_acpi_device
2015-01-21 21:23 ` Stephen Rothwell
@ 2015-01-21 21:34 ` Stephen Rothwell
2015-01-21 22:40 ` Peter Hüwe
0 siblings, 1 reply; 7+ messages in thread
From: Stephen Rothwell @ 2015-01-21 21:34 UTC (permalink / raw)
To: Peter Huewe; +Cc: linux-next, tpmdd-devel, Jarkko Sakkinen, Jim Davis
[-- Attachment #1: Type: text/plain, Size: 448 bytes --]
Hi Peter,
On Thu, 22 Jan 2015 08:23:50 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> To save on the ifdef, why not
>
> struct acpi_device *acpi;
>
> .
> .
>
> acpi = pnp_acpi_device(dev);
> if (acpi)
> acpi_dev_handle = acpi->handle;
I guess struct acpi_device may not be visible when CONFIG_ACPI is not
set? That would be a pain :-(
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] tpm/tpm_tis: Add missing ifdef CONFIG_ACPI for pnp_acpi_device
2015-01-21 21:34 ` Stephen Rothwell
@ 2015-01-21 22:40 ` Peter Hüwe
2015-01-21 23:05 ` Stephen Rothwell
0 siblings, 1 reply; 7+ messages in thread
From: Peter Hüwe @ 2015-01-21 22:40 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linux-next, tpmdd-devel, Jarkko Sakkinen, Jim Davis
Am Mittwoch, 21. Januar 2015, 22:34:32 schrieb Stephen Rothwell:
> Hi Peter,
>
> On Thu, 22 Jan 2015 08:23:50 +1100 Stephen Rothwell <sfr@canb.auug.org.au>
wrote:
> > To save on the ifdef, why not
> >
> > struct acpi_device *acpi;
> >
> > .
> > .
> >
> > acpi = pnp_acpi_device(dev);
> > if (acpi)
> >
> > acpi_dev_handle = acpi->handle;
>
> I guess struct acpi_device may not be visible when CONFIG_ACPI is not
> set? That would be a pain :-(
Yeah seems like it :(
I also thought about this way but then decided against it for the obvious
reason.
Stephen, do you pull this patch in directly or shall it go via my tpmdd-tree -
> james -> -next ?
> As an aside, the dummy pnp_acpi_device() should be returning NULL not
> 0, and could be a static inline function (as could several other things
> in that header.
Yeah, probably.
(although this function is only in exactly two places within the kernel... so
not much is gained here:)
Maybe I'll post a patch or maybe we can get rid of this whole thing
altogether.
Let me think about it.
Peter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] tpm/tpm_tis: Add missing ifdef CONFIG_ACPI for pnp_acpi_device
2015-01-21 22:40 ` Peter Hüwe
@ 2015-01-21 23:05 ` Stephen Rothwell
0 siblings, 0 replies; 7+ messages in thread
From: Stephen Rothwell @ 2015-01-21 23:05 UTC (permalink / raw)
To: Peter Hüwe; +Cc: linux-next, tpmdd-devel, Jarkko Sakkinen, Jim Davis
[-- Attachment #1: Type: text/plain, Size: 370 bytes --]
Hi Peter,
On Wed, 21 Jan 2015 23:40:04 +0100 Peter Hüwe <PeterHuewe@gmx.de> wrote:
>
> Stephen, do you pull this patch in directly or shall it go via my tpmdd-tree -
> > james -> -next ?
Normally these go via the tree maintainer (unless they affect me
directly - which this doesn't).
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] tpm/tpm_tis: Add missing ifdef CONFIG_ACPI for pnp_acpi_device
2015-01-21 23:42 Peter Huewe
@ 2015-01-22 2:22 ` James Morris
0 siblings, 0 replies; 7+ messages in thread
From: James Morris @ 2015-01-22 2:22 UTC (permalink / raw)
To: Peter Huewe
Cc: linux-security-module, Stephen Rothwell, linux-next, tpmdd-devel,
Jarkko Sakkinen, Jim Davis
On Thu, 22 Jan 2015, Peter Huewe wrote:
> This fixes a build failure if CONFIG_PNP is set but CONFIG_ACPI is not:
> drivers/char/tpm/tpm_tis.c: In function ?tpm_tis_pnp_init?:
> drivers/char/tpm/tpm_tis.c:912:45: error: invalid type argument of
> ?->? (have ?int?)
> acpi_dev_handle = pnp_acpi_device(pnp_dev)->handle;
>
> If CONFIG_PNPACPI is not set pnp_acpi_device is defined as 0 and thus
> accesing the handle is not possible.
>
> Fixes: 0dc553652102 ("tpm: fix raciness of PPI interface lookup")
> Reported-by: Jim Davis <jim.epost@gmail.com>
> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Applied.
--
James Morris
<jmorris@namei.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] tpm/tpm_tis: Add missing ifdef CONFIG_ACPI for pnp_acpi_device
@ 2015-01-21 23:42 Peter Huewe
2015-01-22 2:22 ` James Morris
0 siblings, 1 reply; 7+ messages in thread
From: Peter Huewe @ 2015-01-21 23:42 UTC (permalink / raw)
To: jmorris
Cc: linux-security-module, Stephen Rothwell, linux-next, tpmdd-devel,
Jarkko Sakkinen, Jim Davis, Peter Huewe
This fixes a build failure if CONFIG_PNP is set but CONFIG_ACPI is not:
drivers/char/tpm/tpm_tis.c: In function ‘tpm_tis_pnp_init’:
drivers/char/tpm/tpm_tis.c:912:45: error: invalid type argument of
‘->’ (have ‘int’)
acpi_dev_handle = pnp_acpi_device(pnp_dev)->handle;
If CONFIG_PNPACPI is not set pnp_acpi_device is defined as 0 and thus
accesing the handle is not possible.
Fixes: 0dc553652102 ("tpm: fix raciness of PPI interface lookup")
Reported-by: Jim Davis <jim.epost@gmail.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
Hi James unfortunately there was another build-error in -next. :(
Can you apply this patch directly?
otherwise you can also pull directly from my tree:
The following changes since commit 743410a03bbf110da8942a715cf1358344ecc281:
tpm: fix format string error in tpm-chip.c (2015-01-20 21:28:36 +0100)
are available in the git repository at:
https://github.com/PeterHuewe/linux-tpmdd
for you to fetch changes up to d4989d9f693b9502f9288da5db279c2f8c2e50be:
tpm/tpm_tis: Add missing ifdef CONFIG_ACPI for pnp_acpi_device (2015-01-21 21:35:26 +0100)
Thanks,
Peter
drivers/char/tpm/tpm_tis.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 20a61bc98db8..6725bef7cb96 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -908,8 +908,10 @@ static int tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
if (is_itpm(pnp_dev))
itpm = true;
+#ifdef CONFIG_ACPI
if (pnp_acpi_device(pnp_dev))
acpi_dev_handle = pnp_acpi_device(pnp_dev)->handle;
+#endif
return tpm_tis_init(&pnp_dev->dev, acpi_dev_handle, start, len, irq);
}
--
2.0.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-01-22 2:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-21 20:40 [PATCH] tpm/tpm_tis: Add missing ifdef CONFIG_ACPI for pnp_acpi_device Peter Huewe
2015-01-21 21:23 ` Stephen Rothwell
2015-01-21 21:34 ` Stephen Rothwell
2015-01-21 22:40 ` Peter Hüwe
2015-01-21 23:05 ` Stephen Rothwell
2015-01-21 23:42 Peter Huewe
2015-01-22 2:22 ` James Morris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).