From patchwork Fri Mar 18 02:28:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Calaby X-Patchwork-Id: 8615881 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 46000C0553 for ; Fri, 18 Mar 2016 02:28:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6D7D420306 for ; Fri, 18 Mar 2016 02:28:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8A2FF20160 for ; Fri, 18 Mar 2016 02:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752662AbcCRC2V (ORCPT ); Thu, 17 Mar 2016 22:28:21 -0400 Received: from mail-pf0-f175.google.com ([209.85.192.175]:35429 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752643AbcCRC2U (ORCPT ); Thu, 17 Mar 2016 22:28:20 -0400 Received: by mail-pf0-f175.google.com with SMTP id n5so146081395pfn.2 for ; Thu, 17 Mar 2016 19:28:20 -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; bh=xppawGvxHwl0mzcPHK5E7wT8I8v3lpOkVGtYwJ6jXzk=; b=rzLvLjvhvkqI22L+TnTt1NqjAbPTcrYbHW4yAjEGSRFG5yQoptfpla2HRB9CxIxbr6 Xhu/evfvYRNDt2EGJKA1BEV9lCmGbrRDwChlRutMUxXZ6kWzTUlvv5Q8MXtgKxxb2BFk vg+dKx38M3Od6bVodWeh35NTEy8YWWIVSbeh18JiN5mYx809Lkwm6zMzhdiu/7O3dEcf AHRsdaA2zV9CiRyW7Hn52WOsLWZL+r40bEDSQ5zbCQ7c95Lvb6JGJ1pIltRigJkssDaw XXxgIzpLgJlLgZ/dlyIZdFZDc08dJraT+s3961TWg9fVgQuQBgnUTZoxmYdlIBPzEUVb FczA== 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=xppawGvxHwl0mzcPHK5E7wT8I8v3lpOkVGtYwJ6jXzk=; b=Z8BTseNrOxzfXOhOOywHO1kFkaKP6ymUJi18B72hiWyG+qNbE2multRn7pZ7I/GOF+ VJU3oMD8Ldxk+iAO7miGmPO7pCmlQLmPVTQRx+0esOi87cjCTVEBewhgtQcrGEpWcJuY V61KvabvbYZnC3k1TG2ccll8+HGDg6eXjeMRjjCymaz+OuHYVngxFbnHUGA2oj+ED96f wijDayngw+K3NPaRmFh+0GTFV5V+g1GzBEIUbEt3rAVIZIKNcCb2EwRhbGUNFpS0lwVk rV60njrH0Ae65KBvSOiEb6UsdpDiQDa3o/JNUJmCfTGEcDz9xGNf24yTW8xkCVVMiL0s UK/Q== X-Gm-Message-State: AD7BkJIk9JDgZ7A7csGl0Yhx9ebIkxu470OLUGz8jPlspDxmuOGe41gothjv4uYqA96fbw== X-Received: by 10.66.190.40 with SMTP id gn8mr19754899pac.64.1458268099836; Thu, 17 Mar 2016 19:28:19 -0700 (PDT) Received: from multimedia.lan (C-59-101-14-180.hay.connect.net.au. [59.101.14.180]) by smtp.gmail.com with ESMTPSA id 16sm16403207pfk.28.2016.03.17.19.28.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Mar 2016 19:28:19 -0700 (PDT) From: Julian Calaby To: Kalle Valo Cc: Larry Finger , Chaoming Li , Johannes Berg , Byeoungwook Kim , Markus Elfring , Sara Sharon , Emmanuel Grumbach , Luis Felipe Dominguez Vega , linux-wireless@vger.kernel.org Subject: [PATCH MOREWORK 16/19] rtlwifi: Implement 'rtl_addr_delay()' with a switch statement Date: Fri, 18 Mar 2016 13:28:11 +1100 Message-Id: X-Mailer: git-send-email 2.7.0 In-Reply-To: References: 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.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 From: Byeoungwook Kim Doing it this way improves readability. Signed-off-by: Byeoungwook Kim [Rewrote commit message] Signed-off-by: Julian Calaby --- ... or does it. Honesltly, this is only in this list as Byeoungwook asked about it and I can see _some_ sort of reason why it exists. Larry, if you don't like this, please NACK it and we'll never speak of it again. Thanks, Julian Calaby --- drivers/net/wireless/realtek/rtlwifi/core.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c index 0f48048..1cf367f 100644 --- a/drivers/net/wireless/realtek/rtlwifi/core.c +++ b/drivers/net/wireless/realtek/rtlwifi/core.c @@ -53,18 +53,26 @@ EXPORT_SYMBOL(channel5g_80m); void rtl_addr_delay(u32 addr) { - if (addr == 0xfe) + switch (addr) { + case 0xfe: msleep(50); - else if (addr == 0xfd) + break; + case 0xfd: msleep(5); - else if (addr == 0xfc) + break; + case 0xfc: msleep(1); - else if (addr == 0xfb) + break; + case 0xfb: usleep_range(50, 100); - else if (addr == 0xfa) + break; + case 0xfa: usleep_range(5, 10); - else if (addr == 0xf9) + break; + case 0xf9: usleep_range(1, 2); + break; + } } EXPORT_SYMBOL(rtl_addr_delay);