[2/5] usb: gadget: s3c2410_udc: Use pr_* functions

Message ID 1345614199-12181-3-git-send-email-sachin.kamat@linaro.org
State Superseded
Headers show

Commit Message

Sachin Kamat Aug. 22, 2012, 5:43 a.m.
Replace printk with corresponding pr_* functions.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/usb/gadget/s3c2410_udc.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

Comments

Kishon Vijay Abraham I Aug. 22, 2012, 6:13 a.m. | #1
Hi,

On Wed, Aug 22, 2012 at 11:13 AM, Sachin Kamat <sachin.kamat@linaro.org> wrote:
> Replace printk with corresponding pr_* functions.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/usb/gadget/s3c2410_udc.c |   12 +++++++-----
>  1 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
> index 7acecc0..7e2ce44 100644
> --- a/drivers/usb/gadget/s3c2410_udc.c
> +++ b/drivers/usb/gadget/s3c2410_udc.c
> @@ -12,6 +12,8 @@
>   * (at your option) any later version.
>   */
>
> +#define pr_fmt(fmt) "s3c2410_udc: " fmt
> +

Is this a stray change? I dont see pr_fmt being used anywhere in this patch..

Thanks
Kishon
Felipe Balbi Aug. 22, 2012, 6:18 a.m. | #2
Hi,

