Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S944921AbcJSPWd (ORCPT ); Wed, 19 Oct 2016 11:22:33 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:36039 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S944171AbcJSPGG (ORCPT ); Wed, 19 Oct 2016 11:06:06 -0400 From: Ivan Safonov To: Greg Kroah-Hartman , Bhaktipriya Shridhar , Andy Shevchenko , Geliang Tang , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Cc: insafonov@gmail.com Subject: [PATCH 23/37] staging:r8188eu: update rx_tail and pkt->tail synchronously Date: Wed, 19 Oct 2016 22:07:51 +0700 Message-Id: <1476889685-7367-23-git-send-email-insafonov@gmail.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1476889685-7367-1-git-send-email-insafonov@gmail.com> References: <1476889685-7367-1-git-send-email-insafonov@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1578 Lines: 54 To replace rx_tail with pkt->tail. Now pkt->tail is equal to rx_tail and pkt->len is equal to len. Signed-off-by: Ivan Safonov --- drivers/staging/rtl8188eu/include/rtw_recv.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h b/drivers/staging/rtl8188eu/include/rtw_recv.h index 9a3a978..34d13f8 100644 --- a/drivers/staging/rtl8188eu/include/rtw_recv.h +++ b/drivers/staging/rtl8188eu/include/rtw_recv.h @@ -279,17 +279,17 @@ static inline u8 *recvframe_put(struct recv_frame *precvframe, uint sz) * and return the updated rx_tail to the caller */ /* after putting, rx_tail must be still larger than rx_end. */ + u8 *tail; + if (precvframe == NULL) return NULL; - precvframe->rx_tail += sz; - - if (precvframe->rx_tail > precvframe->pkt->end) { - precvframe->rx_tail -= sz; + tail = skb_put(precvframe->pkt, sz); + if (!tail) return NULL; - } + precvframe->rx_tail += sz; precvframe->len += sz; - return precvframe->rx_tail; + return tail; } static inline void recvframe_pull_tail(struct recv_frame *precvframe, uint sz) @@ -302,11 +302,11 @@ static inline void recvframe_pull_tail(struct recv_frame *precvframe, uint sz) if (precvframe == NULL) return; - precvframe->rx_tail -= sz; - if (precvframe->rx_tail < precvframe->pkt->data) { - precvframe->rx_tail += sz; + + if (precvframe->len < sz) return; - } + precvframe->rx_tail -= sz; + skb_trim(precvframe->pkt, precvframe->pkt->len - sz); precvframe->len -= sz; } -- 2.7.3