Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp884902yba; Thu, 18 Apr 2019 11:11:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxAV1JfwSsMYt5ezb8h7SeyS5Fdbaill3yJPVlSaf/tJ78OUu76XI+oR3eAsMqKvqt+BwY1 X-Received: by 2002:a17:902:a9c7:: with SMTP id b7mr93063923plr.145.1555611065695; Thu, 18 Apr 2019 11:11:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611065; cv=none; d=google.com; s=arc-20160816; b=C9qiG+xIQLs4QangOAhIcsBX8VoAOVAMsA5UqK8gEfOG+hyreBxduXtMMlKcANB60D KE1tZecWwne7AWAICZZc/oU3jmzxSeNd95FPGvoqn/opj0PspBxzIF48ltk7laZjZ3SC vVgexz7NJGIf0aMpXhjc3ypufpQ0TCw6t/KxRjFcysprU3V38egMGPuf3sYpvmgJ4gPL cKeialKKIcNMs1pv4hgXzrkd555wXULAnAYTs1a95q/oRYg2d9wIwX19cunQOeiYWYA8 1p4yT1ihmQ+Ekq2u6ZLSaZNgd0KjdQTHy52N6jfpzb88nvq8lkQa7oDYlKJMq9Rk831S ZgZA== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+KoQnnvH8sSYpsVwpbQuGdHp5VCpBOsybHMX88vlh9o=; b=PlwzSrwmz6FxbvIBX+VX2aKNeUPrD/U+RSjCZOC4LaEUCxS/rQ90dT0UvUwR6SvEep q7OUdt59yiRi9gUlneR3ElE0PyOqQ5ctG1H36LcwMWQKxgONKao0MPPcoyTfIEEinK5x VlCUHG4ZZBVsIUuXb++MEYszRQ3dw+ouVKg++tRn3EhM6qhb6iCHLAqc4sS+Rv0GvpaR 9mqK0+wXRb1GVIXci4QiXWTq5Wc4Nmn122c/9HV+C2kIMvoDRbFZS/tKsqu9b/MLQecx xx4MxOKc8UqqVU3O3vIwWpZ0/PSw7aDjCXmZYartvotxfwtILY6ZYn56qLovwl4Q8kHC ptWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="n/sGBsKg"; 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 m3si2737743pfh.249.2019.04.18.11.10.50; Thu, 18 Apr 2019 11:11:05 -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=pass header.i=@kernel.org header.s=default header.b="n/sGBsKg"; 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 S2391832AbfDRSJF (ORCPT + 99 others); Thu, 18 Apr 2019 14:09:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:40508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391820AbfDRSJC (ORCPT ); Thu, 18 Apr 2019 14:09:02 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DF30E2186A; Thu, 18 Apr 2019 18:09:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555610941; bh=dPaVjQutAIx/PPavxXfZzfOBSONQJayQyh2tIXTJWm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n/sGBsKglu1cqaqC+uH8h58ei4WVvaDobrNYbi6SLnX1rXoSYVLrLhvKYTV+LgXXs tpF2N2J5o5WBjZ3hvUEh9uww96rB3OPopY63C8EUByFT0mjQpsT+KHdPgAVGbMSsVV pOFnL8j4blGEW/gIvkP3ayhlGokf2GpSJmKqg7rM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Alexander Sverdlin , David Ahern , Jiri Olsa , Namhyung Kim , Wang Nan , Arnaldo Carvalho de Melo Subject: [PATCH 4.9 49/50] tools include: Adopt linux/bits.h Date: Thu, 18 Apr 2019 19:58:00 +0200 Message-Id: <20190418160428.266447988@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160422.455656724@linuxfoundation.org> References: <20190418160422.455656724@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnaldo Carvalho de Melo commit ba4aa02b417f08a0bee5e7b8ed70cac788a7c854 upstream. So that we reduce the difference of tools/include/linux/bitops.h to the original kernel file, include/linux/bitops.h, trying to remove the need to define BITS_PER_LONG, to avoid clashes with asm/bitsperlong.h. And the things removed from tools/include/linux/bitops.h are really in linux/bits.h, so that we can have a copy and then tools/perf/check_headers.sh will tell us when new stuff gets added to linux/bits.h so that we can check if it is useful and if any adjustment needs to be done to the tools/{include,arch}/ copies. Cc: Adrian Hunter Cc: Alexander Sverdlin Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: https://lkml.kernel.org/n/tip-y1sqyydvfzo0bjjoj4zsl562@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/include/linux/bitops.h | 6 ++---- tools/include/linux/bits.h | 26 ++++++++++++++++++++++++++ tools/perf/check-headers.sh | 1 + 3 files changed, 29 insertions(+), 4 deletions(-) --- a/tools/include/linux/bitops.h +++ b/tools/include/linux/bitops.h @@ -3,7 +3,6 @@ #include #include -#include #ifndef __WORDSIZE #define __WORDSIZE (__SIZEOF_LONG__ * 8) @@ -12,10 +11,9 @@ #ifndef BITS_PER_LONG # define BITS_PER_LONG __WORDSIZE #endif +#include +#include -#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) -#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) -#define BITS_PER_BYTE 8 #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) #define BITS_TO_U64(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u64)) #define BITS_TO_U32(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u32)) --- /dev/null +++ b/tools/include/linux/bits.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LINUX_BITS_H +#define __LINUX_BITS_H +#include + +#define BIT(nr) (1UL << (nr)) +#define BIT_ULL(nr) (1ULL << (nr)) +#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) +#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) +#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 + +/* + * Create a contiguous bitmask starting at bit position @l and ending at + * position @h. For example + * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. + */ +#define GENMASK(h, l) \ + (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) + +#define GENMASK_ULL(h, l) \ + (((~0ULL) - (1ULL << (l)) + 1) & \ + (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) + +#endif /* __LINUX_BITS_H */ --- a/tools/perf/check-headers.sh +++ b/tools/perf/check-headers.sh @@ -4,6 +4,7 @@ HEADERS=' include/uapi/linux/fcntl.h include/uapi/linux/perf_event.h include/uapi/linux/stat.h +include/linux/bits.h include/linux/hash.h include/uapi/linux/hw_breakpoint.h arch/x86/include/asm/disabled-features.h