Re: [PATCH v3 20/33] staging: rtl8192e: Fix PREFER_PR_LEVEL warnings

Joe Perches
2015-05-09T22:38:01Z

On Sat, 2015-05-09 at 23:19 +0200, Mateusz Kulikowski wrote:
> Fix most of remaining PREFER_PR_LEVEL warnings in rtllib.
> Replace printk() with netdev_* if possible, pr_* in other cases.
> All pr_* use __func__ to easily trace message back to rtllib

It's more common to use %s: and not %s():
but it's generally even better not to use these
at all and use dynamic_debug to add the function
name when desired.

> diff --git a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c
[]
> @@ -69,7 +69,7 @@ static void *rtllib_ccmp_init(int key_idx)
>
> priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
> if (IS_ERR(priv->tfm)) {
> - pr_debug("rtllib_crypt_ccmp: could not allocate crypto API aes\n");
> + pr_debug("%s(): could not allocate crypto API aes\n", __func__);
> priv->tfm = NULL;
> goto fail;
> }

> diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
[]
> @@ -630,12 +623,10 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx,
> struct rtllib_hdr_4addr *hdr;
>
> hdr = (struct rtllib_hdr_4addr *) skb->data;
> - printk(KERN_DEBUG
> - "%s: Michael MIC verification failed for MSDU from %pM keyidx=%d\n",
> - skb->dev ? skb->dev->name : "N/A", hdr->addr2,
> - keyidx);
> - printk(KERN_DEBUG "%d\n",
> - memcmp(mic, skb->data + skb->len - 8, 8) != 0);
> + pr_debug("%s: Michael MIC verification failed for MSDU from %pM keyidx=%d\n",
> + skb->dev ? skb->dev->name : "N/A", hdr->addr2,
> + keyidx);

Not that it's necessary, but are this and below
missing __func__?

> diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
[]
> @@ -346,8 +346,9 @@ rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb,
> res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
> atomic_dec(&crypt->refcnt);
> if (res < 0) {
> - printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed (SA= %pM keyidx=%d)\n",
> - ieee->dev->name, hdr->addr2, keyidx);
> + netdev_dbg(ieee->dev,
> + "MSDU decryption/MIC verification failed (SA= %pM keyidx=%d)\n",
> + hdr->addr2, keyidx);
> return -1;
> }
>