From patchwork Mon Jun 19 15:09:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Straube X-Patchwork-Id: 110072 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3078656vqr; Mon, 19 Jun 2023 08:21:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/pO9PHHGmM1rNJJLC/tRHZgYRVpW5gk3eGJhS/XtsrJf9L0KJeiwiDhaBeT68eaHQnQMg X-Received: by 2002:a17:902:a3c7:b0:1b4:fd48:d734 with SMTP id q7-20020a170902a3c700b001b4fd48d734mr6661716plb.47.1687188091693; Mon, 19 Jun 2023 08:21:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687188091; cv=none; d=google.com; s=arc-20160816; b=Pa+6dwCzeS7TrBr7QKfmnsKG/UGRsBQAVvLKZ3GyLPCEgKeVacpvufZs6m1aJ74IRa BG60J+aIK/dRqq5YrsycSd3qt6c8eK7AY4PYm+Eykkz8Hna4GnFKN56QLMU/H/9Gmy1H Oea0ZwiaiZ4Ac9O3I+XmMl6OdkoA52qxD3okKgQtmh/Oii4XzKvF54tYhuNujMzLl7LU xfPqiD9kuqmwctlXx+DLZivnnODzv9CHD+dFTd1PXcGF22khcUPffmuqTH1P/tVH+6sQ l0bkVztEn3cRh/pJHJkAlRgvtNtIWsNvJSHJk58+uO/fpj4ID7G8CL0olHyUx3iF/gIM wYCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KEaQN5x4Wxywu5DRGerlvVJNwGjReSSnSGgqsLpGfq8=; b=Xu/k03adVYZluNI1gEYP5BNMbxGMBjyaUqDy2UQZZerQoz0MNjBzucxcOxQr3tFKoO EwcTECWEElrVzNldX5eI+EKnOaReqlR0ijoKVp/mm0/vh1gKTLAriNOuTGP7Bxzfnens ftG898Es+g1QFaCFBgrvKQo4bukPo3eBlQYEssQM3+t1SvVkM4w/ixBAFS1BCIVXeRPK Q77MeTI9p5A8KZXz9BMdGXmk6zxWGeDtxpJxB5ilxVuA4XGHp0/1YD+eIWWVIKqfzQDR +xe4cKLA+XYGy82WNVoqwuDpbIBhwoymHWLJSICes15bQXalQds+UKVMhn9z642Gt+i/ nl/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=RPt8uIPW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u16-20020a170902e81000b001a94b91f402si3278plg.218.2023.06.19.08.21.18; Mon, 19 Jun 2023 08:21:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=RPt8uIPW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230417AbjFSPKX (ORCPT + 99 others); Mon, 19 Jun 2023 11:10:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229806AbjFSPKI (ORCPT ); Mon, 19 Jun 2023 11:10:08 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F6D59B for ; Mon, 19 Jun 2023 08:10:07 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-4f866a3d8e4so2630480e87.0 for ; Mon, 19 Jun 2023 08:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687187406; x=1689779406; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KEaQN5x4Wxywu5DRGerlvVJNwGjReSSnSGgqsLpGfq8=; b=RPt8uIPW6Z1I8YsH+/4gGjf0coJJvCyrShdrTfreq02XGa44yMc4IRgwBtAIVfG7Sl qwMmN7FMMFw9wCZGht7sIWTqD9T+cFXqNqLVfiGkZcbsmFAC4eNxzTfJYrJoTADVa+cQ B9RdCqbWEDDEBrolg3fidkt+ooGT5anjwastHqnb6Eubr8Ff51O6/uuQ7FfSiiynmVHf +Azn0Bm82yG/+vPWJUtget0XUxX22Yt7lkfCUn5rCtd8CwBxfH4G4bEJZupfcXZZTFYM EUXWFnME/0fehi4NmXwkML8S63PbG3kKJxxvJ7hYnoSYHT8vCLzamjfXTfiuCXNm/opX JcwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687187406; x=1689779406; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KEaQN5x4Wxywu5DRGerlvVJNwGjReSSnSGgqsLpGfq8=; b=iHQiC/jv2S2O4lIL8WQobi9DTNRie7UBPwXpKxM4d5GCT15K1CWXAJbBGaCGSxm7ru MtyNmKhIp0wbEe985LkkcX8dV1s2b4xBETymzLYCKShsF9h4r0DPbsn07UOaUjaRuuWu gf+/KpS5XuBg2xyG797J5voHE7WrIf+P9VKafd9dgzm88e6t0cyUx4KYk7x+BJBzM0B8 T6hY99bmmdIObcXX8r5daajN9MEsSuIg2Mh5tpL5REd3AougqaojmafWPRWRauCrW1n5 cLfa3BWuQFYP5z6AHe/HR7dj8Qj0g/1f3G4mYmrJyW73rREMqZAaq04nD8OnkvC+LAxj MstQ== X-Gm-Message-State: AC+VfDxecQCPo/vZuXTUWeMLXl4li/WXBMQaOtAM440Bb3mhPiH31E2Y O1co+LtxB+XkKyaV7h4m6J5p9T6hPGg= X-Received: by 2002:a05:6512:47a:b0:4f8:7494:17d7 with SMTP id x26-20020a056512047a00b004f8749417d7mr1260966lfd.59.1687187405320; Mon, 19 Jun 2023 08:10:05 -0700 (PDT) Received: from localhost.localdomain (ip5f5abbd5.dynamic.kabel-deutschland.de. [95.90.187.213]) by smtp.gmail.com with ESMTPSA id p6-20020a056402044600b0050488d1d376sm13297186edw.0.2023.06.19.08.10.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 08:10:05 -0700 (PDT) From: Michael Straube To: gregkh@linuxfoundation.org Cc: philipp.g.hortmann@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Michael Straube Subject: [PATCH 2/4] staging: rtl8192e: convert else if sequence to switch Date: Mon, 19 Jun 2023 17:09:51 +0200 Message-ID: <20230619150953.22484-3-straube.linux@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230619150953.22484-1-straube.linux@gmail.com> References: <20230619150953.22484-1-straube.linux@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769144940155558345?= X-GMAIL-MSGID: =?utf-8?q?1769144940155558345?= Convert a sequence of else if statements that all check the same variable to a single switch statement. With a switch statement it is easier to see what is going on. Additionally this clears a checkpatch warning. WARNING: braces {} are not necessary for any arm of this statement Signed-off-by: Michael Straube --- drivers/staging/rtl8192e/rtllib_softmac.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index a47614c837ce..7b3cbe28e562 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -2830,15 +2830,19 @@ void rtllib_start_protocol(struct rtllib_device *ieee) * attempts does not fail just because the user provide the essid * and the nic is still checking for the AP MAC ?? */ - if (ieee->iw_mode == IW_MODE_INFRA) { + switch (ieee->iw_mode) { + case IW_MODE_INFRA: rtllib_start_bss(ieee); - } else if (ieee->iw_mode == IW_MODE_ADHOC) { + break; + case IW_MODE_ADHOC: rtllib_start_ibss(ieee); - - } else if (ieee->iw_mode == IW_MODE_MASTER) { + break; + case IW_MODE_MASTER: rtllib_start_master_bss(ieee); - } else if (ieee->iw_mode == IW_MODE_MONITOR) { + break; + case IW_MODE_MONITOR: rtllib_start_monitor_mode(ieee); + break; } }