From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Jarkko Sakkinen
<jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: Peter Huewe <peterhuewe-Mmb7MZpHnFY@public.gmane.org>,
Ashley Lai <ashley-fm2HMyfA2y6tG0bUXCXiUA@public.gmane.org>,
Marcel Selhorst <tpmdd-yWjUBOtONefk1uMJSBkQmQ@public.gmane.org>,
linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [tpmdd-devel] [PATCH v2 3/7] tpm: clean up tpm_tis driver life-cycle
Date: Tue, 7 Oct 2014 11:53:26 -0600 [thread overview]
Message-ID: <20141007175326.GB10432@obsidianresearch.com> (raw)
In-Reply-To: <1412701277-27794-4-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
On Tue, Oct 07, 2014 at 08:01:13PM +0300, Jarkko Sakkinen wrote:
> + chip = tpm_chip_alloc(dev, &tpm_tis);
> + if (!chip)
> return -ENODEV;
Needs to use ERR_PTR
> + rc = tpm_chip_register(chip);
> + if (rc)
> + return -ENODEV;
Wrong ordering, this needs to be last in the probe function
Return rc not -ENODEV
> +static void tpm_tis_chip_remove(struct tpm_chip *chip)
> +{
> + iowrite32(~TPM_GLOBAL_INT_ENABLE &
> + ioread32(chip->vendor.iobase +
> + TPM_INT_ENABLE(chip->vendor.
> + locality)),
> + chip->vendor.iobase +
> + TPM_INT_ENABLE(chip->vendor.locality));
> + release_locality(chip, chip->vendor.locality, 1);
> + if (chip->vendor.irq)
> + free_irq(chip->vendor.irq, chip);
> +
> + tpm_chip_unregister(chip);
> +}
Wrong ordering, tpm_chip_unregister needs to be first
> + chip = dev_get_drvdata(&pdev->dev);
> + tpm_tis_chip_remove(chip);
> platform_device_unregister(pdev);
I'm under the impression devm does not work outside a device driver
context, so adding devm breaks force mode in this driver. Do you see
differently?
AFAIK the two options are to fix force mode so that it attaches the
dummy platform driver (that is what it is for after all) or remove
force mode.
Jason
WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: Peter Huewe <peterhuewe@gmx.de>,
Ashley Lai <ashley@ashleylai.com>,
Marcel Selhorst <tpmdd@selhorst.net>,
linux-api@vger.kernel.org, tpmdd-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [tpmdd-devel] [PATCH v2 3/7] tpm: clean up tpm_tis driver life-cycle
Date: Tue, 7 Oct 2014 11:53:26 -0600 [thread overview]
Message-ID: <20141007175326.GB10432@obsidianresearch.com> (raw)
In-Reply-To: <1412701277-27794-4-git-send-email-jarkko.sakkinen@linux.intel.com>
On Tue, Oct 07, 2014 at 08:01:13PM +0300, Jarkko Sakkinen wrote:
> + chip = tpm_chip_alloc(dev, &tpm_tis);
> + if (!chip)
> return -ENODEV;
Needs to use ERR_PTR
> + rc = tpm_chip_register(chip);
> + if (rc)
> + return -ENODEV;
Wrong ordering, this needs to be last in the probe function
Return rc not -ENODEV
> +static void tpm_tis_chip_remove(struct tpm_chip *chip)
> +{
> + iowrite32(~TPM_GLOBAL_INT_ENABLE &
> + ioread32(chip->vendor.iobase +
> + TPM_INT_ENABLE(chip->vendor.
> + locality)),
> + chip->vendor.iobase +
> + TPM_INT_ENABLE(chip->vendor.locality));
> + release_locality(chip, chip->vendor.locality, 1);
> + if (chip->vendor.irq)
> + free_irq(chip->vendor.irq, chip);
> +
> + tpm_chip_unregister(chip);
> +}
Wrong ordering, tpm_chip_unregister needs to be first
> + chip = dev_get_drvdata(&pdev->dev);
> + tpm_tis_chip_remove(chip);
> platform_device_unregister(pdev);
I'm under the impression devm does not work outside a device driver
context, so adding devm breaks force mode in this driver. Do you see
differently?
AFAIK the two options are to fix force mode so that it attaches the
dummy platform driver (that is what it is for after all) or remove
force mode.
Jason
next prev parent reply other threads:[~2014-10-07 17:53 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-07 17:01 [PATCH v2 0/7] TPM 2.0 support Jarkko Sakkinen
2014-10-07 17:01 ` Jarkko Sakkinen
2014-10-07 17:01 ` [PATCH v2 1/7] tpm: merge duplicate transmit_cmd() functions Jarkko Sakkinen
2014-10-07 17:01 ` [PATCH v2 3/7] tpm: clean up tpm_tis driver life-cycle Jarkko Sakkinen
[not found] ` <1412701277-27794-4-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-10-07 17:53 ` Jason Gunthorpe [this message]
2014-10-07 17:53 ` [tpmdd-devel] " Jason Gunthorpe
2014-10-07 17:01 ` [PATCH v2 4/7] tpm: TPM 2.0 commands Jarkko Sakkinen
2014-10-07 17:01 ` [PATCH v2 5/7] tpm: TPM 2.0 sysfs attributes Jarkko Sakkinen
2014-10-07 17:01 ` [PATCH v2 6/7] tpm: TPM 2.0 CRB Interface Jarkko Sakkinen
[not found] ` <1412701277-27794-7-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-10-07 17:54 ` [tpmdd-devel] " Jason Gunthorpe
2014-10-07 17:54 ` Jason Gunthorpe
[not found] ` <1412701277-27794-1-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-10-07 17:01 ` [PATCH v2 2/7] tpm: two-phase chip management functions Jarkko Sakkinen
2014-10-07 17:01 ` Jarkko Sakkinen
2014-10-07 17:50 ` [tpmdd-devel] " Jason Gunthorpe
[not found] ` <20141007175017.GA10432-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-10-07 18:04 ` Jarkko Sakkinen
2014-10-07 18:04 ` Jarkko Sakkinen
[not found] ` <20141007180417.GA29459-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-10-07 18:27 ` Jason Gunthorpe
2014-10-07 18:27 ` Jason Gunthorpe
[not found] ` <20141007182756.GA10774-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-10-07 19:15 ` Jarkko Sakkinen
2014-10-07 19:15 ` Jarkko Sakkinen
2014-10-07 22:28 ` Jarkko Sakkinen
2014-10-07 22:28 ` Jarkko Sakkinen
[not found] ` <20141007222814.GA7262-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-10-07 22:34 ` Jason Gunthorpe
2014-10-07 22:34 ` Jason Gunthorpe
[not found] ` <20141007223442.GA3014-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-10-09 9:07 ` Jarkko Sakkinen
2014-10-09 9:07 ` Jarkko Sakkinen
2014-10-07 17:01 ` [PATCH v2 7/7] tpm: TPM 2.0 FIFO Interface Jarkko Sakkinen
2014-10-07 17:01 ` Jarkko Sakkinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141007175326.GB10432@obsidianresearch.com \
--to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
--cc=ashley-fm2HMyfA2y6tG0bUXCXiUA@public.gmane.org \
--cc=jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=peterhuewe-Mmb7MZpHnFY@public.gmane.org \
--cc=tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=tpmdd-yWjUBOtONefk1uMJSBkQmQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.