All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: wilc1000: Fix line over 80 characters
@ 2017-08-03 22:00 Himanshu Jha
  2017-08-04  8:14 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Himanshu Jha @ 2017-08-03 22:00 UTC (permalink / raw)
  To: gregkh; +Cc: aditya.shankar, linux-kernel, linux-wireless, Himanshu Jha

This patch fixes 80 characters limit coding style issue.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index dbb3e24..5dab2cd 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1087,7 +1087,8 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
 
 				snprintf(buff, size, "rssi %d", rssi);
 
-				if (copy_to_user(wrq->u.data.pointer, buff, size)) {
+				if (copy_to_user(wrq->u.data.pointer, buff,
+							size)) {
 					netdev_err(ndev, "failed to copy\n");
 					ret = -EFAULT;
 					goto done;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Staging: wilc1000: Fix line over 80 characters
  2017-08-03 22:00 [PATCH] Staging: wilc1000: Fix line over 80 characters Himanshu Jha
@ 2017-08-04  8:14 ` Joe Perches
  0 siblings, 0 replies; 3+ messages in thread
From: Joe Perches @ 2017-08-04  8:14 UTC (permalink / raw)
  To: Himanshu Jha, gregkh; +Cc: aditya.shankar, linux-kernel, linux-wireless

On Fri, 2017-08-04 at 03:30 +0530, Himanshu Jha wrote:
> This patch fixes 80 characters limit coding style issue.
> 
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
> ---
>  drivers/staging/wilc1000/linux_wlan.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
> index dbb3e24..5dab2cd 100644
> --- a/drivers/staging/wilc1000/linux_wlan.c
> +++ b/drivers/staging/wilc1000/linux_wlan.c
> @@ -1087,7 +1087,8 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
>  
>  				snprintf(buff, size, "rssi %d", rssi);
>  
> -				if (copy_to_user(wrq->u.data.pointer, buff, size)) {
> +				if (copy_to_user(wrq->u.data.pointer, buff,
> +							size)) {
>  					netdev_err(ndev, "failed to copy\n");
>  					ret = -EFAULT;
>  					goto done;

Rather than just shut-up checkpatch, please try
to improve the code.

For instance, this function could be rewritten as:
---
 drivers/staging/wilc1000/linux_wlan.c | 51 +++++++++++++++--------------------
 1 file changed, 21 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index 119f3459b5bb..0d8371f76015 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1054,60 +1054,51 @@ static int wilc_mac_close(struct net_device *ndev)
 
 static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
 {
-	u8 *buff = NULL;
-	s8 rssi;
-	u32 size = 0;
-	struct wilc_vif *vif;
 	s32 ret = 0;
-	struct wilc *wilc;
-
-	vif = netdev_priv(ndev);
-	wilc = vif->wilc;
+	u8 *buff = NULL;
+	struct wilc_vif *vif = netdev_priv(ndev);
+	struct wilc *wilc = vif->wilc;
 
 	if (!wilc->initialized)
 		return 0;
 
 	switch (cmd) {
-	case SIOCSIWPRIV:
-	{
+	case SIOCSIWPRIV: {
 		struct iwreq *wrq = (struct iwreq *)req;
+		struct iw_point *data = &wrq->u.data;
+		u32 size = data->length;
 
-		size = wrq->u.data.length;
+		if (size && data->pointer) {
+			s8 rssi;
 
-		if (size && wrq->u.data.pointer) {
-			buff = memdup_user(wrq->u.data.pointer,
-					   wrq->u.data.length);
+			buff = memdup_user(data->pointer, data->length);
 			if (IS_ERR(buff))
 				return PTR_ERR(buff);
 
-			if (strncasecmp(buff, "RSSI", size) == 0) {
-				ret = wilc_get_rssi(vif, &rssi);
-				netdev_info(ndev, "RSSI :%d\n", rssi);
+			if (strncasecmp(buff, "RSSI", size) != 0)
+				break;
+
+			ret = wilc_get_rssi(vif, &rssi);
+			netdev_info(ndev, "RSSI: %d\n", rssi);
 
-				rssi += 5;
+			rssi += 5;
 
-				snprintf(buff, size, "rssi %d", rssi);
+			snprintf(buff, size, "rssi %d", rssi);
 
-				if (copy_to_user(wrq->u.data.pointer, buff, size)) {
-					netdev_err(ndev, "failed to copy\n");
-					ret = -EFAULT;
-					goto done;
-				}
+			if (copy_to_user(data->pointer, buff, size)) {
+				netdev_err(ndev, "failed to copy\n");
+				ret = -EFAULT;
 			}
 		}
+		break;
 	}
-	break;
 
 	default:
-	{
 		netdev_info(ndev, "Command - %d - has been received\n", cmd);
 		ret = -EOPNOTSUPP;
-		goto done;
-	}
+		break;
 	}
 
-done:
-
 	kfree(buff);
 
 	return ret;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] Staging: wilc1000: Fix line over 80 characters
@ 2019-03-04 14:55 Debleena Sen
  0 siblings, 0 replies; 3+ messages in thread
From: Debleena Sen @ 2019-03-04 14:55 UTC (permalink / raw)
  To: gregkh, outreachy-kernel; +Cc: Debleena Sen

Break the line after '+' to remove the checkpatch.pl warning. Remove
trailing whitespace after '+' if any:
WARNING: line over 80 characters

Signed-off-by: Debleena Sen <idebleenasen@gmail.com>
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 5e7a467..75ec752 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1253,7 +1253,8 @@ static int mgmt_tx(struct wiphy *wiphy,
 	struct wilc_priv *priv = wiphy_priv(wiphy);
 	struct host_if_drv *wfi_drv = priv->hif_drv;
 	struct wilc_vif *vif = netdev_priv(wdev->netdev);
-	u32 buf_len = len + sizeof(p2p_vendor_spec) + sizeof(priv->p2p.local_random);
+	u32 buf_len = len + sizeof(p2p_vendor_spec) +
+			sizeof(priv->p2p.local_random);
 	int ret = 0;
 
 	*cookie = prandom_u32();
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-04 14:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-03 22:00 [PATCH] Staging: wilc1000: Fix line over 80 characters Himanshu Jha
2017-08-04  8:14 ` Joe Perches
2019-03-04 14:55 Debleena Sen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.