From patchwork Tue Nov 5 19:16:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Pedersen X-Patchwork-Id: 3143371 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 76062BEEB2 for ; Tue, 5 Nov 2013 19:23:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 27F882058D for ; Tue, 5 Nov 2013 19:23:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 18CA2205B3 for ; Tue, 5 Nov 2013 19:22:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755390Ab3KETWx (ORCPT ); Tue, 5 Nov 2013 14:22:53 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:58129 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754830Ab3KETWw (ORCPT ); Tue, 5 Nov 2013 14:22:52 -0500 Received: by mail-pa0-f41.google.com with SMTP id rd3so9474682pab.28 for ; Tue, 05 Nov 2013 11:22:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KEYx+pQ9OJorG3fMDq/W7Ba3uZkB567JRpgw3no5lyw=; b=kgfEqvrYOO5bGGlTwV+757Y3qPmQGduisGaet6vrJSbQnYDUyXTFAHMpn8z8newSjy gzO8vhOF84aNAr/QwV5Luac1o82emhG0I8up/oWEqvnz0U+EtvvHlYzK+V9XtB+RGXBY S3jFLcnfqxt4Mg/+iZSvHmqiERCukDOqiJu/zHYeJ/YR5G8Wq2IvHPHEKIYeSSprXP9c kE1Qg0Gv1MVDujkrwzN+ok5Yo40hdKT1B2y0CYrJZl3sCzIBpLgfnznPNsr/nxTp8//R wM8iRhCXylfir4P1AGk1WCcZ3StCN1TLliOb5NrmwvxcOcRWJ8jCTWuQViz3d87eXNav IEwQ== X-Gm-Message-State: ALoCoQnVq4pvHPl4GOc7Nx3qyrRqnFwnBhQfF3uRW+eLpb8Bx8v4bXqSvysFY0gtua0hXnSHqcTF X-Received: by 10.68.196.69 with SMTP id ik5mr13167721pbc.132.1383679371848; Tue, 05 Nov 2013 11:22:51 -0800 (PST) Received: from cable.cozybit (70-35-43-50.static.wiline.com. [70.35.43.50]) by mx.google.com with ESMTPSA id de1sm36237294pbc.7.2013.11.05.11.22.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Nov 2013 11:22:50 -0800 (PST) From: Thomas Pedersen To: Johannes Berg Cc: Bob Copeland , linux-wireless , open80211s Subject: [PATCH 07/17] mac80211: mesh_plink: collapse the two switch statements together Date: Tue, 5 Nov 2013 11:16:55 -0800 Message-Id: <1383679025-7150-7-git-send-email-thomas@cozybit.com> X-Mailer: git-send-email 1.8.4.rc3 In-Reply-To: <1383679025-7150-1-git-send-email-thomas@cozybit.com> References: <1383679025-7150-1-git-send-email-thomas@cozybit.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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 From: Bob Copeland The matches_local check can just be done when looking at the individual action types. Signed-off-by: Bob Copeland --- net/mac80211/mesh_plink.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index 36b6cff..8e23395 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c @@ -821,33 +821,25 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, /* Now we will figure out the appropriate event... */ event = PLINK_UNDEFINED; - if (!matches_local) { - switch (ftype) { - case WLAN_SP_MESH_PEERING_OPEN: - event = OPN_RJCT; - break; - case WLAN_SP_MESH_PEERING_CONFIRM: - event = CNF_RJCT; - break; - default: - break; - } - } if (!sta) event = OPN_ACPT; - else if (matches_local) { + else { switch (ftype) { case WLAN_SP_MESH_PEERING_OPEN: - if (!mesh_plink_free_count(sdata) || - (sta->plid && sta->plid != plid)) + if (!matches_local) + event = OPN_RJCT; + else if (!mesh_plink_free_count(sdata) || + (sta->plid && sta->plid != plid)) event = OPN_IGNR; else event = OPN_ACPT; break; case WLAN_SP_MESH_PEERING_CONFIRM: - if (!mesh_plink_free_count(sdata) || - (sta->llid != llid || sta->plid != plid)) + if (!matches_local) + event = CNF_RJCT; + else if (!mesh_plink_free_count(sdata) || + (sta->llid != llid || sta->plid != plid)) event = CNF_IGNR; else event = CNF_ACPT;