On Wed, Aug 22, 2012 at 11:13:16AM +0530, Sachin Kamat wrote:
> Replace printk with corresponding pr_* functions.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/usb/gadget/s3c2410_udc.c |   12 +++++++-----
>  1 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
> index 7acecc0..7e2ce44 100644
> --- a/drivers/usb/gadget/s3c2410_udc.c
> +++ b/drivers/usb/gadget/s3c2410_udc.c
> @@ -12,6 +12,8 @@
>   * (at your option) any later version.
>   */
>  
> +#define pr_fmt(fmt) "s3c2410_udc: " fmt
> +
>  #include <linux/module.h>
>  #include <linux/kernel.h>
>  #include <linux/delay.h>
> @@ -115,7 +117,7 @@ static int dprintk(int level, const char *fmt, ...)
>  			sizeof(printk_buf)-len, fmt, args);
>  	va_end(args);
>  
> -	return printk(KERN_DEBUG "%s", printk_buf);
> +	return pr_debug("%s", printk_buf);
>  }
>  #else
>  static int dprintk(int level, const char *fmt, ...)
> @@ -1683,13 +1685,13 @@ static int s3c2410_udc_start(struct usb_gadget_driver *driver,
>  		return -EBUSY;
>  
>  	if (!bind || !driver->setup || driver->max_speed < USB_SPEED_FULL) {
> -		printk(KERN_ERR "Invalid driver: bind %p setup %p speed %d\n",
> +		pr_err("Invalid driver: bind %p setup %p speed %d\n",
>  			bind, driver->setup, driver->max_speed);

you have access to a struct device *. Please use dev_* instead.
Sachin Kamat Aug. 22, 2012, 6:20 a.m. | #3
On 22 August 2012 11:43, ABRAHAM, KISHON VIJAY <kishon@ti.com> wrote:
> Hi,
>
> On Wed, Aug 22, 2012 at 11:13 AM, Sachin Kamat <sachin.kamat@linaro.org> wrote:
>> Replace printk with corresponding pr_* functions.
>>
>> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
>> ---
>>  drivers/usb/gadget/s3c2410_udc.c |   12 +++++++-----
>>  1 files changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
>> index 7acecc0..7e2ce44 100644
>> --- a/drivers/usb/gadget/s3c2410_udc.c
>> +++ b/drivers/usb/gadget/s3c2410_udc.c
>> @@ -12,6 +12,8 @@
>>   * (at your option) any later version.
>>   */
>>
>> +#define pr_fmt(fmt) "s3c2410_udc: " fmt
>> +
>
> Is this a stray change? I dont see pr_fmt being used anywhere in this patch..

No.
pr_fmt prepends the string (in the above case "s3c2410_udc: ") to the
fmt string provided by other pr_* functions.
For example,
if i have pr_err("error") in this file,
then the output will be: s3c2410_udc: error

Hope I was able to clarify your doubt.

>
> Thanks
> Kishon
Kishon Vijay Abraham I Aug. 22, 2012, 6:28 a.m. | #4
On Wed, Aug 22, 2012 at 11:50 AM, Sachin Kamat <sachin.kamat@linaro.org> wrote:
> On 22 August 2012 11:43, ABRAHAM, KISHON VIJAY <kishon@ti.com> wrote:
>> Hi,
>>
>> On Wed, Aug 22, 2012 at 11:13 AM, Sachin Kamat <sachin.kamat@linaro.org> wrote:
>>> Replace printk with corresponding pr_* functions.
>>>
>>> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
>>> ---
>>>  drivers/usb/gadget/s3c2410_udc.c |   12 +++++++-----
>>>  1 files changed, 7 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
>>> index 7acecc0..7e2ce44 100644
>>> --- a/drivers/usb/gadget/s3c2410_udc.c
>>> +++ b/drivers/usb/gadget/s3c2410_udc.c
>>> @@ -12,6 +12,8 @@
>>>   * (at your option) any later version.
>>>   */
>>>
>>> +#define pr_fmt(fmt) "s3c2410_udc: " fmt
>>> +
>>
>> Is this a stray change? I dont see pr_fmt being used anywhere in this patch..
>
> No.
> pr_fmt prepends the string (in the above case "s3c2410_udc: ") to the
> fmt string provided by other pr_* functions.
> For example,
> if i have pr_err("error") in this file,
> then the output will be: s3c2410_udc: error

Ah.. got it..

Thanks
Kishon
Sachin Kamat Aug. 22, 2012, 9:58 a.m. | #5
On 22 August 2012 11:48, Felipe Balbi <balbi@ti.com> wrote:
> Hi,
>
> On Wed, Aug 22, 2012 at 11:13:16AM +0530, Sachin Kamat wrote:
>> Replace printk with corresponding pr_* functions.
>>
>> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
>> ---
>>  drivers/usb/gadget/s3c2410_udc.c |   12 +++++++-----
>>  1 files changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
>> index 7acecc0..7e2ce44 100644
>> --- a/drivers/usb/gadget/s3c2410_udc.c
>> +++ b/drivers/usb/gadget/s3c2410_udc.c
>> @@ -12,6 +12,8 @@
>>   * (at your option) any later version.
>>   */
>>
>> +#define pr_fmt(fmt) "s3c2410_udc: " fmt
>> +
>>  #include <linux/module.h>
>>  #include <linux/kernel.h>
>>  #include <linux/delay.h>
>> @@ -115,7 +117,7 @@ static int dprintk(int level, const char *fmt, ...)
>>                       sizeof(printk_buf)-len, fmt, args);
>>       va_end(args);
>>
>> -     return printk(KERN_DEBUG "%s", printk_buf);
>> +     return pr_debug("%s", printk_buf);
>>  }
>>  #else
>>  static int dprintk(int level, const char *fmt, ...)
>> @@ -1683,13 +1685,13 @@ static int s3c2410_udc_start(struct usb_gadget_driver *driver,
>>               return -EBUSY;
>>
>>       if (!bind || !driver->setup || driver->max_speed < USB_SPEED_FULL) {
>> -             printk(KERN_ERR "Invalid driver: bind %p setup %p speed %d\n",
>> +             pr_err("Invalid driver: bind %p setup %p speed %d\n",
>>                       bind, driver->setup, driver->max_speed);
>
> you have access to a struct device *. Please use dev_* instead.

Ok. I will re-send this one after changing to dev_err.


>
> --
> balbi

Patch

diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
index 7acecc0..7e2ce44 100644
--- a/drivers/usb/gadget/s3c2410_udc.c
+++ b/drivers/usb/gadget/s3c2410_udc.c
@@ -12,6 +12,8 @@ 
  * (at your option) any later version.
  */
 
+#define pr_fmt(fmt) "s3c2410_udc: " fmt
+
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
@@ -115,7 +117,7 @@  static int dprintk(int level, const char *fmt, ...)
 			sizeof(printk_buf)-len, fmt, args);
 	va_end(args);
 
-	return printk(KERN_DEBUG "%s", printk_buf);
+	return pr_debug("%s", printk_buf);
 }
 #else
 static int dprintk(int level, const char *fmt, ...)
@@ -1683,13 +1685,13 @@  static int s3c2410_udc_start(struct usb_gadget_driver *driver,
 		return -EBUSY;
 
 	if (!bind || !driver->setup || driver->max_speed < USB_SPEED_FULL) {
-		printk(KERN_ERR "Invalid driver: bind %p setup %p speed %d\n",
+		pr_err("Invalid driver: bind %p setup %p speed %d\n",
 			bind, driver->setup, driver->max_speed);
 		return -EINVAL;
 	}
 #if defined(MODULE)
 	if (!driver->unbind) {
-		printk(KERN_ERR "Invalid driver: no unbind method\n");
+		pr_err("Invalid driver: no unbind method\n");
 		return -EINVAL;
 	}
 #endif
@@ -1700,7 +1702,7 @@  static int s3c2410_udc_start(struct usb_gadget_driver *driver,
 
 	/* Bind the driver */
 	if ((retval = device_add(&udc->gadget.dev)) != 0) {
-		printk(KERN_ERR "Error in device_add() : %d\n",retval);
+		pr_err("Error in device_add() : %d\n",retval);
 		goto register_error;
 	}
 
@@ -2073,7 +2075,7 @@  static int __init udc_init(void)
 
 	s3c2410_udc_debugfs_root = debugfs_create_dir(gadget_name, NULL);
 	if (IS_ERR(s3c2410_udc_debugfs_root)) {
-		printk(KERN_ERR "%s: debugfs dir creation failed %ld\n",
+		pr_err("%s: debugfs dir creation failed %ld\n",
 			gadget_name, PTR_ERR(s3c2410_udc_debugfs_root));
 		s3c2410_udc_debugfs_root = NULL;
 	}