From patchwork Mon Apr 14 09:51:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gang ZHAO X-Patchwork-Id: 3979081 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A4CF99F2BA for ; Mon, 14 Apr 2014 09:54:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D2E28201EC for ; Mon, 14 Apr 2014 09:54:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 18511201F2 for ; Mon, 14 Apr 2014 09:54:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753554AbaDNJxw (ORCPT ); Mon, 14 Apr 2014 05:53:52 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:33251 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752760AbaDNJwD (ORCPT ); Mon, 14 Apr 2014 05:52:03 -0400 Received: by mail-pd0-f179.google.com with SMTP id w10so7892574pde.38 for ; Mon, 14 Apr 2014 02:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=9nGxMJEVtdoa/M0QbVNrwVNn29gIfNn5ANCQ9A3Ze2o=; b=S+6WdCJYP1ES7NCkHeFO8Uw6W46PBDCi7Z6pXeE8hch3pYhFkMik66EiCgAjpf4YqD MfFI1g5KxsXv8K+2SdFu4Xx2qN4tZIB+RdMr7sBMh6sqhn0CRWs2m29+z6YlQHbqqx2R j00fGtQbmLcBxfVxjVfN/8dy54QumaCiAxy+7kDXwmQKfQPyJsBjfPNzNOzxNtM009p6 sU/+ifvDktbUdjLEG04mxu18qUrunv78POaz+el63/UXEPuColhtuE+HG+P6swHKFIe+ GUU223yXuIY24u3coC6E1SvyPmoU9fVP5IBy0Ifi5mph06BcxX2wDy66mVBCb/gu9Eb5 /j6w== X-Received: by 10.68.237.228 with SMTP id vf4mr2179446pbc.131.1397469122604; Mon, 14 Apr 2014 02:52:02 -0700 (PDT) Received: from localhost.localdomain ([175.153.40.114]) by mx.google.com with ESMTPSA id j3sm32747430pbh.38.2014.04.14.02.52.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Apr 2014 02:52:02 -0700 (PDT) From: "Zhao, Gang" To: Cc: Johannes Berg Subject: [PATCH 4/6] mac80211: return bool instead of numbers in yes/no function Date: Mon, 14 Apr 2014 17:51:33 +0800 Message-Id: <7e0cef80705e85eff58298ba03580dc3742335d8.1397469036.git.gamerh2o@gmail.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <8b5c4a61ae1f49400478b030fa7ae4e3a5ca2bcb.1397469035.git.gamerh2o@gmail.com> References: <8b5c4a61ae1f49400478b030fa7ae4e3a5ca2bcb.1397469035.git.gamerh2o@gmail.com> In-Reply-To: <8b5c4a61ae1f49400478b030fa7ae4e3a5ca2bcb.1397469035.git.gamerh2o@gmail.com> References: <8b5c4a61ae1f49400478b030fa7ae4e3a5ca2bcb.1397469035.git.gamerh2o@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP And some code style changes in the function, and correct a typo in comment. Signed-off-by: Zhao, Gang --- net/mac80211/rx.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index c86a4d6..87c28f8 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -54,24 +54,25 @@ static struct sk_buff *remove_monitor_info(struct ieee80211_local *local, return skb; } -static inline int should_drop_frame(struct sk_buff *skb, int present_fcs_len) +static inline bool should_drop_frame(struct sk_buff *skb, int present_fcs_len) { struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - struct ieee80211_hdr *hdr; - - hdr = (void *)(skb->data); + struct ieee80211_hdr *hdr = (void *)skb->data; if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC | RX_FLAG_AMPDU_IS_ZEROLEN)) - return 1; + return true; + if (unlikely(skb->len < 16 + present_fcs_len)) - return 1; + return true; + if (ieee80211_is_ctl(hdr->frame_control) && !ieee80211_is_pspoll(hdr->frame_control) && !ieee80211_is_back_req(hdr->frame_control)) - return 1; - return 0; + return true; + + return false; } static int @@ -3190,7 +3191,7 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx, } /* - * This is the actual Rx frames handler. as it blongs to Rx path it must + * This is the actual Rx frames handler. as it belongs to Rx path it must * be called with rcu_read_lock protection. */ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,