Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp1078820ybm; Wed, 27 May 2020 15:48:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFJYgJX2A4AuuAusugi00aByqw0A1pmyO8peepTIysxoRAY3KOh4LgAwej0GMDukjzG736 X-Received: by 2002:a17:907:4096:: with SMTP id nm6mr529463ejb.30.1590619736039; Wed, 27 May 2020 15:48:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590619736; cv=none; d=google.com; s=arc-20160816; b=x3Yj+YSFrEKzYVtq9y3o9LwAPWe3s9t10UqZ5PQoEEkEW5GAsxVbVNuqm5DJ1mIPSO huRqfGx3I8oZYZ4FxMEdonud7xXdJNJhVWKyUAhWC2+UEASzIEAAcW6w+nz4iQpOYlUN QBBkiGmXcRukcJ3nEC8Njq7w/MWzJFl4/J1R/pIRmiVAX191wxLH1F4Qx8YPQCjo6bCV Q1yLrPKnw5bgCdIbQM5lf6XjEIThUfFwgjPeXRpgfybnk4rOk8ZXO7ZA61hCajokNfbm cokdoi71PiGq8AGE8zLBGJFa5NPlopIn80YYs6fxExuK82vfyhPZRCJRGC8Z1hKzNOYw WOCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=3sbcMftoxYa/Xr/vjAkRZEKjD0XqOCCZ3yYeqA4uvYw=; b=xKOzVgtzmbM+iX0mXOiVg5igZRWS3thz/SGI0lcWjnYFSOAGxL4kCgMXbkWivIfPES EUVf0TQQTnHHPBV6/QbB3qwgios7tPdCceHK1Mu6Gsuw5n6xiEwHWCDbmd3WCLeOMo6Z 1059EdQN6XtJ5rfbEDW96Y5b/B9JG42La75u4kADrWfU08Pm0z12e2q+of+lJQUsVxQV u/E7nklhSKamO0qa1LwVJCMUVEXvpiZGxdDDrWOHkgnTeC2JxcGwCtzWTCVvhEMxdXL8 uElCFCfQlRq3ayP0VXSS77b+gh1nAiDiAbgUp3uv2KZB78BWrXbTxLmV/Inpd54ajyDv ZMpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OpVmoKmF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a24si2858768eje.95.2020.05.27.15.48.32; Wed, 27 May 2020 15:48:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OpVmoKmF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726334AbgE0Wpr (ORCPT + 99 others); Wed, 27 May 2020 18:45:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725896AbgE0Wpq (ORCPT ); Wed, 27 May 2020 18:45:46 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 381FDC08C5C1 for ; Wed, 27 May 2020 15:45:45 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id y13so8009149eju.2 for ; Wed, 27 May 2020 15:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=3sbcMftoxYa/Xr/vjAkRZEKjD0XqOCCZ3yYeqA4uvYw=; b=OpVmoKmFVDV8dviwNPeIyKVKsVCZXMzBNdAnQQgKzga9biUM2aBnPu3XvSTBnUU75R p0HNCABSwKAzdm0N5w/B2ddu5/pxX7g59yovMgSm3ya+pYQEYNfYAxBGKaqe67pqFRw/ TIPJZL0VClnMu6KNJKPDt36kSWwVEYtMPEq1OTA1pjGvoC7Ov9OxtAQb3wEFk/bZOYvJ 70Vi+pPjkeTlVeOpu5BUhV4TWzsfGWKMsXcuorJbDc9MMG6evxMUe9JPomltWxu1qzMG Gmd929aUSeksVhLK3syWE9JurToXBwHs8E2eJTwi34XAs88Y0uU4yu+IVPgblwCNi9p2 LuCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=3sbcMftoxYa/Xr/vjAkRZEKjD0XqOCCZ3yYeqA4uvYw=; b=l+ysgI6E5eXI2EH4fkSHh1n290kKJ04LQTbYIlDUxPzaWllolgWkB+jmThTz3fdsru 1bKYMuxT5gNbSGJfD95/62CcjY/BEqJYaK6iQAxscCjLKwvouQr2rOk64djtx9Srx3ZE ep9xwhHu1ovr67dhP1/N5dbTnlD8abzOkICfmU80Eq+mzBIQyxEP4CpgErBEfW0/iyeP zrsBCqv3NLQmXbbGVGgCpPAZZ3XTiaFzprha2JZPPN4zuXrjj4ZrWlRSP4h408K04gBX gbkICDbsUACQGGxUTY0x+C9ScRapB6w0Ew1h5HVm5T1XDe1IO0frKSQk2v2maXVWcIbv aBzg== X-Gm-Message-State: AOAM533yMQ+bNec3EjaxQSmuJLNxuZ0LgEApwPbaloESJoKT0J3OX769 7rL6uHt+o1BRh8sTy9m4fPE= X-Received: by 2002:a17:906:4995:: with SMTP id p21mr500870eju.19.1590619543941; Wed, 27 May 2020 15:45:43 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id l29sm3325727edj.74.2020.05.27.15.45.42 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 May 2020 15:45:42 -0700 (PDT) Date: Wed, 27 May 2020 22:45:42 +0000 From: Wei Yang To: Andrew Morton Cc: Wei Yang , Andy Shevchenko , Jesse Brandeburg , christian.brauner@ubuntu.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bitops: simplify get_count_order_long() Message-ID: <20200527224542.yx45druzqtlaxrl7@master> Reply-To: Wei Yang References: <20200524123551.9469-1-richard.weiyang@gmail.com> <20200525091458.GK1634618@smile.fi.intel.com> <20200525144312.mbw2z3ydncyasvss@master> <20200525153216.GD1634618@smile.fi.intel.com> <20200525134110.5737dd603d5fa1230e2f7ece@linux-foundation.org> <20200525215741.zd3gry4yyqqplix6@master> <20200525153146.c1337b1ca7af386ac30e5702@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200525153146.c1337b1ca7af386ac30e5702@linux-foundation.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 25, 2020 at 03:31:46PM -0700, Andrew Morton wrote: >On Mon, 25 May 2020 21:57:41 +0000 Wei Yang wrote: > >> I see the patch just merged, so I suppose to add the above test code into that >> one? > >Well, that's not really test code. > >But yes, something which tests both the 32-bit and 64-bit functions would be >nice, sometime. Mimic the test_bitops.c, I wrote a test like this: /* a tiny module only meant to test get_count_order/long */ unsigned int order_comb[][2] = { {0x00000003, 2}, {0x00000004, 2}, {0x00001fff, 13}, {0x00002000, 13}, {0x50000000, 32}, {0x80000000, 32}, }; static int __init test_getorder_startup(void) { int i; for (i = 0; i < ARRAY_SIZE(order_comb); i++) { if (order_comb[i][1] != get_count_order(order_comb[i][0])) pr_warn("get_count_order wrong for %lx\n", order_comb[i][0]); } return 0; } Since I don't get a way to iterate all the possibilities, some random combination is chosen. Is this one looks good? -- Wei Yang Help you, Help me