public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
To: Joe Perches <joe@perches.com>
Cc: Christophe Henri RICARD <christophe-h.ricard@st.com>,
	Marcel Selhorst <m.selhorst@sirrix.com>,
	Debora Velarde <debora@linux.vnet.ibm.com>,
	James Morris <jmorris@namei.org>,
	tpmdd-devel@lists.sourceforge.net,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] drivers/char/tpm/tpm_stm_st19_i2c.c: Use pr_fmt, pr_<level> and FUNC_ENTER
Date: Tue, 14 Sep 2010 14:06:28 -0300	[thread overview]
Message-ID: <1284483988.17585.0.camel@blackbox> (raw)
In-Reply-To: <b64d9478978867b8bdd059522af008463b8e26ad.1283556028.git.joe@perches.com>

Acked-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>

On Fri, 2010-09-03 at 16:29 -0700, Joe Perches wrote:
> Add FUNC_ENTER to emit pr_info("%s\n", __func_) with #DEBUG
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  drivers/char/tpm/tpm_stm_st19_i2c.c |   57 ++++++++++++++++++-----------------
>  1 files changed, 29 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_stm_st19_i2c.c b/drivers/char/tpm/tpm_stm_st19_i2c.c
> index 35307d2..cdf2eb3 100644
> --- a/drivers/char/tpm/tpm_stm_st19_i2c.c
> +++ b/drivers/char/tpm/tpm_stm_st19_i2c.c
> @@ -58,6 +58,8 @@
>   * ----------------------------------------------------------------------
>   */
> 
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/module.h>
>  #include <linux/kernel.h>
>  #include <linux/delay.h>
> @@ -81,6 +83,12 @@
> 
>  #include "tpm_stm_st19_i2c.h"
> 
> +#ifdef DEBUG
> +#define FUNC_ENTER()	pr_info("%s\n", __func__)
> +#else
> +#define FUNC_ENTER()	do {} while (0)
> +#endif
> +
>  /*
>   * @Comments: tpm_stm_st19_platform_specific.h deliver shows a platform specific
>   * file example.
> @@ -260,9 +268,7 @@ static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf,
>  	u32 ret = 0, i, size, ordinal, pin = 0;
>  	struct i2c_client *client;
> 
> -#ifdef DEBUG
> -	printk(KERN_INFO "tpm_st19_i2c: tpm_stm_i2c_send\n");
> -#endif
> +	FUNC_ENTER();
> 
>  	if (chip == NULL)
>  		return -EBUSY;
> @@ -337,7 +343,7 @@ static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf,
>  				    TPM_I2C_BLOCK_SIZE ? TPM_I2C_BLOCK_SIZE :
>  				    count - i : count);
>  		if (ret < 0) {
> -			printk(KERN_INFO "tpm_st19_i2c: Failed to send data\n");
> +			pr_info("Failed to send data\n");
>  			goto end;
>  		}
> 
> @@ -351,16 +357,13 @@ static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf,
>  							     (TPM_I2C_SHORT));
> 
>  		if (pin != COMMAND_ON) {
> -			printk(KERN_INFO
> -			       "tpm_st19_i2c:"
> -			       " Failed to read gpio pin (AcceptCmd)\n");
> +			pr_info("Failed to read gpio pin (AcceptCmd)\n");
>  			ret = -EIO;
>  			goto end;
>  		}
>  	}
>  	if (i == 0) {
> -		printk(KERN_INFO
> -		       "tpm_st19_i2c: Failed to read gpio pin (AcceptCmd)\n");
> +		pr_info("Failed to read gpio pin (AcceptCmd)\n");
>  		ret = -EIO;
>  	}
>  end:
> @@ -395,9 +398,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf,
>  	int pin = 0;
>  	struct i2c_client *client;
> 
> -#ifdef DEBUG
> -	printk(KERN_INFO "tpm_st19_i2c: tpm_stm_i2c_recv\n");
> -#endif
> +	FUNC_ENTER();
> 
>  	if (chip == NULL)
>  		return -EBUSY;
> @@ -425,9 +426,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf,
>  				     TPM_I2C_BLOCK_SIZE ? TPM_I2C_BLOCK_SIZE :
>  				     size - i : count));
>  		if (ret < 0) {
> -			printk(KERN_INFO
> -			       "tpm_st19_i2c:"
> -			       " Failed to read gpio pin (DataAvalaible)\n");
> +			pr_info("Failed to read gpio pin (DataAvailable)\n");
>  			goto end;
>  		}
> 
> @@ -444,7 +443,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf,
>  					size = count;
>  			}
>  		} else {
> -			printk(KERN_INFO "tpm_st19_i2c: read buffer is NULL\n");
> +			pr_info("read buffer is NULL\n");
>  			goto end;
>  		}
> 
> @@ -459,9 +458,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf,
>  	}
> 
>  	if (i == 0) {
> -		printk(KERN_INFO
> -		       "tpm_st19_i2c: "
> -		       "Failed to read gpio pin (DataAvalaible)\n");
> +		pr_info("Failed to read gpio pin (DataAvailable)\n");
>  		ret = -EIO;
>  		goto end;
>  	}
> @@ -501,7 +498,8 @@ static void tpm_st19_i2c_dummy(struct device *dev)
>  static void tpm_st19_i2c_release(struct kobject *kobj)
>  {
>  	struct tpm_chip *chip;
> -	printk(KERN_INFO "tpm_st19_i2c_release\n");
> +
> +	FUNC_ENTER();
> 
>  	if (_client != NULL) {
>  		chip = (struct tpm_chip *)i2c_get_clientdata(_client);
> @@ -614,19 +612,19 @@ tpm_st19_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
>  	struct tpm_chip *chip;
>  	struct st19np18_platform_data *platform_data;
> 
> -	printk(KERN_INFO "tpm_st19_i2c: tpm_st19_i2c_probe\n");
> +	FUNC_ENTER();
> 
>  	err = 0;
> 
>  	/* Check I2C platform functionnalities */
>  	if (client == NULL) {
> -		printk(KERN_INFO "client is NULL. exiting.\n");
> +		pr_info("client is NULL. exiting.\n");
>  		err = -ENODEV;
>  		goto end;
>  	}
> 
>  	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
> -		printk(KERN_INFO "tpm_st19_i2c: client not i2c capable\n");
> +		pr_info("client not i2c capable\n");
>  		err = -ENODEV;
>  		goto end;
>  	}
> @@ -680,7 +678,7 @@ tpm_st19_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
>  	i2c_set_clientdata(client, chip);
>  	pin_infos->bChipF = false;
> 
> -	printk(KERN_INFO "tpm_st19_i2c: TPM I2C Initialized\n");
> +	pr_info("TPM I2C Initialized\n");
>  	return 0;
>  _gpio_set:
>  _gpio_init:
> @@ -701,7 +699,7 @@ _tpm_clean_answer:
>  	}
>  	pin_infos->bChipF = true;
>  end:
> -	printk(KERN_INFO "tpm_st19_i2c: TPM I2C initialisation fail\n");
> +	pr_info("TPM I2C initialisation fail\n");
>  	return err;
>  }
> 
> @@ -714,7 +712,8 @@ end:
>  static __devexit int tpm_st19_i2c_remove(struct i2c_client *client)
>  {
>  	struct tpm_chip *chip = (struct tpm_chip *)i2c_get_clientdata(client);
> -	printk(KERN_INFO "tpm_st19_i2c: tpm_st19_i2c_remove\n");
> +
> +	FUNC_ENTER();
> 
>  	if (pin_infos != NULL) {
>  		gpio_free(pin_infos->accept_pin);
> @@ -799,7 +798,8 @@ static struct i2c_driver tpm_st19_i2c_driver = {
>   */
>  static int __init tpm_st19_i2c_init(void)
>  {
> -	printk(KERN_INFO "tpm_st19_i2c: tpm_st19_i2c_init\n");
> +	FUNC_ENTER();
> +
>  	return i2c_add_driver(&tpm_st19_i2c_driver);
>  }
> 
> @@ -809,7 +809,8 @@ static int __init tpm_st19_i2c_init(void)
>   */
>  static void __exit tpm_st19_i2c_exit(void)
>  {
> -	printk(KERN_INFO "tpm_st19_i2c: tpm_st19_i2c_exit\n");
> +	FUNC_ENTER();
> +
>  	i2c_del_driver(&tpm_st19_i2c_driver);
>  }
> 



  reply	other threads:[~2010-09-14 17:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <002501cacb5d$9c883650$d598a2f0$@ricard@st.com>
     [not found] ` <5C722288-63DA-494B-AD37-1B4CA5A35EA0@linux.vnet.ibm.com>
     [not found]   ` <002801cacc24$385cdf60$a9169e20$@ricard@st.com>
     [not found]     ` <1269551792.3027.5.camel@blackbox.ibm.com>
     [not found]       ` <51078F5F-518D-4B08-8BB0-CEB672AD10FF@linux.vnet.ibm.com>
     [not found]         ` <000601cae64a$a532aad0$ef980070$@ricard@st.com>
     [not found]           ` <4BD98EEA.4060805@sirrix.com>
     [not found]             ` <!&!AAAAAAAAAAAYAAAAAAAAAP0vDh1zjO1PkFCA0mWh9hHCgAAAEAAAANBlGrYv425GtuqHVwaJ6hkBAAAAAA==@st.com>
     [not found]               ` <35E2570B-DD77-4CDB-9B13-7211E18E7000@linux.vnet.ibm.com>
2010-09-03 19:54                 ` [tpmdd-devel] ST19NP18 I2C driver submission + possible bug found in the last TPM kernel core Christophe Henri RICARD
2010-09-03 23:28                   ` [PATCH 0/2] tpm_stm_st19+i2c: use pr_<level> and cleanups Joe Perches
2010-09-03 23:29                     ` [PATCH 1/2] drivers/char/tpm/tpm_stm_st19_i2c.c: Use pr_fmt, pr_<level> and FUNC_ENTER Joe Perches
2010-09-14 17:06                       ` Rajiv Andrade [this message]
2010-09-03 23:29                     ` [PATCH 2/2] drivers/char/tpm/tpm_stm_st19_i2c.c: Add missing break and neatening Joe Perches
2010-09-14 17:11                       ` Rajiv Andrade
2010-09-17 15:53                         ` Christophe Henri RICARD
2010-09-23 23:38                           ` James Morris
2010-09-29 17:08                             ` Christophe Henri RICARD
2010-09-29 17:37                               ` Rajiv Andrade

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=1284483988.17585.0.camel@blackbox \
    --to=srajiv@linux.vnet.ibm.com \
    --cc=christophe-h.ricard@st.com \
    --cc=debora@linux.vnet.ibm.com \
    --cc=jmorris@namei.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.selhorst@sirrix.com \
    --cc=tpmdd-devel@lists.sourceforge.net \
    /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