Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1599112imm; Fri, 6 Jul 2018 03:06:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcX/27Sy89zXIsPco1bxLNwsZ7UOsWC4+xiEvCjzNlc5DjbVhS6AAbeQ8zIlSzcVSLrdrAd X-Received: by 2002:a17:902:1127:: with SMTP id d36-v6mr9772355pla.267.1530871611331; Fri, 06 Jul 2018 03:06:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530871611; cv=none; d=google.com; s=arc-20160816; b=VhSk42oivj6S1RMIgq5GVHnLnyTIrFpGEoc5z0aL47z+TEnTSwZmnj4sMeAvuEWV3g /EPCL+FW27xEiLQie2GvVrXLNuhsBuKZBF1o/E8aq6k9bdTdmskR26VLI7repyAHDDHa OU+jcnYG0KQhst1qJKacjhpyDgp1v86jcdT6gXCpmnwPKLoic5mpc1VeBNdP1yJGVIsU N1AIA8VOcPQw8kPFVR2WQUYitQot8AY+zdqooo5P72Sr6Y3TD7VQGMMM+m1CGuv32KT3 RH+3JfaCStrSqU9AdDE+ugMO14DcJ7iRHtBP9vGTM0ihwiKlTKn9BqOC7iHNPhcOXgEo oxxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from :arc-authentication-results; bh=On8hSlsjHnJdPzXArxF4EDo25e+9vPx02UdXOjo1B6c=; b=JChHu4/6N0uonoehMUSOBZoYU7nzsJyj7z1Hi59wf68DSX3LknDeCl6o2IcyitZpMC lDZg+dxZQMWvsPS5P9Q31oSuNBk2wIqRbVjTFWGOH/3O4j+eZ5Ix42ioQuvEL/diBpeg 3NFQ20opgabFHZnWkXuz/F9MV+ywLfdGAEdmmsx2GBdkAKVRl80/xAzXnfr4d9DlVO3+ fgmkSIFBGS8qb85rw3tWUKuOfTpGk0ittl0IM5hl3jEqujtF4A1YRfYZYxUJc1a/Xbrk FPqTQ203ntc42rpPijPXgQ42SlBN6EO2phkK6hRoh8Li+pkNiuQTw2b6Eb3IEmgFnQKG x+Ng== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o81-v6si8653194pfj.350.2018.07.06.03.06.35; Fri, 06 Jul 2018 03:06:51 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753604AbeGFKF6 (ORCPT + 99 others); Fri, 6 Jul 2018 06:05:58 -0400 Received: from mga17.intel.com ([192.55.52.151]:32282 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753586AbeGFKD5 (ORCPT ); Fri, 6 Jul 2018 06:03:57 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jul 2018 03:03:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,315,1526367600"; d="scan'208";a="70125523" Received: from jnikula-mobl2.fi.intel.com (HELO localhost) ([10.237.72.62]) by fmsmga001.fm.intel.com with ESMTP; 06 Jul 2018 03:03:51 -0700 From: Jani Nikula To: Chris Wilson , linux-kernel@vger.kernel.org Cc: Chris Wilson , Andy Gospodarek , "David S . Miller" , Thomas Gleixner , Andrew Morton , Ingo Molnar Subject: Re: [PATCH] bitops: Introduce BITS_PER_TYPE In-Reply-To: <20180706094458.14116-1-chris@chris-wilson.co.uk> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20180706094458.14116-1-chris@chris-wilson.co.uk> Date: Fri, 06 Jul 2018 13:03:35 +0300 Message-ID: <87muv4n0js.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 06 Jul 2018, 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 Reviewed-by: Jani Nikula > --- > 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 > > /* > 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, -- Jani Nikula, Intel Open Source Graphics Center