From patchwork Wed Mar 29 11:54:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mason X-Patchwork-Id: 9651421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CC3EB601D7 for ; Wed, 29 Mar 2017 11:55:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA27926CFF for ; Wed, 29 Mar 2017 11:55:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEE3128469; Wed, 29 Mar 2017 11:55:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5098A26CFF for ; Wed, 29 Mar 2017 11:55:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date:Message-ID:Subject: From:To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=I5RCBPRFPu9XPq7/9qt3ZLBQ3lvM73BIE+4U2K4HDPM=; b=JtEwoDeFpkhvh9 WWadwzx2TWHeTLIEDXkWhRSmmLl41Pf9pEqvbJemw6pN7AMrWbnXpWJDL5mq+i1si70nQ4cEXVvWX h52AX3lqUkGFIw7KuD4weyMqC8ef2+3kRUilCwFjCZF+Qhfdj/sr5N367QBCvMm9GoTGqWTJvD5pd qCZ7X6yXSRMmeCH0O4R6UTX8D77OoQ8C2WN++QpTRwwE8kEJjhyB8LVcHPZH6jO91ycma55GdBnD2 /AZFCifaLgMhiqZK0vlh+RpVxEbx655JwHkJ+J8xzx7ADiTmGUpqkb+CDm/H7ECSfRqNWMiJLy6q+ 90Id5nLg4GNhrT1C5CSQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ctCCC-0006VN-HL; Wed, 29 Mar 2017 11:55:24 +0000 Received: from smtp5-g21.free.fr ([212.27.42.5]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ctCC7-0005DB-IE for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2017 11:55:22 +0000 Received: from [172.27.0.114] (unknown [92.154.11.170]) (Authenticated sender: slash.tmp) by smtp5-g21.free.fr (Postfix) with ESMTPSA id 4E8CD5FFBA; Wed, 29 Mar 2017 13:54:51 +0200 (CEST) To: Russell King From: Mason Subject: Prototype of find_first_zero_bit in bitops.h Message-ID: <87371ad9-012b-358d-f186-f8caa79feb0f@free.fr> Date: Wed, 29 Mar 2017 13:54:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0 SeaMonkey/2.48 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170329_045519_806043_3B52E2FD X-CRM114-Status: UNSURE ( 7.95 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux ARM Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hello Russell, Just wanted to run something by you. In some driver code, I was passing the address of a u32 to find_first_zero_bit() and the maintainer smacked me, pointing out that find_first_zero_bit only accepted (unsigned long *) Would it make sense to change the prototype of _find_first_zero_bit_le() so that my mistake would be caught by the compiler like this: CC drivers/pci/host/pcie-tango.o In file included from ./include/linux/bitops.h:36:0, from ./include/linux/kernel.h:10, from ./include/linux/list.h:8, from ./include/linux/smp.h:11, from ./include/linux/irq.h:12, from ./include/linux/irqchip/chained_irq.h:21, from drivers/pci/host/pcie-tango.c:1: drivers/pci/host/pcie-tango.c: In function 'tango_irq_domain_alloc': drivers/pci/host/pcie-tango.c:122:28: error: passing argument 1 of '_find_first_zero_bit_le' from incompatible pointer type [-Werror=incompatible-pointer-types] pos = find_first_zero_bit(&mask, 32); ^ ./arch/arm/include/asm/bitops.h:199:59: note: in definition of macro 'find_first_zero_bit' #define find_first_zero_bit(p,sz) _find_first_zero_bit_le(p,sz) ^ ./arch/arm/include/asm/bitops.h:162:12: note: expected 'const long unsigned int *' but argument is of type 'u32 * {aka unsigned int *}' extern int _find_first_zero_bit_le(const unsigned long * p, unsigned size); ^ Proposed trivial patch: --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -159,8 +159,8 @@ static inline void ____atomic_change_bit(unsigned int bit, volatile unsigned lon /* * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. */ -extern int _find_first_zero_bit_le(const void * p, unsigned size); -extern int _find_next_zero_bit_le(const void * p, int size, int offset); +extern int _find_first_zero_bit_le(const unsigned long *p, unsigned size); +extern int _find_next_zero_bit_le(const unsigned long *p, int size, int offset); extern int _find_first_bit_le(const unsigned long *p, unsigned size); extern int _find_next_bit_le(const unsigned long *p, int size, int offset);