Commit 87a573ad authored by Przemo Firszt's avatar Przemo Firszt Committed by Greg Kroah-Hartman
Browse files

rtl8712: replace printk with better solutions



Replace printk with netdev_printk helpers, dev_printk helpers or
pr_err/warn/info if there is no device info available.

Signed-off-by: default avatarPrzemo Firszt <przemo@firszt.eu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 94973b63
Loading
Loading
Loading
Loading
+9 −8
Original line number Original line Diff line number Diff line
@@ -49,7 +49,7 @@ static void rtl871x_load_fw_cb(const struct firmware *firmware, void *context)
	if (!firmware) {
	if (!firmware) {
		struct usb_device *udev = padapter->dvobjpriv.pusbdev;
		struct usb_device *udev = padapter->dvobjpriv.pusbdev;
		struct usb_interface *pusb_intf = padapter->pusb_intf;
		struct usb_interface *pusb_intf = padapter->pusb_intf;
		printk(KERN_ERR "r8712u: Firmware request failed\n");
		dev_err(&udev->dev, "r8712u: Firmware request failed\n");
		padapter->fw_found = false;
		padapter->fw_found = false;
		usb_put_dev(udev);
		usb_put_dev(udev);
		usb_set_intfdata(pusb_intf, NULL);
		usb_set_intfdata(pusb_intf, NULL);
@@ -69,12 +69,11 @@ int rtl871x_load_fw(struct _adapter *padapter)
	int rc;
	int rc;


	init_completion(&padapter->rtl8712_fw_ready);
	init_completion(&padapter->rtl8712_fw_ready);
	printk(KERN_INFO "r8712u: Loading firmware from \"%s\"\n",
	dev_info(dev, "r8712u: Loading firmware from \"%s\"\n", firmware_file);
	       firmware_file);
	rc = request_firmware_nowait(THIS_MODULE, 1, firmware_file, dev,
	rc = request_firmware_nowait(THIS_MODULE, 1, firmware_file, dev,
				     GFP_KERNEL, padapter, rtl871x_load_fw_cb);
				     GFP_KERNEL, padapter, rtl871x_load_fw_cb);
	if (rc)
	if (rc)
		printk(KERN_ERR "r8712u: Firmware request error %d\n", rc);
		dev_err(dev, "r8712u: Firmware request error %d\n", rc);
	return rc;
	return rc;
}
}
MODULE_FIRMWARE("rtlwifi/rtl8712u.bin");
MODULE_FIRMWARE("rtlwifi/rtl8712u.bin");
@@ -84,7 +83,7 @@ static u32 rtl871x_open_fw(struct _adapter *padapter, const u8 **ppmappedfw)
	const struct firmware **praw = &padapter->fw;
	const struct firmware **praw = &padapter->fw;


	if (padapter->fw->size > 200000) {
	if (padapter->fw->size > 200000) {
		printk(KERN_ERR "r8172u: Badfw->size of %d\n",
		dev_err(&padapter->pnetdev->dev, "r8172u: Badfw->size of %d\n",
			(int)padapter->fw->size);
			(int)padapter->fw->size);
		return 0;
		return 0;
	}
	}
@@ -334,11 +333,13 @@ uint rtl8712_hal_init(struct _adapter *padapter)
	if (rtl8712_dl_fw(padapter) != _SUCCESS)
	if (rtl8712_dl_fw(padapter) != _SUCCESS)
		return _FAIL;
		return _FAIL;


	printk(KERN_INFO "r8712u: 1 RCR=0x%x\n",  r8712_read32(padapter, RCR));
	netdev_info(padapter->pnetdev, "1 RCR=0x%x\n",
		    r8712_read32(padapter, RCR));
	val32 = r8712_read32(padapter, RCR);
	val32 = r8712_read32(padapter, RCR);
	r8712_write32(padapter, RCR, (val32 | BIT(26))); /* Enable RX TCP
	r8712_write32(padapter, RCR, (val32 | BIT(26))); /* Enable RX TCP
							    Checksum offload */
							    Checksum offload */
	printk(KERN_INFO "r8712u: 2 RCR=0x%x\n", r8712_read32(padapter, RCR));
	netdev_info(padapter->pnetdev, "2 RCR=0x%x\n",
		    r8712_read32(padapter, RCR));
	val32 = r8712_read32(padapter, RCR);
	val32 = r8712_read32(padapter, RCR);
	r8712_write32(padapter, RCR, (val32|BIT(25))); /* Append PHY status */
	r8712_write32(padapter, RCR, (val32|BIT(25))); /* Append PHY status */
	val32 = 0;
	val32 = 0;
