From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Christophe Ricard
<christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: peterhuewe-Mmb7MZpHnFY@public.gmane.org,
ashley-fm2HMyfA2y6tG0bUXCXiUA@public.gmane.org,
tpmdd-yWjUBOtONefk1uMJSBkQmQ@public.gmane.org,
tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
christophe-h.ricard-qxv4g6HH51o@public.gmane.org,
jean-luc.blanc-qxv4g6HH51o@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v3 08/15] tpm/tpm_i2c_stm_st33: Add devicetree structure
Date: Tue, 14 Oct 2014 11:32:09 -0600 [thread overview]
Message-ID: <20141014173209.GD27232@obsidianresearch.com> (raw)
In-Reply-To: <1413231817-5174-9-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
On Mon, Oct 13, 2014 at 10:23:30PM +0200, Christophe Ricard wrote:
> Add tpm_stm_st33_i2c dts structure keeping backward compatibility
> with static platform_data support as well.
> In the mean time the code is made much simpler by:
> - Moving all gpio_request to devm_gpio_request_one primitive
> - Moving request_irq to devm_request_threaded_irq
This should move to patch 11, and it doesn't look like threaded_irq is
necessary anymore?
> + pr_err("Failed to retrieve lpcpd-gpios from dts.\n");
All these prints should be dev_err, I think, clinet->dev looks like it
must be valid at this point.
This is a general comment actually, all the pr_* prints look like they
have access to a struct device and should be dev_* prints.
> + /* GPIO request and configuration */
> + r = devm_gpio_request_one(&client->dev, gpio,
> + GPIOF_OUT_INIT_HIGH, "TPM IO LPCPD");
> + if (r) {
> + pr_err("Failed to request lpcpd pin\n");
Ditto
> + return -ENODEV;
Return r?
> + pdata = client->dev.platform_data;
> + if (pdata == NULL) {
> + pr_err("No platform data\n");
> + return -EINVAL;
> + }
It would be nice if the platform data was optional since it is now
the case that the only content (io_lpcd) is optional.
> + if (r) {
> + pr_err("%s : reset gpio_request failed\n", __FILE__);
> + return -ENODEV;
Ditto
> tpm_dev = devm_kzalloc(&client->dev, sizeof(struct tpm_stm_dev),
> GFP_KERNEL);
> if (!tpm_dev) {
> dev_info(&client->dev, "cannot allocate memory for tpm
> data\n");
The print is redundant, kzalloc failure already prints lots of stuff
> + platform_data = client->dev.platform_data;
> + if (!platform_data && client->dev.of_node) {
> + r = tpm_stm_i2c_of_request_resources(chip);
> + if (r) {
> + pr_err("No platform data\n");
If we go down this branch then tpm_stm_i2c_of_request_resources
already printed, so this print is redundant
> + goto _tpm_clean_answer;
> + }
> + } else if (platform_data) {
> + r = tpm_stm_i2c_request_resources(client, chip);
> + if (r) {
> + pr_err("Cannot get platform resources\n");
Ditto
> + goto _tpm_clean_answer;
> + }
> + } else {
> + pr_err("tpm_stm_st33 platform resources not available\n");
> + goto _tpm_clean_answer;
Again, would be nice if platform data was optional
> intmask |= TPM_INTF_CMD_READY_INT
> - | TPM_INTF_FIFO_AVALAIBLE_INT
> - | TPM_INTF_WAKE_UP_READY_INT
> - | TPM_INTF_LOCALITY_CHANGE_INT
> | TPM_INTF_STS_VALID_INT
> | TPM_INTF_DATA_AVAIL_INT;
This hunk should also go to patch 11, I think..
Jason
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-10-14 17:32 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-13 20:23 [PATCH v3 00/15] ST33 I2C TPM driver cleanup Christophe Ricard
[not found] ` <1413231817-5174-1-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2014-10-13 20:23 ` [PATCH v3 01/15] tpm/tpm_i2c_stm_st33: Update Kconfig in order to be inline to other similar product Christophe Ricard
2014-10-13 20:23 ` [PATCH v3 02/15] tpm/tpm_i2c_stm_st33: Fix few coding style error reported by scripts/checkpatch.pl Christophe Ricard
2014-10-13 20:23 ` [PATCH v3 03/15] tpm/tpm_i2c_stm_st33: Move tpm registers to tpm_i2c_stm_st33.c Christophe Ricard
2014-10-13 20:23 ` [PATCH v3 04/15] tpm/tpm_i2c_stm_st33: Add new tpm_stm_dev structure and remove tpm_i2c_buffer[0], [1] buffer Christophe Ricard
2014-10-13 20:23 ` [PATCH v3 05/15] tpm/tpm_i2c_stm_st33: Remove reference to io_serirq Christophe Ricard
2014-10-13 20:23 ` [PATCH v3 06/15] tpm/tpm_i2c_stm_st33: Replace err/rc/ret by r for a function return code Christophe Ricard
2014-10-13 20:23 ` [PATCH v3 07/15] tpm/tpm_i2c_stm_st33: Replace tpm_st33_* function with tpm_stm_* Christophe Ricard
2014-10-13 20:23 ` [PATCH v3 08/15] tpm/tpm_i2c_stm_st33: Add devicetree structure Christophe Ricard
[not found] ` <1413231817-5174-9-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2014-10-14 17:32 ` Jason Gunthorpe [this message]
[not found] ` <20141014173209.GD27232-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-10-14 19:59 ` Christophe RICARD
2014-10-13 20:23 ` [PATCH v3 09/15] tpm/tpm_i2c_stm_st33/dts/st33zp24_i2c: Add DTS Documentation Christophe Ricard
2014-10-13 20:23 ` [PATCH v3 10/15] tpm/tpm_i2c_stm_st33: Few code cleanup Christophe Ricard
2014-10-13 20:23 ` [PATCH v3 11/15] tpm/tpm_i2c_stm_st33: Replace wait_for_serirq_timeout by wait_for_tpm_stat Christophe Ricard
[not found] ` <1413231817-5174-12-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2014-10-14 18:09 ` Jason Gunthorpe
[not found] ` <20141014180914.GE27232-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-10-14 20:44 ` Christophe RICARD
2014-10-14 21:15 ` Jason Gunthorpe
2014-10-13 20:23 ` [PATCH v3 12/15] tpm/tpm_i2c_stm_st33: Remove useless i2c read on interrupt registers Christophe Ricard
[not found] ` <1413231817-5174-13-git-send-email-christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
2014-10-14 8:17 ` [tpmdd-devel] " Marcin Obara
[not found] ` <CAPxFvEPT8wEt4BfZ7112aFpsowXV2WUHvsN5W9=iKUvmRpcBFw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-14 8:34 ` Christophe Henri RICARD
2014-10-13 20:23 ` [PATCH v3 13/15] tpm/tpm_i2c_stm_st33: Fix potential bug in tpm_stm_i2c_send Christophe Ricard
2014-10-13 20:23 ` [PATCH v3 14/15] tpm/tpm_i2c_stm_st33: Change License header to have up to date address information Christophe Ricard
2014-10-13 20:23 ` [PATCH v3 15/15] tpm/tpm_i2c_stm_st33: Increment driver version to 1.2.1 Christophe Ricard
2014-10-14 18:51 ` [PATCH v3 00/15] ST33 I2C TPM driver cleanup 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=20141014173209.GD27232@obsidianresearch.com \
--to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
--cc=ashley-fm2HMyfA2y6tG0bUXCXiUA@public.gmane.org \
--cc=christophe-h.ricard-qxv4g6HH51o@public.gmane.org \
--cc=christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=jean-luc.blanc-qxv4g6HH51o@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 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).