Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp369808rwl; Fri, 4 Nov 2022 01:07:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6B91pwbPYXmL/t+oGPsL9yuJcKy+xuZLrJe5Qd2kQXZOz56x1Fst8CxzrVo50W6cHl/+gh X-Received: by 2002:a17:907:743:b0:740:ef93:2ffc with SMTP id xc3-20020a170907074300b00740ef932ffcmr33195120ejb.514.1667549224427; Fri, 04 Nov 2022 01:07:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667549224; cv=none; d=google.com; s=arc-20160816; b=zhKp4bsi6Aiw2GIqyg5+hiSJeKKpdOk7ATiscKZNJuUFPwN1bApC6C7Qzkzcldp0G+ ZNdXe54yUsEF3b69cBGSq+C8bojKanRy5MozTkJetV+JmOFHUkEclirwMO2LRluclWWQ DV9o41f7xBEontV92SDckGNNT+O2+/ASM4FOlhZP6ncyiHU8yn6ei4tGjbdNWPc7gmDf x2+mjhYFJwVqnl8VjoJvJAVklPN2eBdXkWvNKUVRZkHJonrYSgXZ3mYxsB0c70eFCIyO wbSWQz2ZHEIvp4yLVs8/Md5CLBIhdb/IJp392r2rl043AvrSvND60/zIcA1njKy96xYN f6Aw== 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=BizkBEQAAOh+InyXtCIedHsPHRwHL9ky2m39RN8K3dY=; b=uwr8KGopjgsyYUWqHWhOTTmfhcAqJTs4LDk7uX13Xz5CiXRq/s1rjFnGayuQ/FhR9p nqwMtNdLIe4ZBzS4EXnnnF1VJmjngZenmqVGKFyw8/L+b4LTobVoxmtvXW6XZ9VP6luk eNzL+xOn+XqrxaAUQZGJNoGMbixc/f6820BF1wOum8KOsf24+Ik+iIN0fWW5FEJRA82X /Znl7Qa4T005jbUhN6Vgjl3MK/OHzIC8j8N+uPTGK4fCcjOUOF0IynWWhOgfG6b7BVaw QAZDKp9rR/fMCHaGA/qXJfG3uuID7cCzGtLzs9Z3hoGKdTLN+FxeejEBxUbI9IzZo0OI uVzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b="GW/j562S"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q6-20020a056402518600b00457f31c1a10si4922085edd.584.2022.11.04.01.06.40; Fri, 04 Nov 2022 01:07:04 -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=fail header.i=@mailo.com header.s=mailo header.b="GW/j562S"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231169AbiKDIBs (ORCPT + 97 others); Fri, 4 Nov 2022 04:01:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbiKDIBo (ORCPT ); Fri, 4 Nov 2022 04:01:44 -0400 Received: from msg-2.mailo.com (msg-2.mailo.com [213.182.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D91825E90 for ; Fri, 4 Nov 2022 01:01:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1667548891; bh=ZXbEFO3vszBBy6fk5O/FA9iq9h+aX2yhtD8lxQvGyyY=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=GW/j562SKvbtefjP1da8C0bPUhXMdhSu+WiSuZqa0eGV0Rxv9CgfM/sSN45a+dsWr ghPCXresOipC1pAgzV+xRAUfOaevRNjMDNEXAe5cSdojbvpcVCMpUfJQFQvZEFU4/i 1cX8raOMQ3wTTj9WvW7RKoxEtvsvW887NKQcERRQ= Received: by b-4.in.mailobj.net [192.168.90.14] with ESMTP via ip-206.mailobj.net [213.182.55.206] Fri, 4 Nov 2022 09:01:31 +0100 (CET) X-EA-Auth: TUR8vkepu6ByoPiTb+uNlOvt9qpGRr7QafjQ7F7kzVZlMHyVldXK0bfWPOhHlnqBQIWdY5EGAPyjjPVaNYhh/eEZ9L3B/oI5 Date: Fri, 4 Nov 2022 13:31:21 +0530 From: Deepak R Varma To: Dan Carpenter Cc: David Laight , "outreachy@lists.linux.dev" , Greg Kroah-Hartman , "linux-staging@lists.linux.dev" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] staging: rtl8192e: Use min_t/max_t macros for variable comparison Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 03, 2022 at 01:09:20PM +0300, Dan Carpenter wrote: > On Thu, Nov 03, 2022 at 02:48:35PM +0530, Deepak R Varma wrote: > > On Thu, Nov 03, 2022 at 11:53:45AM +0300, Dan Carpenter wrote: > > > On Thu, Nov 03, 2022 at 08:24:15AM +0000, David Laight wrote: > > > > > --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c > > > > > +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c > > > > > @@ -587,17 +587,12 @@ void HTOnAssocRsp(struct rtllib_device *ieee) > > > > > else > > > > > pHTInfo->CurrentAMPDUFactor = HT_AGG_SIZE_64K; > > > > > } else { > > > > > - if (pPeerHTCap->MaxRxAMPDUFactor < HT_AGG_SIZE_32K) > > > > > - pHTInfo->CurrentAMPDUFactor = > > > > > - pPeerHTCap->MaxRxAMPDUFactor; > > > > > - else > > > > > - pHTInfo->CurrentAMPDUFactor = HT_AGG_SIZE_32K; > > > > > + pHTInfo->CurrentAMPDUFactor = min_t(u32, pPeerHTCap->MaxRxAMPDUFactor, > > > > > + HT_AGG_SIZE_32K); > > > > > > > > For min() to fail there must be a signed v unsigned mismatch. > > > > Maybe that ought to be fixed. > > > > > > > > > > u32 is the right choice here. > > > > > > I'm having a hard time understanding your email. You might be saying > > > we could declare HT_AGG_SIZE_32K as a u32 so then we could use min() > > > instead of min_t()? HT_AGG_SIZE_32K is an enum. > > > > > > pPeerHTCap->MaxRxAMPDUFactor is a bitfield. > > > > > > u8 MaxRxAMPDUFactor:2; > > > > > > We will never be able to use min(). > > > > I think we could do min((u32)a, (u32)b), but it is just unwrapped min_t > > if I understand David's comment. > > > > No. Do not do that. I think it's a checkpatch warning. What you have > is fine. > > > > > > > > > } > > > > > } > > > > > - if (pHTInfo->MPDU_Density > pPeerHTCap->MPDUDensity) > > > > > - pHTInfo->current_mpdu_density = pHTInfo->MPDU_Density; > > > > > - else > > > > > - pHTInfo->current_mpdu_density = pPeerHTCap->MPDUDensity; > > > > > + pHTInfo->current_mpdu_density = max_t(u8, pHTInfo->MPDU_Density, > > > > > + pPeerHTCap->MPDUDensity); > > > > > > > > Using u8 with max_t() really doesn't make any sense. > > > > > > Using u8 looks wrong because you would worry that one of the types is > > > larger than U8_MAX. But it's actually fine. The types are u8 vs another > > > bitfield. I would probably have gone with u32 here as well. > > I will take your advise and upgrade the type to u32 as a revision. > > Sounds good. It's not something I would have asked you to redo the > patch over, but it would have been my personal preference. That is no problem. I am waiting on David to elaborate on his feedback and accordingly plan a consolidated revision. > > regards, > dan carpenter > >