Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp2056963imm; Fri, 6 Jul 2018 11:01:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeP0RKFPuk/PhxmrKKWr6/HQo6HH4Gl7CzgVi7SCqUhVzDCsJIFwD3QSXixz8zqS9QXZyY7 X-Received: by 2002:a17:902:9a8a:: with SMTP id w10-v6mr11174383plp.333.1530900100249; Fri, 06 Jul 2018 11:01:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530900100; cv=none; d=google.com; s=arc-20160816; b=yR8eI7rMVsxIzOrUUnpHNP1wf/YUpM/wSDUgoC7B5bJTV/8IGhdy3sQ9oyial8Ciet cC75lxzBD2hhlFz9/o2MyNcfyeRcvW+Qw9ZwjFP5ZhbeTSI5Z2KFPizZ44qrK6WvP7FK BADwTN5ZLKkpaVWqxQWU4cB5X424Ou7bKVh0r0gpTl6vh2kic0MrqlFfVNTQ44ywrz/J Httj7ctv+rdj/5OgB5EjDvuiVFk8e5zu9EeCvs+he2ytRM2EBDU3WConYF1QhUV37l0Y rXNSPMYxsA4MryjceKAwNI+zYGHtOxWIZUB/jey2hi4IoCLq/SNR/G0ctRE8Z1UonUMq lNuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:user-agent:message-id :references:cc:in-reply-to:from:to:content-transfer-encoding :mime-version:arc-authentication-results; bh=PnHnEiFtReurWx/fBiGGaJ0g0wFSxUXBlM9FKh5S2/4=; b=1KGGb/6/EyfDhsJHQE7h34u9QFMx6pdYvnJRSgFJy3CJ+bHlAXpRMCxXvkvTr3KQZL nfwOlpXWAbqFkqd08ItjyQjLbe9MaM1gz+qfYe5Y3ElWE/cuQD/mK2HreEXk51l2cqcu bsDDiORUCJjlS+L1Qw+UqvbrG3pEAlbwYkCAX8KgzMmKHJKr6fDdzO7NLCBRxV5+vxQ0 PNWs813FSZyNIUtDWgzpSitxD5jhW4/g0A3GRCiMe0oh2Du+SN5oa5l874W/j//ymgkR Y9//d6aeMlUBERe3rnpvajhUgbeaBRr3qOHNhDNk9DIrcAYiwokXTPmDfbHM3IIg6eaR Lfow== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r21-v6si7858835pgu.55.2018.07.06.11.01.25; Fri, 06 Jul 2018 11:01:40 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934176AbeGFSAv convert rfc822-to-8bit (ORCPT + 99 others); Fri, 6 Jul 2018 14:00:51 -0400 Received: from mail.fireflyinternet.com ([109.228.58.192]:57743 "EHLO fireflyinternet.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934028AbeGFSAu (ORCPT ); Fri, 6 Jul 2018 14:00:50 -0400 X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from localhost (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP (TLS) id 12277875-1500050 for multiple; Fri, 06 Jul 2018 19:00:18 +0100 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT To: Randy Dunlap , linux-kernel@vger.kernel.org From: Chris Wilson In-Reply-To: <2d7d3dfc-e7cc-f844-4728-e1dbe13858fe@infradead.org> Cc: Jani Nikula , Andy Gospodarek , "David S . Miller" , Thomas Gleixner , Andrew Morton , Ingo Molnar References: <20180706094458.14116-1-chris@chris-wilson.co.uk> <48904284-14d7-45c2-cf41-0c0b311ccf7e@infradead.org> <153089946144.7594.5374061827926275070@cwilso3-mobl.ger.corp.intel.com> <2d7d3dfc-e7cc-f844-4728-e1dbe13858fe@infradead.org> Message-ID: <153090001992.7594.17876223022816534941@cwilso3-mobl.ger.corp.intel.com> User-Agent: alot/0.6 Subject: Re: [PATCH] bitops: Introduce BITS_PER_TYPE Date: Fri, 06 Jul 2018 19:00:20 +0100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Randy Dunlap (2018-07-06 18:55:57) > On 07/06/18 10:51, Chris Wilson wrote: > > Quoting Randy Dunlap (2018-07-06 18:48:55) > >> > >> 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 ? > > > > It already has to in order to obtain BITS_PER_BYTE. Just doesn't do so > > directly. > > Right. and does that work on all $ARCHes? It's a pre-existing dependency in the header, net_dim.h cannot compile unless BITS_PER_BYTE is defined i.e. bitops.h is included. The patch does not affect that. -Chris