All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] tpm: Fix suspend regression
@ 2016-05-11 15:28 Stefan Berger
       [not found] ` <1462980507-21682-1-git-send-email-stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
  2016-05-12 13:49   ` Jarkko Sakkinen
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Berger @ 2016-05-11 15:28 UTC (permalink / raw)
  To: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: jmmahler-Re5JQEeQqe8AvxtiuMwx3w

Fix the suspend regression due to the wrong way of retrieving the
chip structure. The suspend functions are attached to the hardware
device, not the chip and thus must rely on drvdata.

Fixes: e89f8b1ade9cc1a ("tpm: Remove all uses of drvdata from the TPM Core")
Reported-by: Jeremiah Mahler <jmmahler-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Stefan Berger <stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Tested-by: Stefan Berger <stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Reviewed-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Tested-by: Jeremiah Mahler <jmmahler-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/char/tpm/tpm-interface.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index 080dade..5e3c1b6 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -934,7 +934,7 @@ static struct tpm_input_header savestate_header = {
  */
 int tpm_pm_suspend(struct device *dev)
 {
-	struct tpm_chip *chip = to_tpm_chip(dev);
+	struct tpm_chip *chip = dev_get_drvdata(dev);
 	struct tpm_cmd_t cmd;
 	int rc, try;
 
@@ -995,7 +995,7 @@ EXPORT_SYMBOL_GPL(tpm_pm_suspend);
  */
 int tpm_pm_resume(struct device *dev)
 {
-	struct tpm_chip *chip = to_tpm_chip(dev);
+	struct tpm_chip *chip = dev_get_drvdata(dev);
 
 	if (chip == NULL)
 		return -ENODEV;
-- 
2.4.3


------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j

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

* Re: [PATCH v2] tpm: Fix suspend regression
       [not found] ` <1462980507-21682-1-git-send-email-stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
@ 2016-05-12  1:06   ` Jeremiah Mahler
  0 siblings, 0 replies; 6+ messages in thread
From: Jeremiah Mahler @ 2016-05-12  1:06 UTC (permalink / raw)
  To: Stefan Berger; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Hi Stefan,

On Wed, May 11, 2016 at 11:28:27AM -0400, Stefan Berger wrote:
> Fix the suspend regression due to the wrong way of retrieving the
> chip structure. The suspend functions are attached to the hardware
> device, not the chip and thus must rely on drvdata.
> 
> Fixes: e89f8b1ade9cc1a ("tpm: Remove all uses of drvdata from the TPM Core")
> Reported-by: Jeremiah Mahler <jmmahler-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Stefan Berger <stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
> Tested-by: Stefan Berger <stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
> Reviewed-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> Tested-by: Jeremiah Mahler <jmmahler-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/char/tpm/tpm-interface.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> index 080dade..5e3c1b6 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -934,7 +934,7 @@ static struct tpm_input_header savestate_header = {
>   */
>  int tpm_pm_suspend(struct device *dev)
>  {
> -	struct tpm_chip *chip = to_tpm_chip(dev);
> +	struct tpm_chip *chip = dev_get_drvdata(dev);
>  	struct tpm_cmd_t cmd;
>  	int rc, try;
>  
> @@ -995,7 +995,7 @@ EXPORT_SYMBOL_GPL(tpm_pm_suspend);
>   */
>  int tpm_pm_resume(struct device *dev)
>  {
> -	struct tpm_chip *chip = to_tpm_chip(dev);
> +	struct tpm_chip *chip = dev_get_drvdata(dev);
>  
>  	if (chip == NULL)
>  		return -ENODEV;
> -- 
> 2.4.3
> 

The patch looks good, thanks :-)

-- 
- Jeremiah Mahler

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j

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

* Re: [PATCH v2] tpm: Fix suspend regression
       [not found] ` <1462980507-21682-1-git-send-email-stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
@ 2016-05-12 13:49   ` Jarkko Sakkinen
  0 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2016-05-12 13:49 UTC (permalink / raw)
  To: Stefan Berger
  Cc: tpmdd-devel, jmmahler, jgunthorpe, linux-security-module, linux-kernel

On Wed, May 11, 2016 at 11:28:27AM -0400, Stefan Berger wrote:
> Fix the suspend regression due to the wrong way of retrieving the
> chip structure. The suspend functions are attached to the hardware
> device, not the chip and thus must rely on drvdata.
> 
> Fixes: e89f8b1ade9cc1a ("tpm: Remove all uses of drvdata from the TPM Core")
> Reported-by: Jeremiah Mahler <jmmahler@gmail.com>
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> Tested-by: Jeremiah Mahler <jmmahler@gmail.com>

Acked-by: Jarkko Sakkinen <jarkko.sakkine@linux.intel.com>

/Jarkko

> ---
>  drivers/char/tpm/tpm-interface.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> index 080dade..5e3c1b6 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -934,7 +934,7 @@ static struct tpm_input_header savestate_header = {
>   */
>  int tpm_pm_suspend(struct device *dev)
>  {
> -	struct tpm_chip *chip = to_tpm_chip(dev);
> +	struct tpm_chip *chip = dev_get_drvdata(dev);
>  	struct tpm_cmd_t cmd;
>  	int rc, try;
>  
> @@ -995,7 +995,7 @@ EXPORT_SYMBOL_GPL(tpm_pm_suspend);
>   */
>  int tpm_pm_resume(struct device *dev)
>  {
> -	struct tpm_chip *chip = to_tpm_chip(dev);
> +	struct tpm_chip *chip = dev_get_drvdata(dev);
>  
>  	if (chip == NULL)
>  		return -ENODEV;
> -- 
> 2.4.3
> 

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

* Re: [PATCH v2] tpm: Fix suspend regression
@ 2016-05-12 13:49   ` Jarkko Sakkinen
  0 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2016-05-12 13:49 UTC (permalink / raw)
  To: Stefan Berger
  Cc: linux-security-module-u79uwXL29TY76Z2rM5mHXA,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	jmmahler-Re5JQEeQqe8AvxtiuMwx3w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Wed, May 11, 2016 at 11:28:27AM -0400, Stefan Berger wrote:
> Fix the suspend regression due to the wrong way of retrieving the
> chip structure. The suspend functions are attached to the hardware
> device, not the chip and thus must rely on drvdata.
> 
> Fixes: e89f8b1ade9cc1a ("tpm: Remove all uses of drvdata from the TPM Core")
> Reported-by: Jeremiah Mahler <jmmahler-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Stefan Berger <stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
> Tested-by: Stefan Berger <stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
> Reviewed-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> Tested-by: Jeremiah Mahler <jmmahler-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Acked-by: Jarkko Sakkinen <jarkko.sakkine-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

/Jarkko

> ---
>  drivers/char/tpm/tpm-interface.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> index 080dade..5e3c1b6 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -934,7 +934,7 @@ static struct tpm_input_header savestate_header = {
>   */
>  int tpm_pm_suspend(struct device *dev)
>  {
> -	struct tpm_chip *chip = to_tpm_chip(dev);
> +	struct tpm_chip *chip = dev_get_drvdata(dev);
>  	struct tpm_cmd_t cmd;
>  	int rc, try;
>  
> @@ -995,7 +995,7 @@ EXPORT_SYMBOL_GPL(tpm_pm_suspend);
>   */
>  int tpm_pm_resume(struct device *dev)
>  {
> -	struct tpm_chip *chip = to_tpm_chip(dev);
> +	struct tpm_chip *chip = dev_get_drvdata(dev);
>  
>  	if (chip == NULL)
>  		return -ENODEV;
> -- 
> 2.4.3
> 

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j

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

* Re: [PATCH v2] tpm: Fix suspend regression
@ 2016-05-12 13:58     ` Jarkko Sakkinen
  0 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2016-05-12 13:58 UTC (permalink / raw)
  To: Stefan Berger
  Cc: tpmdd-devel, jmmahler, jgunthorpe, linux-security-module, linux-kernel

On Thu, May 12, 2016 at 04:49:52PM +0300, Jarkko Sakkinen wrote:
> On Wed, May 11, 2016 at 11:28:27AM -0400, Stefan Berger wrote:
> > Fix the suspend regression due to the wrong way of retrieving the
> > chip structure. The suspend functions are attached to the hardware
> > device, not the chip and thus must rely on drvdata.
> > 
> > Fixes: e89f8b1ade9cc1a ("tpm: Remove all uses of drvdata from the TPM Core")
> > Reported-by: Jeremiah Mahler <jmmahler@gmail.com>
> > Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> > Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> > Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> > Tested-by: Jeremiah Mahler <jmmahler@gmail.com>
> 
> Acked-by: Jarkko Sakkinen <jarkko.sakkine@linux.intel.com>

Merged to next.

/Jarkko

> /Jarkko
> 
> > ---
> >  drivers/char/tpm/tpm-interface.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> > index 080dade..5e3c1b6 100644
> > --- a/drivers/char/tpm/tpm-interface.c
> > +++ b/drivers/char/tpm/tpm-interface.c
> > @@ -934,7 +934,7 @@ static struct tpm_input_header savestate_header = {
> >   */
> >  int tpm_pm_suspend(struct device *dev)
> >  {
> > -	struct tpm_chip *chip = to_tpm_chip(dev);
> > +	struct tpm_chip *chip = dev_get_drvdata(dev);
> >  	struct tpm_cmd_t cmd;
> >  	int rc, try;
> >  
> > @@ -995,7 +995,7 @@ EXPORT_SYMBOL_GPL(tpm_pm_suspend);
> >   */
> >  int tpm_pm_resume(struct device *dev)
> >  {
> > -	struct tpm_chip *chip = to_tpm_chip(dev);
> > +	struct tpm_chip *chip = dev_get_drvdata(dev);
> >  
> >  	if (chip == NULL)
> >  		return -ENODEV;
> > -- 
> > 2.4.3
> > 

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

* Re: [PATCH v2] tpm: Fix suspend regression
@ 2016-05-12 13:58     ` Jarkko Sakkinen
  0 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2016-05-12 13:58 UTC (permalink / raw)
  To: Stefan Berger
  Cc: linux-security-module-u79uwXL29TY76Z2rM5mHXA,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	jmmahler-Re5JQEeQqe8AvxtiuMwx3w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Thu, May 12, 2016 at 04:49:52PM +0300, Jarkko Sakkinen wrote:
> On Wed, May 11, 2016 at 11:28:27AM -0400, Stefan Berger wrote:
> > Fix the suspend regression due to the wrong way of retrieving the
> > chip structure. The suspend functions are attached to the hardware
> > device, not the chip and thus must rely on drvdata.
> > 
> > Fixes: e89f8b1ade9cc1a ("tpm: Remove all uses of drvdata from the TPM Core")
> > Reported-by: Jeremiah Mahler <jmmahler-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > Signed-off-by: Stefan Berger <stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
> > Tested-by: Stefan Berger <stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
> > Reviewed-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> > Tested-by: Jeremiah Mahler <jmmahler-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> Acked-by: Jarkko Sakkinen <jarkko.sakkine-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

Merged to next.

/Jarkko

> /Jarkko
> 
> > ---
> >  drivers/char/tpm/tpm-interface.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> > index 080dade..5e3c1b6 100644
> > --- a/drivers/char/tpm/tpm-interface.c
> > +++ b/drivers/char/tpm/tpm-interface.c
> > @@ -934,7 +934,7 @@ static struct tpm_input_header savestate_header = {
> >   */
> >  int tpm_pm_suspend(struct device *dev)
> >  {
> > -	struct tpm_chip *chip = to_tpm_chip(dev);
> > +	struct tpm_chip *chip = dev_get_drvdata(dev);
> >  	struct tpm_cmd_t cmd;
> >  	int rc, try;
> >  
> > @@ -995,7 +995,7 @@ EXPORT_SYMBOL_GPL(tpm_pm_suspend);
> >   */
> >  int tpm_pm_resume(struct device *dev)
> >  {
> > -	struct tpm_chip *chip = to_tpm_chip(dev);
> > +	struct tpm_chip *chip = dev_get_drvdata(dev);
> >  
> >  	if (chip == NULL)
> >  		return -ENODEV;
> > -- 
> > 2.4.3
> > 

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j

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

end of thread, other threads:[~2016-05-12 13:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-11 15:28 [PATCH v2] tpm: Fix suspend regression Stefan Berger
     [not found] ` <1462980507-21682-1-git-send-email-stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-05-12  1:06   ` Jeremiah Mahler
2016-05-12 13:49 ` Jarkko Sakkinen
2016-05-12 13:49   ` Jarkko Sakkinen
2016-05-12 13:58   ` Jarkko Sakkinen
2016-05-12 13:58     ` Jarkko Sakkinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.