+1 −2
Original line number Original line Diff line number Diff line
@@ -224,8 +224,7 @@ struct net_device *r8712_init_netdev(void)
	}
	}
	padapter = (struct _adapter *) netdev_priv(pnetdev);
	padapter = (struct _adapter *) netdev_priv(pnetdev);
	padapter->pnetdev = pnetdev;
	padapter->pnetdev = pnetdev;
	printk(KERN_INFO "r8712u: register rtl8712_netdev_ops to"
	pr_info("r8712u: register rtl8712_netdev_ops to netdev_ops\n");
	       " netdev_ops\n");
	pnetdev->netdev_ops = &rtl8712_netdev_ops;
	pnetdev->netdev_ops = &rtl8712_netdev_ops;
	pnetdev->watchdog_timeo = HZ; /* 1 second timeout */
	pnetdev->watchdog_timeo = HZ; /* 1 second timeout */
	pnetdev->wireless_handlers = (struct iw_handler_def *)
	pnetdev->wireless_handlers = (struct iw_handler_def *)
+6 −8
Original line number Original line Diff line number Diff line
@@ -115,11 +115,11 @@ void r8712_free_recv_priv(struct recv_priv *precvpriv)
	kfree(precvpriv->pallocated_recv_buf);
	kfree(precvpriv->pallocated_recv_buf);
	skb_queue_purge(&precvpriv->rx_skb_queue);
	skb_queue_purge(&precvpriv->rx_skb_queue);
	if (skb_queue_len(&precvpriv->rx_skb_queue))
	if (skb_queue_len(&precvpriv->rx_skb_queue))
		printk(KERN_WARNING "r8712u: rx_skb_queue not empty\n");
		netdev_warn(padapter->pnetdev, "r8712u: rx_skb_queue not empty\n");
	skb_queue_purge(&precvpriv->free_recv_skb_queue);
	skb_queue_purge(&precvpriv->free_recv_skb_queue);
	if (skb_queue_len(&precvpriv->free_recv_skb_queue))
	if (skb_queue_len(&precvpriv->free_recv_skb_queue))
		printk(KERN_WARNING "r8712u: free_recv_skb_queue not empty "
		netdev_warn(padapter->pnetdev, "r8712u: free_recv_skb_queue not empty %d\n",
		       "%d\n", skb_queue_len(&precvpriv->free_recv_skb_queue));
			    skb_queue_len(&precvpriv->free_recv_skb_queue));
}
}


int r8712_init_recvbuf(struct _adapter *padapter, struct recv_buf *precvbuf)
int r8712_init_recvbuf(struct _adapter *padapter, struct recv_buf *precvbuf)
@@ -364,8 +364,7 @@ static int amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe)
		nSubframe_Length = (nSubframe_Length >> 8) +
		nSubframe_Length = (nSubframe_Length >> 8) +
				   (nSubframe_Length << 8);
				   (nSubframe_Length << 8);
		if (a_len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) {
		if (a_len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) {
			printk(KERN_WARNING "r8712u: nRemain_Length is %d and"
			netdev_warn(padapter->pnetdev, "r8712u: nRemain_Length is %d and nSubframe_Length is: %d\n",
			    " nSubframe_Length is: %d\n",
				    a_len, nSubframe_Length);
				    a_len, nSubframe_Length);
			goto exit;
			goto exit;
		}
		}
@@ -381,8 +380,7 @@ static int amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe)
		memcpy(data_ptr, pdata, nSubframe_Length);
		memcpy(data_ptr, pdata, nSubframe_Length);
		subframes[nr_subframes++] = sub_skb;
		subframes[nr_subframes++] = sub_skb;
		if (nr_subframes >= MAX_SUBFRAME_COUNT) {
		if (nr_subframes >= MAX_SUBFRAME_COUNT) {
			printk(KERN_WARNING "r8712u: ParseSubframe(): Too"
			netdev_warn(padapter->pnetdev, "r8712u: ParseSubframe(): Too many Subframes! Packets dropped!\n");
			    " many Subframes! Packets dropped!\n");
			break;
			break;
		}
		}
		pdata += nSubframe_Length;
		pdata += nSubframe_Length;
