Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp5375783rwe; Tue, 18 Apr 2023 06:11:09 -0700 (PDT) X-Google-Smtp-Source: AKy350YUa6ljhfmPTSSKEGrh6FtLPPiMH/8RJueD8xbJbcI1u5myalbtAEHxnUUxVYkFSaqyh3uD X-Received: by 2002:a17:903:294c:b0:1a1:ca37:5257 with SMTP id li12-20020a170903294c00b001a1ca375257mr1826069plb.7.1681823468715; Tue, 18 Apr 2023 06:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681823468; cv=none; d=google.com; s=arc-20160816; b=G2G23bWg/JiUaoGz59kAAUBcXXIY4IGZN/mpw6QOmbxX0mSw1VVXVxEYgTX3f6E4Ey BH9mJ8iTNQuKbIX66ws7XIAK3aYT9rKyJ6cgvz11H45BMfI+wXKsJK93UkE06GIpPCgj tkEbJgHQJiPoi9orVhR7B1S4ad1WRgZ9ecUDzIrjfc4gatNV2l8T1Yh+0Evyg2iJSqHw s6vlvA2v8XWtrAkZXxLrXbsPFksmnphWAfo9u2RlY2HPNzm9PLF0vB8xhdgXhnb4F18e hD3v0pz1KG3+QMJRDtxv/E0ola/olW1IPgzCfzGXNQXJuPQV8l+cGpBfpfjSqFX1XAw4 MriA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JBPL4xQ7y0BLqqHD/N+EQKkUOBYNyKt3mtnZPjrhmWc=; b=DNS2nnIk+sT6hEvR7yOxg7gBb+0RYHdKbjsylxeP3xf32UbUNIDG8A8rhUJ6Kmu62w N6ImrLDMLu79gdvO5SYmWA+gflnUNxidh4W8TOeUEaAjYHpIHPEMBeWZ6aPzAwn5/6uo MmiVMek8OSev9/k0WwbdfZlvnylJ4Ng5sopQr6KV/cDzuFbb4Jc0EGwIt2D6ipa2Gtdz mDLNEJsiAovXr/BGBsSgKv0NW/ycMp/5iQeltOz1qlDrAIGjaUKx9bBR4uIUYobQn40O FXOc9LAVK0f1VJuwxNtOA3PnPANawk1ZgC23J2AZH3gU6rV9NGJKtvXU2GZgtJPOgoZr xVsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DbLiBOxx; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a170902860a00b001a647aadbeasi8529464plo.416.2023.04.18.06.10.57; Tue, 18 Apr 2023 06:11:08 -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=@linuxfoundation.org header.s=korg header.b=DbLiBOxx; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231290AbjDRNEa (ORCPT + 99 others); Tue, 18 Apr 2023 09:04:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232367AbjDRNEW (ORCPT ); Tue, 18 Apr 2023 09:04:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA20E17913 for ; Tue, 18 Apr 2023 06:04:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 47CE062CEC for ; Tue, 18 Apr 2023 13:04:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 525A0C433D2; Tue, 18 Apr 2023 13:04:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1681823048; bh=4Ph/dFwCh9YbMeZnsdIGgxesneSIpcLjZKhHXRORa2Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DbLiBOxxVnaMhKnJIAulfc/O7AxPU5onlOAJFLo/K1ahf+ZbMlOQNQSnGPnsgO9+J Uul/XnZGWbZCzYhSZBp8s25GVE3fzGiEf4PtUwMCsDb+ZQFfT041GNFtZlPrARIouP Itcsm0Ggsa+rxlgM3eHDYQ/xiGOrp5rM3Gd8F2Sw= Date: Tue, 18 Apr 2023 15:04:06 +0200 From: Greg KH To: Luke Koch Cc: error27@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] staging: wlan-ng: replace rate macros Message-ID: <2023041809-wildfowl-winter-be08@gregkh> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Tue, Apr 18, 2023 at 02:35:52PM +0200, Luke Koch wrote: > Change p80211msg_dot11req_scan_results rate members to struct arrays > instead of individually numbered member structs. > Replace macros to set rates with loops to avoid checkpatch warning > and adhere to linux coding style. > > Reported by checkpatch: > > CHECK: Macro argument reuse 'N' - possible side-effects? > > Signed off by: Luke Koch > --- > v2: - Fix array underflow and conditions with respect to the start at 0 > v3: - Remove unnecessary spaces > --- > drivers/staging/wlan-ng/p80211metastruct.h | 18 +------- > drivers/staging/wlan-ng/prism2mgmt.c | 52 +++++++--------------- > 2 files changed, 18 insertions(+), 52 deletions(-) > > diff --git a/drivers/staging/wlan-ng/p80211metastruct.h b/drivers/staging/wlan-ng/p80211metastruct.h > index 4adc64580185..e963227f797c 100644 > --- a/drivers/staging/wlan-ng/p80211metastruct.h > +++ b/drivers/staging/wlan-ng/p80211metastruct.h > @@ -114,22 +114,8 @@ struct p80211msg_dot11req_scan_results { > struct p80211item_uint32 cfpollreq; > struct p80211item_uint32 privacy; > struct p80211item_uint32 capinfo; > - struct p80211item_uint32 basicrate1; > - struct p80211item_uint32 basicrate2; > - struct p80211item_uint32 basicrate3; > - struct p80211item_uint32 basicrate4; > - struct p80211item_uint32 basicrate5; > - struct p80211item_uint32 basicrate6; > - struct p80211item_uint32 basicrate7; > - struct p80211item_uint32 basicrate8; > - struct p80211item_uint32 supprate1; > - struct p80211item_uint32 supprate2; > - struct p80211item_uint32 supprate3; > - struct p80211item_uint32 supprate4; > - struct p80211item_uint32 supprate5; > - struct p80211item_uint32 supprate6; > - struct p80211item_uint32 supprate7; > - struct p80211item_uint32 supprate8; > + struct p80211item_uint32 basicrate[8]; > + struct p80211item_uint32 supprate[8]; > } __packed; > > struct p80211msg_dot11req_start { > diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c > index 9030a8939a9b..fc465261baa1 100644 > --- a/drivers/staging/wlan-ng/prism2mgmt.c > +++ b/drivers/staging/wlan-ng/prism2mgmt.c > @@ -437,42 +437,22 @@ int prism2mgmt_scan_results(struct wlandevice *wlandev, void *msgp) > if (item->supprates[count] == 0) > break; > > -#define REQBASICRATE(N) \ > - do { \ > - if ((count >= (N)) && DOT11_RATE5_ISBASIC_GET( \ > - item->supprates[(N) - 1])) { \ > - req->basicrate ## N .data = item->supprates[(N) - 1]; \ > - req->basicrate ## N .status = \ > - P80211ENUM_msgitem_status_data_ok; \ > - } \ > - } while (0) > - > - REQBASICRATE(1); > - REQBASICRATE(2); > - REQBASICRATE(3); > - REQBASICRATE(4); > - REQBASICRATE(5); > - REQBASICRATE(6); > - REQBASICRATE(7); > - REQBASICRATE(8); > - > -#define REQSUPPRATE(N) \ > - do { \ > - if (count >= (N)) { \ > - req->supprate ## N .data = item->supprates[(N) - 1]; \ > - req->supprate ## N .status = \ > - P80211ENUM_msgitem_status_data_ok; \ > - } \ > - } while (0) > - > - REQSUPPRATE(1); > - REQSUPPRATE(2); > - REQSUPPRATE(3); > - REQSUPPRATE(4); > - REQSUPPRATE(5); > - REQSUPPRATE(6); > - REQSUPPRATE(7); > - REQSUPPRATE(8); > + for (int i = 0; i < 8; i++) { > + if (count > i && > + DOT11_RATE5_ISBASIC_GET(item->supprates[i])) { > + req->basicrate[i].data = item->supprates[i]; > + req->basicrate[i].status = > + P80211ENUM_msgitem_status_data_ok; > + } > + } > + > + for (int i = 0; i < 8; i++) { > + if (count > i) { > + req->supprate[i].data = item->supprates[i]; > + req->supprate[i].status = > + P80211ENUM_msgitem_status_data_ok; > + } > + } This patch implies that these structures are set but never actually read from, so why are they present at all? Is this a structure that is on the wire/air or used somewhere else as an api to hardware? I tried to unwind things in the driver, but couldn't figure it out, what happens if you just delete these fields, does the driver still work properly? thanks, greg k-h