From patchwork Tue Nov 21 17:38:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119377 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5570666qgn; Tue, 21 Nov 2017 09:43:40 -0800 (PST) X-Google-Smtp-Source: AGs4zMZNBQ763t7YN0sAY3w++f+gY5SsTPdiGNsnqOPi3fS4qLjB/kLqRyiKFbLSGyE3R/n2BzI3 X-Received: by 10.80.149.253 with SMTP id x58mr25088406eda.152.1511286220441; Tue, 21 Nov 2017 09:43:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511286220; cv=none; d=google.com; s=arc-20160816; b=PUcJZHLPMTRUj9X5Y5chwbKuAgzM1E2CPG5mplBS0a/12apw6ZTA4VPkBwvKGxSzG7 kc2RxZA8TVP9zKwmrHRFVz5xLXvvHHwkiumTkq/bQpmqX7m2TAmCq7TXXmcdaxklp0BX 1KIKX+nO4bDQB1gmmGKMQ/NkSZTaU4+va6VE9PzWBCMa/DuRRri1I7piM/4UOSUsI8mJ PXoJRHKpMWucL0hupweuZuvqZL4cgGoBO/W8sHcclwYhdD9Dpi0TkAIqjPMJR3ZdlOfa mIUFz8gLhnTrUsRmgomzoy7H/AtHhROZbJ7wEd6AUip4yJF9j2Sj19Vcv+esdssbppcN bB6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:dkim-filter:arc-authentication-results; bh=fSG9TXsZh69+sAMFZHNBZFtMofHcWfX9r2RdBlMyKLA=; b=HmxqfojMzRbJjVvptrtskEMmRsDfE8KLgfN2smvkCLD+HbWgB6hvVsIoXwGN5GLLQh 2ckkLCnvZB+agPAouYcsUy2KP7atPFQGGcb/OaQJn1jw69etKoI0ovemRcOk1lKZph8R oNyvoDk7SLtag4YWL46AkXZyDg684qm3QM4Uum+Bip15D29ieiVrJa1ABzTEjpnX2QwS yGdeMFKQET/DNi3LruScUI/7+GNPsgpmmrGjPc+SK8f7gPHKt4yJYxS9mIqHYsHYdpJj nhgR3Hnk2+J5urpGr/Lj0+mkO89rN1dSlW+wYluzLG2O0JOADLNlW52t3+3p6dGOuVTt Z+9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=YTIEKnyL; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id l63si4142105edl.104.2017.11.21.09.43.40; Tue, 21 Nov 2017 09:43:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=YTIEKnyL; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id DDE4DC21DEF; Tue, 21 Nov 2017 17:42:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 14FE5C21F71; Tue, 21 Nov 2017 17:39:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 40146C21DF1; Tue, 21 Nov 2017 17:39:07 +0000 (UTC) Received: from conuserg-07.nifty.com (conuserg-07.nifty.com [210.131.2.74]) by lists.denx.de (Postfix) with ESMTPS id 7FC98C21E4B for ; Tue, 21 Nov 2017 17:39:03 +0000 (UTC) Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-07.nifty.com with ESMTP id vALHcbtp001225; Wed, 22 Nov 2017 02:38:38 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com vALHcbtp001225 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511285918; bh=SVoPrbEjFHzDSnLD06gkZULp6gLN2ERKJ38NxYhknh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YTIEKnyLMPWgyDMewG2Yofmst4AbctVHrbINfF/N49tU20p92+73hVchycFDzskmz 28HCNc5SgzLGap8lBqC4TSMltYaweKgg0lFlHpkVO6JYsHfvEE7T3WuuITQQKi5DaS c4lsIoewf2M1bgRDBIfKDr66K0/iCKZGvxNDOb5WHkSQ472sHx2YWgUQLuZ1j+yFFT Uad/zYuShxQbNyC5zrTBIBQWNTjYTroZKUAsDCtmGzDNk0Vkpwxb+DVFRRJDFPRaDs waJTsUkSdLvsN65T3/oQ9hjq/JOpEeweFa9xtc7/w2xcphGBnuuAW65M1e3ODbWAF0 SUt7MICNBIXoA== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Wed, 22 Nov 2017 02:38:11 +0900 Message-Id: <1511285912-12452-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511285912-12452-1-git-send-email-yamada.masahiro@socionext.com> References: <1511285912-12452-1-git-send-email-yamada.masahiro@socionext.com> Cc: Scott Wood Subject: [U-Boot] [PATCH 01/22] bitops: collect BIT macros to include/linux/bitops.h X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Same macros are defined in various places. Collect them into include/linux/bitops.h like Linux. Signed-off-by: Masahiro Yamada --- arch/arm/include/asm/arch-sunxi/dram_sunxi_dw.h | 3 ++- arch/arm/mach-kirkwood/include/mach/gpio.h | 4 ---- drivers/gpio/kw_gpio.c | 2 +- drivers/mtd/nand/nand_base.c | 2 -- include/linux/bitops.h | 7 +++++++ include/usb/lin_gadget_compat.h | 4 +--- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/arm/include/asm/arch-sunxi/dram_sunxi_dw.h b/arch/arm/include/asm/arch-sunxi/dram_sunxi_dw.h index 03fd46b..66e206d 100644 --- a/arch/arm/include/asm/arch-sunxi/dram_sunxi_dw.h +++ b/arch/arm/include/asm/arch-sunxi/dram_sunxi_dw.h @@ -13,6 +13,8 @@ #ifndef _SUNXI_DRAM_SUN8I_H3_H #define _SUNXI_DRAM_SUN8I_H3_H +#include + struct sunxi_mctl_com_reg { u32 cr; /* 0x00 control register */ u32 cr_r1; /* 0x04 rank 1 control register (R40 only) */ @@ -211,7 +213,6 @@ struct sunxi_mctl_ctl_reg { * the 32-bit wide access consists of. Also three control signals can be * adjusted individually. */ -#define BITS_PER_BYTE 8 #define NR_OF_BYTE_LANES (32 / BITS_PER_BYTE) /* The eight data lines (DQn) plus DM, DQS and DQSN */ #define LINES_PER_BYTE_LANE (BITS_PER_BYTE + 3) diff --git a/arch/arm/mach-kirkwood/include/mach/gpio.h b/arch/arm/mach-kirkwood/include/mach/gpio.h index aa8c5da..ac2397d 100644 --- a/arch/arm/mach-kirkwood/include/mach/gpio.h +++ b/arch/arm/mach-kirkwood/include/mach/gpio.h @@ -15,10 +15,6 @@ #ifndef __KIRKWOOD_GPIO_H #define __KIRKWOOD_GPIO_H -/* got from kernel include/linux/bitops.h */ -#define BITS_PER_BYTE 8 -#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) - #define GPIO_MAX 50 #define GPIO_OFF(pin) (((pin) >> 5) ? 0x0040 : 0x0000) #define GPIO_OUT(pin) (MVEBU_GPIO0_BASE + GPIO_OFF(pin) + 0x00) diff --git a/drivers/gpio/kw_gpio.c b/drivers/gpio/kw_gpio.c index 43b27e3..cc26cc1 100644 --- a/drivers/gpio/kw_gpio.c +++ b/drivers/gpio/kw_gpio.c @@ -14,7 +14,7 @@ */ #include -#include +#include #include #include #include diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 5bb4ea8..efe3e4f 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -901,8 +901,6 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip) return status; } -#define BITS_PER_BYTE 8 - /** * nand_check_erased_buf - check if a buffer contains (almost) only 0xff data * @buf: buffer to test diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 576b15d..a47f6d1 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -5,9 +5,16 @@ #include #include +#ifdef __KERNEL__ #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 +#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) +#endif /* * Create a contiguous bitmask starting at bit position @l and ending at diff --git a/include/usb/lin_gadget_compat.h b/include/usb/lin_gadget_compat.h index 4a01585..d0d71f7 100644 --- a/include/usb/lin_gadget_compat.h +++ b/include/usb/lin_gadget_compat.h @@ -10,12 +10,10 @@ #ifndef __LIN_COMPAT_H__ #define __LIN_COMPAT_H__ +#include #include /* common */ -#define BITS_PER_BYTE 8 -#define BITS_TO_LONGS(nr) \ - DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) #define DECLARE_BITMAP(name, bits) \ unsigned long name[BITS_TO_LONGS(bits)]