staging: rtl8192e: Rename variables TM_Trigger and TxPowerCheckCnt to avoid CamelCase
Message ID | 20221106131811.GA50668@zephyrus |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1493719wru; Sun, 6 Nov 2022 05:27:23 -0800 (PST) X-Google-Smtp-Source: AMsMyM6JvAtwdU8s5C4l7DjD2/OsUHgdAgOFtZ/b2iCnx8uv9WD00lBiDOxHbDuCd/+hmk1IaZj9 X-Received: by 2002:a05:6a00:2396:b0:56c:b770:eda6 with SMTP id f22-20020a056a00239600b0056cb770eda6mr44820606pfc.38.1667741243570; Sun, 06 Nov 2022 05:27:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667741243; cv=none; d=google.com; s=arc-20160816; b=Tcf/ui/UW4WoD0L1ftHmqojepPrnV08PKJ9vCXhhrn/yMydWOV+lBszciMdwMv47Js L054onz6AWFzLXsB9pXV5UQticGZj5oNs9LCAajP9BbkieJNjdh0NmMXJeM6BY6HBY07 F0DwjrySNZ9P1r18nFX+3p02mvtWLjo2HUa8A3/Has6X1OPwqj5lF2yQSB8zOzkDW8pN M/40zvOAao3Kl3kb5Od+MJ4gBHDavl2J7psONznfY4l04PetUbe9Yw6kCSppQTtJSeIr 5mbj1oOMUepfnYvz/FMWMlqmAkmNPTUJ7ayv9D6ifs08OQ1keVWFOq8EYWiViXmvhNYE j4jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=+wIjgNU88aVc2+sFYCEelT5KhuJ8SvI5h9ckpOpuCAw=; b=eDAZ3dVof1gDLydDZ5QNGuPFToPk96epiX1MDFLLvl8faSs33rbMwOe/uHLYEUuJ/9 7Hra+lk4FEYmuvdOCw6i/g5ka3HlGA4gu4CXz+paLsCqK323IvyyBSu6FlGH/ouV7EUP 6nhcr7THTvmHQsZb5RedBniSeOKt/XgFnr5TmOTZ7/mPRiy8jnIZiuCj9X5U57AlSiI+ fqvvgjDbJsunrmY6wP1g9qpP9MsdanXTbdihq5ROlJSyZFAET2GyJMRGxpmtaBMsie26 lkAwFBulGRmUwOiiEt2Iz+YAPwiIBEmcvW+gS7EkwP29GmlHht/AeJol+4XFzTl1u35w P6Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cLWYtVzc; 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 u28-20020a63471c000000b0046f7d43c578si6590343pga.133.2022.11.06.05.27.10; Sun, 06 Nov 2022 05:27:23 -0800 (PST) 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=20210112 header.b=cLWYtVzc; 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 S229924AbiKFNST (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Sun, 6 Nov 2022 08:18:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229844AbiKFNSR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 6 Nov 2022 08:18:17 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21BF6BF63 for <linux-kernel@vger.kernel.org>; Sun, 6 Nov 2022 05:18:17 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id f5-20020a17090a4a8500b002131bb59d61so10705862pjh.1 for <linux-kernel@vger.kernel.org>; Sun, 06 Nov 2022 05:18:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=+wIjgNU88aVc2+sFYCEelT5KhuJ8SvI5h9ckpOpuCAw=; b=cLWYtVzcHUtnpfMsI2JPuan2DjSbptj21Zx5CkyiQCczT8+hkJ+LsIrHLdIoiphGvl WGVF/69phwq3w7xsDDnZkaE9RFgBsa4gdXsoVL7VwrA+aDOXRaca22oozlnDYJCS5FCD GCM2IZOF2XbB65knjTDgyAD25a7hxx7aajJiAvduVJyVitxJYEjE/TKJk1MNB7scsHk4 LZP41KG5Z7mEefbzZPh3vJDvnabxbrb6jIopUQkrxDy1vFfd45O1s0rs8rnBFg+jFQsy N2RIKkuIEkdEaQoVkSms3R+fh/kBb2XWMkZaq7kFpGxATdV+FSG92TUJffime1JSjO88 m98A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+wIjgNU88aVc2+sFYCEelT5KhuJ8SvI5h9ckpOpuCAw=; b=VW2gGPoKQSxPpgavDOrjp0Iysn+EjPo6o8Tj9EBiVTliNBZ0fqpA5sPecpWdGJG69l w0+JparXmHsjqRkuZ3801tG3dSleSMzNpbsGsNf2OC5iEBtLP5Mnz31gooG/ic9sIJmB YPz+4mTK/vn+YOJOpNpqLKkz/9RqtuRTyAdx+5BPjR2HiiHYxuSwml/IOeSxnG04Mo8c KgzGeWrEAzCH3O2sywUN3LqfPfAnBqmAhPj9vw3EDg2t/PC23Kg0JUvdhPUQRlA9lJst vr1zG8suehr9UTqYsdPiUR+yQYjCI0+lVeemDgwFqZs5hQSIiEZgF+KQ41YiCcnDIiZh doTA== X-Gm-Message-State: ACrzQf0aeIlckcN8mb53zL2q9F+ZwmjqkmwJT/k7BIz3bVLPMKdoa1JV 5h3s+yXdZ/PO17mi6cA/p2c= X-Received: by 2002:a17:90a:590a:b0:20a:e93e:2022 with SMTP id k10-20020a17090a590a00b0020ae93e2022mr45021261pji.141.1667740696609; Sun, 06 Nov 2022 05:18:16 -0800 (PST) Received: from zephyrus ([103.251.210.204]) by smtp.gmail.com with ESMTPSA id i4-20020a63cd04000000b0045751ef6423sm2537049pgg.87.2022.11.06.05.18.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Nov 2022 05:18:16 -0800 (PST) Date: Sun, 6 Nov 2022 18:48:11 +0530 From: Yogesh Hegde <yogi.kernel@gmail.com> To: gregkh@linuxfoundation.org Cc: philipp.g.hortmann@gmail.com, dragan.m.cvetic@gmail.com, wjsota@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] staging: rtl8192e: Rename variables TM_Trigger and TxPowerCheckCnt to avoid CamelCase Message-ID: <20221106131811.GA50668@zephyrus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748753442466407077?= X-GMAIL-MSGID: =?utf-8?q?1748753442466407077?= |
Series |
staging: rtl8192e: Rename variables TM_Trigger and TxPowerCheckCnt to avoid CamelCase
|
|
Commit Message
Yogesh Hegde
Nov. 6, 2022, 1:18 p.m. UTC
Rename variables
* TM_trigger to tm_trigger
* TxPowerCheckCnt to txpower_check_count
to avoid CamelCase which is not accepted by checkpatch.pl .
Signed-off-by: Yogesh Hegde <yogi.kernel@gmail.com>
---
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
Comments
On Sun, Nov 06, 2022 at 06:48:11PM +0530, Yogesh Hegde wrote: > Rename variables > * TM_trigger to tm_trigger > * TxPowerCheckCnt to txpower_check_count > to avoid CamelCase which is not accepted by checkpatch.pl . > > Signed-off-by: Yogesh Hegde <yogi.kernel@gmail.com> > --- > drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c > index 767c746fc73d..0652940eecc5 100644 > --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c > +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c > @@ -919,32 +919,32 @@ static void _rtl92e_dm_check_tx_power_tracking_tssi(struct net_device *dev) > static void _rtl92e_dm_check_tx_power_tracking_thermal(struct net_device *dev) > { > struct r8192_priv *priv = rtllib_priv(dev); > - static u8 TM_Trigger; > - u8 TxPowerCheckCnt = 0; > + static u8 tm_trigger; > + u8 txpower_check_count = 0; While this is nice overall, I think you just found a bug in the driver. Why is this a static variable? That means this affects all devices that this driver touches, which seems very wrong, right? So shouldn't tm_trigger be a per-device attribute? > if (IS_HARDWARE_TYPE_8192SE(dev)) > - TxPowerCheckCnt = 5; > + txpower_check_count = 5; > else > - TxPowerCheckCnt = 2; > + txpower_check_count = 2; > if (!priv->btxpower_tracking) > return; > > - if (priv->txpower_count <= TxPowerCheckCnt) { > + if (priv->txpower_count <= txpower_check_count) { > priv->txpower_count++; > return; > } > > - if (!TM_Trigger) { > + if (!tm_trigger) { > rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d); > rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f); > rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d); > rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f); > - TM_Trigger = 1; > + tm_trigger = 1; It also should be a boolean, right? Can you fix this up to be a per-device attribute instead? thanks, greg k-h
On Sun, Nov 06, 2022 at 05:40:05PM +0100, Greg KH wrote: > On Sun, Nov 06, 2022 at 06:48:11PM +0530, Yogesh Hegde wrote: > > Rename variables > > * TM_trigger to tm_trigger > > * TxPowerCheckCnt to txpower_check_count > > to avoid CamelCase which is not accepted by checkpatch.pl . > > > > Signed-off-by: Yogesh Hegde <yogi.kernel@gmail.com> > > --- > > drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 16 ++++++++-------- > > 1 file changed, 8 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c > > index 767c746fc73d..0652940eecc5 100644 > > --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c > > +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c > > @@ -919,32 +919,32 @@ static void _rtl92e_dm_check_tx_power_tracking_tssi(struct net_device *dev) > > static void _rtl92e_dm_check_tx_power_tracking_thermal(struct net_device *dev) > > { > > struct r8192_priv *priv = rtllib_priv(dev); > > - static u8 TM_Trigger; > > - u8 TxPowerCheckCnt = 0; > > + static u8 tm_trigger; > > + u8 txpower_check_count = 0; > > While this is nice overall, I think you just found a bug in the driver. > > Why is this a static variable? That means this affects all devices that > this driver touches, which seems very wrong, right? > > So shouldn't tm_trigger be a per-device attribute? Yes you are right! > > > if (IS_HARDWARE_TYPE_8192SE(dev)) > > - TxPowerCheckCnt = 5; > > + txpower_check_count = 5; > > else > > - TxPowerCheckCnt = 2; > > + txpower_check_count = 2; > > if (!priv->btxpower_tracking) > > return; > > > > - if (priv->txpower_count <= TxPowerCheckCnt) { > > + if (priv->txpower_count <= txpower_check_count) { > > priv->txpower_count++; > > return; > > } > > > > - if (!TM_Trigger) { > > + if (!tm_trigger) { > > rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d); > > rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f); > > rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d); > > rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f); > > - TM_Trigger = 1; > > + tm_trigger = 1; > > It also should be a boolean, right? > Yes, it should a boolean, But in the mainline, the maintainers have kept it u8 for some reason [1]. So I am not sure if it should be boolean. Please let me know your thoughts on this. > Can you fix this up to be a per-device attribute instead? Sure, just to make sure that we are on the same page, you are expecting a patch similar to this [2] right? Since I am new to mainline kernel development, I wanted to ensure that I am on the right track. Thanks Yogesh [1] https://github.com/gregkh/linux/blob/30a0b95b1335e12efef89dd78518ed3e4a71a763/drivers/net/wireless/realtek/rtlwifi/wifi.h#L1812 [2] https://lore.kernel.org/all/20150615093119.2F8431407E7@smtp.codeaurora.org/T/
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 767c746fc73d..0652940eecc5 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -919,32 +919,32 @@ static void _rtl92e_dm_check_tx_power_tracking_tssi(struct net_device *dev) static void _rtl92e_dm_check_tx_power_tracking_thermal(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); - static u8 TM_Trigger; - u8 TxPowerCheckCnt = 0; + static u8 tm_trigger; + u8 txpower_check_count = 0; if (IS_HARDWARE_TYPE_8192SE(dev)) - TxPowerCheckCnt = 5; + txpower_check_count = 5; else - TxPowerCheckCnt = 2; + txpower_check_count = 2; if (!priv->btxpower_tracking) return; - if (priv->txpower_count <= TxPowerCheckCnt) { + if (priv->txpower_count <= txpower_check_count) { priv->txpower_count++; return; } - if (!TM_Trigger) { + if (!tm_trigger) { rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d); rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f); rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d); rtl92e_set_rf_reg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f); - TM_Trigger = 1; + tm_trigger = 1; return; } netdev_info(dev, "===============>Schedule TxPowerTrackingWorkItem\n"); schedule_delayed_work(&priv->txpower_tracking_wq, 0); - TM_Trigger = 0; + tm_trigger = 0; }