Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp2047303imm; Fri, 6 Jul 2018 10:50:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfep8R+P7qQbAJZ7qDgLXVzX/Cmuh53i5i1vNoYk7tWYobLercfqOoLqhXlBhlpFS7PjrpE X-Received: by 2002:a17:902:8a4:: with SMTP id 33-v6mr11030522pll.343.1530899444007; Fri, 06 Jul 2018 10:50:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530899443; cv=none; d=google.com; s=arc-20160816; b=OGap8rL89CSy/82GSo+tQXwlEwKBfdpAM9uNAYsrBV1Pwujvxx51/CaNJprJBx3/U1 abXLnE5uj1RqsCT+D9D232evR/0EehZ4igpY+aCXVHGoKedfWWnEsONeJdt5s/govQnm bTybiT0NVD19E89mxCEu8U74l9RoHfqAv7qH+HGSqhB+TZxhVx3kwlVsuDyiHu0ob3tb xGlkZ8+H4tlDD5EA+ZTKla7ObgKMVXmh0wESws1Zl44aTLB3qE4VJ5Vgec/rtY9qW3dB Lyl1q/t9xSpDxhJYTJM+M7bgrIhT4rBN5P0Kxpz2MHmJb6NHxf+awh3cQbvzGAkGEmu4 73lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=aBVNBJ3Kf4xsgmi9PZxqtVcG0a2qZ+zWrxfdzNNgkMo=; b=ScKAG2/TRioxpjdM8fwF4SDCUEehPXF+L9Ng47Dw4VfJGidzUy4Wt2FRSksMX0dHpB jb6MsvYpb8Zp4qBQOi0oOhYQyJujbMguBFj4WQlg0ZKOLb0tOxgOJyDvKZNpC5L7zx2/ 1u9oeZNnSq2lkBmz2zNXlozshwchyY8zylRwfHF8UVL2WtXBc+38Z83atYob5GJMf3Cz Sg640j7cvTFzzmNrfpNvzWc4/O1AnzhTnDwX+XxBpS++56v2c8rH1MLZDesBTOmqhCMk AyMRuPNnPZY2YoZjAMzoOQk3psGmGXioQHr8v7//KkzMbQSgGF/auHgeGNkxX4I0SLcs v3aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=iyXyKJw9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g124-v6si8778632pfb.280.2018.07.06.10.50.21; Fri, 06 Jul 2018 10:50:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=iyXyKJw9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934106AbeGFRtB (ORCPT + 99 others); Fri, 6 Jul 2018 13:49:01 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:56442 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933795AbeGFRs7 (ORCPT ); Fri, 6 Jul 2018 13:48:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=aBVNBJ3Kf4xsgmi9PZxqtVcG0a2qZ+zWrxfdzNNgkMo=; b=iyXyKJw9eKcXA5os4J/9KqLkh s4go85gTd2t2lUf+dKrNj5Z/Y8+O5K5fdXLGQ9IdlbLsKWBjNVjFKqkLwGD1rVbGqYx3lXyEyiVKD CDGp+mnbau+dyLgE0s1G/BX89M30dz/bLyBb1NQeQCl6AOqi5hzO9EZXhpGWKpDIkarLS3fCvAEwO BfeotdXYxNdp/iDSBcXnCKC0oKjZ+HgaJRCAmI0YIiMrLYRwkvMfdZHeNiqzRVgidGL0dY37d+zjJ k5H3k/IBs3tyodtmfvosE0pGUbuMpN9oyyE3haPtrf5tj3QFM6lCXHl99Ihb7TWytGNfxMvrdfn9o 0pMqr6T9Q==; Received: from static-50-53-52-16.bvtn.or.frontiernet.net ([50.53.52.16] helo=midway.dunlab) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fbUqn-0004hK-3V; Fri, 06 Jul 2018 17:48:57 +0000 Subject: Re: [PATCH] bitops: Introduce BITS_PER_TYPE To: Chris Wilson , linux-kernel@vger.kernel.org Cc: Jani Nikula , Andy Gospodarek , "David S . Miller" , Thomas Gleixner , Andrew Morton , Ingo Molnar References: <20180706094458.14116-1-chris@chris-wilson.co.uk> From: Randy Dunlap Message-ID: <48904284-14d7-45c2-cf41-0c0b311ccf7e@infradead.org> Date: Fri, 6 Jul 2018 10:48:55 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180706094458.14116-1-chris@chris-wilson.co.uk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/06/18 02:44, Chris Wilson wrote: > net_dim.h has a rather useful extension to BITS_PER_BYTE to compute the > number of bits in a type (BITS_PER_BYTE * sizeof(T)), so promote the > macro to bitops.h, alongside BITS_PER_BYTE, for wider usage. > > Signed-off-by: Chris Wilson > Cc: Jani Nikula > Cc: Andy Gospodarek > Cc: David S. Miller > Cc: Thomas Gleixner > Cc: Andrew Morton > Cc: Ingo Molnar > --- > include/linux/bitops.h | 3 ++- > include/linux/net_dim.h | 1 - > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/linux/bitops.h b/include/linux/bitops.h > index 4cac4e1a72ff..091cb17d1a9b 100644 > --- a/include/linux/bitops.h > +++ b/include/linux/bitops.h > @@ -11,7 +11,8 @@ > #define BIT_ULL_MASK(nr) (1ULL << ((nr) % BITS_PER_LONG_LONG)) > #define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG) > #define BITS_PER_BYTE 8 > -#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) > +#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE) > +#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long)) > #endif > > /* doesn't need to #include ? > diff --git a/include/linux/net_dim.h b/include/linux/net_dim.h > index 29ed8fd6379a..14f1734e740a 100644 > --- a/include/linux/net_dim.h > +++ b/include/linux/net_dim.h > @@ -326,7 +326,6 @@ static inline void net_dim_sample(u16 event_ctr, > } > > #define NET_DIM_NEVENTS 64 > -#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE) > #define BIT_GAP(bits, end, start) ((((end) - (start)) + BIT_ULL(bits)) & (BIT_ULL(bits) - 1)) > > static inline void net_dim_calc_stats(struct net_dim_sample *start, > -- ~Randy