+22 −30
Original line number Original line Diff line number Diff line
@@ -415,8 +415,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
	} else
	} else
		return -EINVAL;
		return -EINVAL;
	if (strcmp(param->u.crypt.alg, "WEP") == 0) {
	if (strcmp(param->u.crypt.alg, "WEP") == 0) {
		printk(KERN_INFO "r8712u: wpa_set_encryption, crypt.alg ="
		netdev_info(dev, "r8712u: %s: crypt.alg = WEP\n", __func__);
		       " WEP\n");
		padapter->securitypriv.ndisencryptstatus =
		padapter->securitypriv.ndisencryptstatus =
			     Ndis802_11Encryption1Enabled;
			     Ndis802_11Encryption1Enabled;
		padapter->securitypriv.PrivacyAlgrthm = _WEP40_;
		padapter->securitypriv.PrivacyAlgrthm = _WEP40_;
@@ -608,8 +607,7 @@ static int r871x_set_wpa_ie(struct _adapter *padapter, char *pie,


				if ((eid == _VENDOR_SPECIFIC_IE_) &&
				if ((eid == _VENDOR_SPECIFIC_IE_) &&
				    (!memcmp(&buf[cnt+2], wps_oui, 4))) {
				    (!memcmp(&buf[cnt+2], wps_oui, 4))) {
					printk(KERN_INFO "r8712u: "
					netdev_info(padapter->pnetdev, "r8712u: SET WPS_IE\n");
					       "SET WPS_IE\n");
					padapter->securitypriv.wps_ie_len =
					padapter->securitypriv.wps_ie_len =
					    ((buf[cnt+1] + 2) <
					    ((buf[cnt+1] + 2) <
					    (MAX_WPA_IE_LEN << 2)) ?
					    (MAX_WPA_IE_LEN << 2)) ?
@@ -620,8 +618,7 @@ static int r871x_set_wpa_ie(struct _adapter *padapter, char *pie,
					    padapter->securitypriv.wps_ie_len);
					    padapter->securitypriv.wps_ie_len);
					padapter->securitypriv.wps_phase =
					padapter->securitypriv.wps_phase =
								 true;
								 true;
					printk(KERN_INFO "r8712u: SET WPS_IE,"
					netdev_info(padapter->pnetdev, "r8712u: SET WPS_IE, wps_phase==true\n");
					    " wps_phase==true\n");
					cnt += buf[cnt+1]+2;
					cnt += buf[cnt+1]+2;
					break;
					break;
				} else
				} else
@@ -829,8 +826,8 @@ static int r871x_wx_set_pmkid(struct net_device *dev,
			    strIssueBssid, ETH_ALEN)) {
			    strIssueBssid, ETH_ALEN)) {
				/* BSSID is matched, the same AP => rewrite
				/* BSSID is matched, the same AP => rewrite
				 * with new PMKID. */
				 * with new PMKID. */
				printk(KERN_INFO "r8712u: r871x_wx_set_pmkid:"
				netdev_info(dev, "r8712u: %s: BSSID exists in the PMKList.\n",
				    " BSSID exists in the PMKList.\n");
					    __func__);
				memcpy(psecuritypriv->PMKIDList[j].PMKID,
				memcpy(psecuritypriv->PMKIDList[j].PMKID,
					pPMK->pmkid, IW_PMKID_LEN);
					pPMK->pmkid, IW_PMKID_LEN);
				psecuritypriv->PMKIDList[j].bUsed = true;
				psecuritypriv->PMKIDList[j].bUsed = true;
@@ -841,9 +838,8 @@ static int r871x_wx_set_pmkid(struct net_device *dev,
		}
		}
		if (!blInserted) {
		if (!blInserted) {
			/* Find a new entry */
			/* Find a new entry */
			printk(KERN_INFO "r8712u: r871x_wx_set_pmkid: Use the"
			netdev_info(dev, "r8712u: %s: Use the new entry index = %d for this PMKID.\n",
			    " new entry index = %d for this PMKID.\n",
				    __func__, psecuritypriv->PMKIDIndex);
			    psecuritypriv->PMKIDIndex);
			memcpy(psecuritypriv->PMKIDList[psecuritypriv->
			memcpy(psecuritypriv->PMKIDList[psecuritypriv->
				PMKIDIndex].Bssid, strIssueBssid, ETH_ALEN);
				PMKIDIndex].Bssid, strIssueBssid, ETH_ALEN);
			memcpy(psecuritypriv->PMKIDList[psecuritypriv->
			memcpy(psecuritypriv->PMKIDList[psecuritypriv->
@@ -876,8 +872,7 @@ static int r871x_wx_set_pmkid(struct net_device *dev,
		intReturn = true;
		intReturn = true;
		break;
		break;
	default:
	default:
		printk(KERN_INFO "r8712u: r871x_wx_set_pmkid: "
		netdev_info(dev, "r8712u: %s: unknown Command\n", __func__);
		       "unknown Command\n");
		intReturn = false;
		intReturn = false;
		break;
		break;
	}
	}
@@ -1045,8 +1040,8 @@ static int r871x_wx_set_priv(struct net_device *dev,
		);
		);
		sprintf(ext, "OK");
		sprintf(ext, "OK");
	} else {
	} else {
		printk(KERN_INFO "r8712u: r871x_wx_set_priv: unknown Command"
		netdev_info(dev, "r8712u: %s: unknown Command %s.\n",
		       " %s.\n", ext);
			    __func__, ext);
		goto FREE_EXT;
		goto FREE_EXT;
	}
	}
	if (copy_to_user(dwrq->pointer, ext,
	if (copy_to_user(dwrq->pointer, ext,
@@ -1183,8 +1178,8 @@ static int r8711_wx_set_scan(struct net_device *dev,
	u8 status = true;
	u8 status = true;


	if (padapter->bDriverStopped == true) {
	if (padapter->bDriverStopped == true) {
		printk(KERN_WARNING "r8712u: in r8711_wx_set_scan: "
		netdev_info(dev, "In %s: bDriverStopped=%d\n",
		    "bDriverStopped=%d\n", padapter->bDriverStopped);
			    __func__, padapter->bDriverStopped);
		return -1;
		return -1;
	}
	}
	if (padapter->bup == false)
	if (padapter->bup == false)
@@ -1556,8 +1551,7 @@ static int r8711_wx_set_enc(struct net_device *dev,
	key = erq->flags & IW_ENCODE_INDEX;
	key = erq->flags & IW_ENCODE_INDEX;
	memset(&wep, 0, sizeof(struct NDIS_802_11_WEP));
	memset(&wep, 0, sizeof(struct NDIS_802_11_WEP));
	if (erq->flags & IW_ENCODE_DISABLED) {
	if (erq->flags & IW_ENCODE_DISABLED) {
		printk(KERN_INFO "r8712u: r8711_wx_set_enc: "
		netdev_info(dev, "r8712u: %s: EncryptionDisabled\n", __func__);
		       "EncryptionDisabled\n");
		padapter->securitypriv.ndisencryptstatus =
		padapter->securitypriv.ndisencryptstatus =
				 Ndis802_11EncryptionDisabled;
				 Ndis802_11EncryptionDisabled;
		padapter->securitypriv.PrivacyAlgrthm = _NO_PRIVACY_;
		padapter->securitypriv.PrivacyAlgrthm = _NO_PRIVACY_;
@@ -1578,8 +1572,7 @@ static int r8711_wx_set_enc(struct net_device *dev,
	}
	}
	/* set authentication mode */
	/* set authentication mode */
	if (erq->flags & IW_ENCODE_OPEN) {
	if (erq->flags & IW_ENCODE_OPEN) {
		printk(KERN_INFO "r8712u: r8711_wx_set_enc: "
		netdev_info(dev, "r8712u: %s: IW_ENCODE_OPEN\n", __func__);
		       "IW_ENCODE_OPEN\n");
		padapter->securitypriv.ndisencryptstatus =
		padapter->securitypriv.ndisencryptstatus =
				 Ndis802_11Encryption1Enabled;
				 Ndis802_11Encryption1Enabled;
		padapter->securitypriv.AuthAlgrthm = 0; /* open system */
		padapter->securitypriv.AuthAlgrthm = 0; /* open system */
@@ -1588,8 +1581,7 @@ static int r8711_wx_set_enc(struct net_device *dev,
		authmode = Ndis802_11AuthModeOpen;
		authmode = Ndis802_11AuthModeOpen;
		padapter->securitypriv.ndisauthtype = authmode;
		padapter->securitypriv.ndisauthtype = authmode;
	} else if (erq->flags & IW_ENCODE_RESTRICTED) {
	} else if (erq->flags & IW_ENCODE_RESTRICTED) {
		printk(KERN_INFO "r8712u: r8711_wx_set_enc: "
		netdev_info(dev, "r8712u: %s: IW_ENCODE_RESTRICTED\n", __func__);
		       "IW_ENCODE_RESTRICTED\n");
		padapter->securitypriv.ndisencryptstatus =
		padapter->securitypriv.ndisencryptstatus =
				 Ndis802_11Encryption1Enabled;
				 Ndis802_11Encryption1Enabled;
		padapter->securitypriv.AuthAlgrthm = 1; /* shared system */
		padapter->securitypriv.AuthAlgrthm = 1; /* shared system */
@@ -1977,9 +1969,9 @@ static int r871x_mp_ioctl_hdl(struct net_device *dev,
		status = phandler->handler(&oid_par);
		status = phandler->handler(&oid_par);
		/* todo:check status, BytesNeeded, etc. */
		/* todo:check status, BytesNeeded, etc. */
	} else {
	} else {
		printk(KERN_INFO "r8712u: r871x_mp_ioctl_hdl(): err!,"
		netdev_info(dev, "r8712u: %s: err!, subcode=%d, oid=%d, handler=%p\n",
		    " subcode=%d, oid=%d, handler=%p\n",
			    __func__, poidparam->subcode, phandler->oid,
		    poidparam->subcode, phandler->oid, phandler->handler);
			    phandler->handler);
		ret = -EFAULT;
		ret = -EFAULT;
		goto _r871x_mp_ioctl_hdl_exit;
		goto _r871x_mp_ioctl_hdl_exit;
	}
	}
@@ -2034,13 +2026,13 @@ static int r871x_get_ap_info(struct net_device *dev,
			break;
			break;
		pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
		pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
		if (hwaddr_aton_i(data, bssid)) {
		if (hwaddr_aton_i(data, bssid)) {
			printk(KERN_INFO "r8712u: Invalid BSSID '%s'.\n",
			netdev_info(dev, "r8712u: Invalid BSSID '%s'.\n",
				    (u8 *)data);
				    (u8 *)data);
			spin_unlock_irqrestore(&(pmlmepriv->scanned_queue.lock),
			spin_unlock_irqrestore(&(pmlmepriv->scanned_queue.lock),
					       irqL);
					       irqL);
			return -EINVAL;
			return -EINVAL;
		}
		}
		printk(KERN_INFO "r8712u: BSSID:%pM\n", bssid);
		netdev_info(dev, "r8712u: BSSID:%pM\n", bssid);
		if (!memcmp(bssid, pnetwork->network.MacAddress, ETH_ALEN)) {
		if (!memcmp(bssid, pnetwork->network.MacAddress, ETH_ALEN)) {
			/* BSSID match, then check if supporting wpa/wpa2 */
			/* BSSID match, then check if supporting wpa/wpa2 */
			pbuf = r8712_get_wpa_ie(&pnetwork->network.IEs[12],
			pbuf = r8712_get_wpa_ie(&pnetwork->network.IEs[12],
+2 −2
Original line number Original line Diff line number Diff line
@@ -1043,7 +1043,7 @@ void r8712_got_addbareq_event_callback(struct _adapter *adapter, u8 *pbuf)
	struct	sta_priv *pstapriv = &adapter->stapriv;
	struct	sta_priv *pstapriv = &adapter->stapriv;
	struct	recv_reorder_ctrl *precvreorder_ctrl = NULL;
	struct	recv_reorder_ctrl *precvreorder_ctrl = NULL;


	printk(KERN_INFO "r8712u: [%s] mac = %pM, seq = %d, tid = %d\n",
	netdev_info(adapter->pnetdev, "%s: mac = %pM, seq = %d, tid = %d\n",
		    __func__, pAddbareq_pram->MacAddress,
		    __func__, pAddbareq_pram->MacAddress,
	    pAddbareq_pram->StartSeqNum, pAddbareq_pram->tid);
	    pAddbareq_pram->StartSeqNum, pAddbareq_pram->tid);
	psta = r8712_get_stainfo(pstapriv, pAddbareq_pram->MacAddress);
	psta = r8712_get_stainfo(pstapriv, pAddbareq_pram->MacAddress);
Loading