From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org,
Martin Wilck <Martin.Wilck@ts.fujitsu.com>,
Peter Huewe <peterhuewe@gmx.de>
Subject: Re: [PATCH 2/2] tpm_tis: Clean up the force=1 module parameter
Date: Tue, 1 Dec 2015 10:35:49 -0700 [thread overview]
Message-ID: <20151201173549.GB691@obsidianresearch.com> (raw)
In-Reply-To: <20151201072835.GQ10431@pengutronix.de>
On Tue, Dec 01, 2015 at 08:28:35AM +0100, Uwe Kleine-König wrote:
> On Mon, Nov 30, 2015 at 12:27:12PM -0700, Jason Gunthorpe wrote:
> > The TPM core has long assumed that every device has a driver attached,
> > however b8b2c7d845d5 ("base/platform: assert that dev_pm_domain callbacks are
> > called unconditionally") breaks that assumption.
>
> Maybe it's worth to point out that b8b2c7d845d5 didn't break it on
> purpose and is fixed accordingly. Still the assumption isn't valid, but
> works in practise.
Purposeful or not, it is the source of the bug this patch is
fixing.. I'm happy with any language, proposal?
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + if (res == NULL) {
>
> indention problems here.
Woops, forgot to run check patch..
> > + if (res)
> > + tpm_info.irq = res->start;
> > + else {
>
> If one branch of an if/else has braces, all of them should.
Is that a thing now? Surprised checkpatch doesn't complain.
> > static bool force;
> > +#ifdef CONFIG_X86
> > module_param(force, bool, 0444);
> > MODULE_PARM_DESC(force, "Force device probe rather than using ACPI entry");
> > +#endif
>
> Is this added ifdef intended to be in this commit?
Yes, upon auditing all this it is clear the values we have are
hard-wired to x86, so this will never work on another platform.
I'm happy to put that in another patch.
> > -err_init:
> > - platform_device_unregister(pdev);
> > -err_dev:
> > - platform_driver_unregister(&tis_drv);
> > +out4:
> > +#ifdef CONFIG_ACPI
> > + acpi_bus_unregister_driver(&tis_acpi_driver);
> > +out3:
> > +#endif
> > + pnp_unregister_driver(&tis_pnp_driver);
> > +out2:
> > + platform_device_unregister(force_pdev);
> > +out1:
>
> Might be a matter of taste, but having nicer names for the error labels
> makes review easier. For example I would have called "out3"
> "err_register_acpi" instead. Then you can easily verify that it's placed
> right in the error path being directly after
> acpi_bus_unregister_driver.
The downside is it is harder to review the goto sites because there is
no longer much logic to their ordering, but sure, names seem a bit
more common in tpm.
> Also all kind of strange things happen if you later need to add a label
> between out2 and out3. drivers/scsi/hpsa.c for example used "clean2_5"
> in a similar situation.
Yes, it isn't so bad to do that.
Jason
next prev parent reply other threads:[~2015-12-01 17:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-30 19:27 tpm_tis: Clean up force module parameter Jason Gunthorpe
2015-11-30 19:27 ` [PATCH 1/2] tpm_tis: Disable interrupt auto probing on a per-device basis Jason Gunthorpe
2015-12-01 7:17 ` Uwe Kleine-König
2015-12-01 17:26 ` Jason Gunthorpe
2015-11-30 19:27 ` [PATCH 2/2] tpm_tis: Clean up the force=1 module parameter Jason Gunthorpe
2015-12-01 7:28 ` Uwe Kleine-König
2015-12-01 8:35 ` Jarkko Sakkinen
2015-12-01 17:43 ` Jason Gunthorpe
2015-12-01 20:51 ` Jarkko Sakkinen
2015-12-01 17:35 ` Jason Gunthorpe [this message]
2015-12-01 11:50 ` [tpmdd-devel] " Wilck, Martin
2015-12-01 17:39 ` Jason Gunthorpe
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=20151201173549.GB691@obsidianresearch.com \
--to=jgunthorpe@obsidianresearch.com \
--cc=Martin.Wilck@ts.fujitsu.com \
--cc=jarkko.sakkinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterhuewe@gmx.de \
--cc=tpmdd-devel@lists.sourceforge.net \
--cc=u.kleine-koenig@pengutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox