[PATCH 3/5] rtl8712: replace printk with better solutions

Joe Perches joe at perches.com
Sun Dec 9 11:47:30 UTC 2012


On Sun, 2012-12-09 at 10:15 +0000, Przemo Firszt wrote:
> Replace printk with netdev_printk helpers, dev_printk helpers or
> pr_err/warn/info if there is no device info available.

Here's a few trivial comments

> @@ -84,8 +83,8 @@ static u32 rtl871x_open_fw(struct _adapter *padapter, const u8 **ppmappedfw)
>  	const struct firmware **praw = &padapter->fw;
>  
>  	if (padapter->fw->size > 200000) {
> -		printk(KERN_ERR "r8172u: Badfw->size of %d\n",
> -		       (int)padapter->fw->size);
> +		dev_err(&padapter->pnetdev->dev, "r8172u: Badfw->size of %d\n",
> +			       (int)padapter->fw->size);

Please align arguments to the open parenthesis
like this:

		dev_err(dev, format,
			args);

If you are using checkpatch, add --strict to get the
script to tell you when the alignment isn't correct.

> diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
[]
> @@ -829,8 +826,7 @@ static int r871x_wx_set_pmkid(struct net_device *dev,
>  			    strIssueBssid, ETH_ALEN)) {
>  				/* BSSID is matched, the same AP => rewrite
>  				 * with new PMKID. */
> -				printk(KERN_INFO "r8712u: r871x_wx_set_pmkid:"
> -				    " BSSID exists in the PMKList.\n");
> +				netdev_info(dev, "r8712u: r871x_wx_set_pmkid: BSSID exists in the PMKList.\n");

when the format contains the function name, convert
it to use %s, ... __func__
Remove unnecessary trailing periods from the formats.

				netdev_info(dev, "%s: BSSID exists in the PMKList\n",
					    __func__);

> diff --git a/drivers/staging/rtl8712/usb_ops_linux.c b/drivers/staging/rtl8712/usb_ops_linux.c
[]
> @@ -243,8 +243,7 @@ static void r8712_usb_read_port_complete(struct urb *purb)
>  				  (unsigned char *)precvbuf);
>  			break;
>  		case -EINPROGRESS:
> -			printk(KERN_ERR "r8712u: ERROR: URB IS IN"
> -			       " PROGRESS!/n");
> +			netdev_err(padapter->pnetdev, "ERROR: URB IS IN PROGRESS!/n");

newlines are \n not /n

> diff --git a/drivers/staging/rtl8712/xmit_linux.c b/drivers/staging/rtl8712/xmit_linux.c
[]
> @@ -134,8 +134,7 @@ int r8712_xmit_resource_alloc(struct _adapter *padapter,
>  	for (i = 0; i < 8; i++) {
>  		pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
>  		if (pxmitbuf->pxmit_urb[i] == NULL) {
> -			printk(KERN_ERR "r8712u: pxmitbuf->pxmit_urb[i]"
> -			    " == NULL");
> +			netdev_err(padapter->pnetdev, "pxmitbuf->pxmit_urb[i] == NULL");

Make sure message formats are newline terminated.




More information about the devel mailing list