From patchwork Fri Mar 2 14:17:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10254765 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6416C602B5 for ; Fri, 2 Mar 2018 14:18:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 549C8288CD for ; Fri, 2 Mar 2018 14:18:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49429288FC; Fri, 2 Mar 2018 14:18:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D608C288CD for ; Fri, 2 Mar 2018 14:18:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1428587AbeCBOSA (ORCPT ); Fri, 2 Mar 2018 09:18:00 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:57423 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1428567AbeCBOR6 (ORCPT ); Fri, 2 Mar 2018 09:17:58 -0500 X-IronPort-AV: E=Sophos;i="5.47,412,1515481200"; d="scan'208";a="9321358" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Mar 2018 07:17:40 -0700 Received: from ajaysk-VirtualBox.mchp-main.com (10.10.76.4) by chn-sv-exch04.mchp-main.com (10.10.76.105) with Microsoft SMTP Server id 14.3.352.0; Fri, 2 Mar 2018 07:17:39 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 3/3] staging: wilc1000: fix line over 80 char in wilc_wlan_handle_rxq() Date: Fri, 2 Mar 2018 19:47:20 +0530 Message-ID: <1520000240-27519-4-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520000240-27519-1-git-send-email-ajay.kathat@microchip.com> References: <1520000240-27519-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Refactor wilc_wlan_handle_rxq() to fix line over 80 character issue found by checkpatch.pl script. Added a new function to split 'wilc_wlan_handle_rxq' function code. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wlan.c | 114 +++++++++++++++++++---------------- 1 file changed, 63 insertions(+), 51 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 8490407..bcbb923 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -773,9 +773,70 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) return ret; } +static void wilc_wlan_handle_rx_buff(struct wilc *wilc, u8 *buffer, int size) +{ + int offset = 0; + u32 header; + u32 pkt_len, pkt_offset, tp_len; + int is_cfg_packet; + u8 *buff_ptr; + + do { + buff_ptr = buffer + offset; + memcpy(&header, buff_ptr, 4); + header = cpu_to_le32(header); + + is_cfg_packet = (header >> 31) & 0x1; + pkt_offset = (header >> 22) & 0x1ff; + tp_len = (header >> 11) & 0x7ff; + pkt_len = header & 0x7ff; + + if (pkt_len == 0 || tp_len == 0) + break; + + if (pkt_offset & IS_MANAGMEMENT) { + pkt_offset &= ~(IS_MANAGMEMENT | + IS_MANAGMEMENT_CALLBACK | + IS_MGMT_STATUS_SUCCES); + buff_ptr += HOST_HDR_OFFSET; + wilc_wfi_mgmt_rx(wilc, buff_ptr, pkt_len); + } else { + if (!is_cfg_packet) { + if (pkt_len > 0) { + wilc_frmw_to_linux(wilc, buff_ptr, + pkt_len, + pkt_offset); + } + } else { + struct wilc_cfg_rsp rsp; + + buff_ptr += pkt_offset; + + wilc_wlan_cfg_indicate_rx(wilc, buff_ptr, + pkt_len, + &rsp); + if (rsp.type == WILC_CFG_RSP) { + if (wilc->cfg_seq_no == rsp.seq_no) + complete(&wilc->cfg_event); + } else if (rsp.type == WILC_CFG_RSP_STATUS) { + wilc_mac_indicate(wilc, + WILC_MAC_INDICATE_STATUS); + + } else if (rsp.type == WILC_CFG_RSP_SCAN) { + wilc_mac_indicate(wilc, + WILC_MAC_INDICATE_SCAN); + } + } + } + offset += tp_len; + if (offset >= size) + break; + } while (1); +} + static void wilc_wlan_handle_rxq(struct wilc *wilc) { - int offset = 0, size; + int size; u8 *buffer; struct rxq_entry_t *rqe; @@ -792,57 +853,8 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) buffer = rqe->buffer; size = rqe->buffer_size; - offset = 0; - - do { - u32 header; - u32 pkt_len, pkt_offset, tp_len; - int is_cfg_packet; - - memcpy(&header, &buffer[offset], 4); - header = cpu_to_le32(header); - - is_cfg_packet = (header >> 31) & 0x1; - pkt_offset = (header >> 22) & 0x1ff; - tp_len = (header >> 11) & 0x7ff; - pkt_len = header & 0x7ff; - - if (pkt_len == 0 || tp_len == 0) - break; + wilc_wlan_handle_rx_buff(wilc, buffer, size); - if (pkt_offset & IS_MANAGMEMENT) { - pkt_offset &= ~(IS_MANAGMEMENT | - IS_MANAGMEMENT_CALLBACK | - IS_MGMT_STATUS_SUCCES); - - wilc_wfi_mgmt_rx(wilc, &buffer[offset + HOST_HDR_OFFSET], pkt_len); - } else { - if (!is_cfg_packet) { - if (pkt_len > 0) { - wilc_frmw_to_linux(wilc, - &buffer[offset], - pkt_len, - pkt_offset); - } - } else { - struct wilc_cfg_rsp rsp; - - wilc_wlan_cfg_indicate_rx(wilc, &buffer[pkt_offset + offset], pkt_len, &rsp); - if (rsp.type == WILC_CFG_RSP) { - if (wilc->cfg_seq_no == rsp.seq_no) - complete(&wilc->cfg_event); - } else if (rsp.type == WILC_CFG_RSP_STATUS) { - wilc_mac_indicate(wilc, WILC_MAC_INDICATE_STATUS); - - } else if (rsp.type == WILC_CFG_RSP_SCAN) { - wilc_mac_indicate(wilc, WILC_MAC_INDICATE_SCAN); - } - } - } - offset += tp_len; - if (offset >= size) - break; - } while (1); kfree(rqe); } while (1);