Re: [PATCH] Staging: wlan-ng: improved code in p80211req.c file
From: Greg KH
Date: Sun Aug 21 2016 - 17:26:25 EST
On Sat, Aug 20, 2016 at 06:20:00PM +0300, Claudiu Beznea wrote:
> This patch improves code from p80211req.c file by removing
> duplicate code, by keeping count of returning code of
> the called functions and also aesthetically.
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea@xxxxxxxxx>
> ---
> drivers/staging/wlan-ng/p80211req.c | 163 +++++++++++++++++++-----------------
> 1 file changed, 84 insertions(+), 79 deletions(-)
>
> diff --git a/drivers/staging/wlan-ng/p80211req.c b/drivers/staging/wlan-ng/p80211req.c
> index 4b84b56..900635e 100644
> --- a/drivers/staging/wlan-ng/p80211req.c
> +++ b/drivers/staging/wlan-ng/p80211req.c
> @@ -72,10 +72,12 @@
> #include "p80211metastruct.h"
> #include "p80211req.h"
>
> -static void p80211req_handlemsg(wlandevice_t *wlandev, struct p80211msg *msg);
> -static void p80211req_mibset_mibget(wlandevice_t *wlandev,
> +static int p80211req_handlemsg(wlandevice_t *wlandev, struct p80211msg *msg);
> +static int p80211req_mibset_mibget(wlandevice_t *wlandev,
> struct p80211msg_dot11req_mibget *mib_msg,
> int isget);
> +static void p80211req_handle_action(struct wlandevice *wlandev, u32 *data,
> + int isget, u32 flag);
>
> /*----------------------------------------------------------------
> * p80211req_dorequest
> @@ -96,6 +98,7 @@ static void p80211req_mibset_mibget(wlandevice_t *wlandev,
> int p80211req_dorequest(wlandevice_t *wlandev, u8 *msgbuf)
> {
> struct p80211msg *msg = (struct p80211msg *) msgbuf;
> + int rc = 0;
>
> /* Check to make sure the MSD is running */
> if (!((wlandev->msdstate == WLAN_MSD_HWPRESENT &&
> @@ -107,7 +110,7 @@ int p80211req_dorequest(wlandevice_t *wlandev, u8 *msgbuf)
>
> /* Check Permissions */
> if (!capable(CAP_NET_ADMIN) &&
> - (msg->msgcode != DIDmsg_dot11req_mibget)) {
> + (msg->msgcode != DIDmsg_dot11req_mibget)) {
> netdev_err(wlandev->netdev,
This is a fine change, but you are trying to do too many different
things in this patch.
Remember, only do one type of thing per patch please.
thanks,
greg k-h