From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91F59C43381 for ; Tue, 26 Mar 2019 10:28:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5FE8420830 for ; Tue, 26 Mar 2019 10:28:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lNjt/IIu"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aVrUFhly" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5FE8420830 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xqDO5nwZ0DEyZUDOeB4Q9Hoi+e5857larwFyJ+eM/pk=; b=lNjt/IIuCPPpAM H4ovDK8tkdJW3aTudwtNgWrHaOOrV568WjyvxSAxJDC5xWePN6vcedBE9gNXFpR2n4w7eNp3vINBU /xUY9GbgLE85y68xKvDuSKJgohrnwO3qEukcamxSGbZFJuC4YwW3sBLlG91YH0qm68y4AmiSP18Lv lMEoqxrTSzDNmsf1Muq3xdOv0X/E+cyH86ld/JhtX+2kTrt6GXKR//fDubwZ/7WuQfsyek5xqZfhE NkUiApXygs698TXkLNiHpvhR9KUrtxWrP1cz2Cz/j77zV4gdrbOueRED3wgl+Rm8UsDRIEJYiXLZi yx3qYrA25/MJv4SmrwoQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8jJP-0002Sy-TU; Tue, 26 Mar 2019 10:28:07 +0000 Received: from mail-it1-x141.google.com ([2607:f8b0:4864:20::141]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8jJI-0002RY-Uo for linux-arm-kernel@lists.infradead.org; Tue, 26 Mar 2019 10:28:05 +0000 Received: by mail-it1-x141.google.com with SMTP id e24so18691104itl.1 for ; Tue, 26 Mar 2019 03:27:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tlAk1qNw3eNBVB2PmRA+DTGTHvUydulAWbcIGX59EZ4=; b=aVrUFhlyI99XTFkw2vLuUB98sj5T4+hOrAFCMv4C3a0ZZK+6XCjzgA1IHP7Z/4DwHZ Xdap1DfOPvhfeVJWrwG+nGB0p4LNYdjW3PumIUjibIsdYc/YcCJW63oJOl3w7Le8EdEE CYWWvpDsXEZaioB4wAKAhKkOCs+wQ6KunvteIzQcgCiLb8eYGo/oM+ocNYZJhD/mbpma H8oXa61dppX1ARN4QO/o82lbugUrLuG8ZEw4ElEFYzMvvZYPY+TOcSrVklk+6vWxMulO 1QdZmTNGXsaL0gX+QSQylrZiApBMcmIHCrFUR9N/05pnu9vHgZ1tNpCEFhhQ8TPt8SwR vREA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=tlAk1qNw3eNBVB2PmRA+DTGTHvUydulAWbcIGX59EZ4=; b=Alu2z6YRqqvTdjEwBwu4DidRyeMrNj2+bgB1A1qjscoXfRL1XKsbpsOkWDcGf5Ge3+ gguJynQZ4/2iWL0BkhlbcSnQbUc5Xu7iHiLUqdYqGhHbe0ubW2BtAnRxzv1sJA0cDS77 erqmvNweso6VA8sQB+Hq2eXgykEnRXL5aJHrlxXiutXNdP2mTS3sN4FaxLarmGC5rT6O X5ZVfrK82D4UTVcetvUz/4gTb/ly2j/j82S8JiLeSyZykjwVOecFOgDPY6tmIJdain/+ pRSSYj0r7i30WiS9e4ZxiOefVn9Bnote/9G1Tge0gjVgGbmZ57Q3tNvjX2xdJXm9FLMx B0UQ== X-Gm-Message-State: APjAAAUCe9y5nz25Dfy14jnt1+6OaFVTEpJDadhozPKIjGW97l4872mE /UCznPllpnWxICJ3fGt5tCI= X-Google-Smtp-Source: APXvYqz/z5o6AGGjvZqJtOqCmcJg/Fmx/lsbE8dWLic1WRDu+bKdXUFc0Ol+LWRIvpjc+mnYEBRmtQ== X-Received: by 2002:a02:ad03:: with SMTP id s3mr15848938jan.3.1553596076455; Tue, 26 Mar 2019 03:27:56 -0700 (PDT) Received: from icarus ([2001:268:c0a3:6e7a:c70:4af9:86e2:2]) by smtp.gmail.com with ESMTPSA id b74sm346086itd.12.2019.03.26.03.27.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 03:27:55 -0700 (PDT) Date: Tue, 26 Mar 2019 19:28:43 +0900 From: William Breathitt Gray To: Andy Shevchenko , Lukas Wunner Subject: Re: [PATCH v12 01/11] bitops: Introduce the for_each_set_clump8 macro Message-ID: <20190326102843.GA10264@icarus> References: <9afc30a574ce3e6a86b51dd522146a1d2156dedd.1553494625.git.vilhelm.gray@gmail.com> <20190325093854.jzkkwaksxi7zvtrg@wunner.de> <20190326031422.GB3356@icarus> <20190326094345.v7l7xjvfs2scbvbv@wunner.de> <20190326100743.GA10005@icarus> <20190326101933.GW9224@smile.fi.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190326101933.GW9224@smile.fi.intel.com> User-Agent: Mutt/1.11.4 (2019-03-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190326_032800_995945_C571A0BC X-CRM114-Status: GOOD ( 17.50 ) 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-arch@vger.kernel.org, Arnd Bergmann , linux-gpio@vger.kernel.org, yamada.masahiro@socionext.com, linus.walleij@linaro.org, linux-pm@vger.kernel.org, linux@rasmusvillemoes.dk, linux-kernel@vger.kernel.org, bgolaszewski@baylibre.com, geert@linux-m68k.org, akpm@linux-foundation.org, preid@electromag.com.au, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 26, 2019 at 12:19:33PM +0200, Andy Shevchenko wrote: > On Tue, Mar 26, 2019 at 07:08:18PM +0900, William Breathitt Gray wrote: > > On Tue, Mar 26, 2019 at 10:43:45AM +0100, Lukas Wunner wrote: > > > On Tue, Mar 26, 2019 at 12:14:22PM +0900, William Breathitt Gray wrote: > > > > Why is it so complicated, does it allow passing in a start value > > > that's not a multiple of 8? Do you really need that? I imagine > > > a simplification is possible if that assumption can be made (and > > > is spelled out in the kerneldoc). > > > > That's a good point. Originally, I had envisioned the possibility of > > calling bitmap_get_value8/bitmap_set_value8 at odd start offsets; this > > would open up the possibility of a clump landing as a split between 2 > > words, thus requiring this complicated case handling code. However, I'm > > not sure how often users would need this case; none of the drivers right > > now require clumps at odd offsets. > > > > Andy, would you have any objection to restricting the start offset > > values for bitmap_get_value8/bitmap_set_value8 to multiples of 8? That > > would prevent the split word case, and thus allow the implementation for > > those functions to be a lot simpler. > > No, I have no objection. > > -- > With Best Regards, > Andy Shevchenko In this case, bitmap_get_value8 could be simplified to something like this: index = BIT_WORD(start); offset = start % BITS_PER_LONG; return (bitmap[index] >> offset) & 0xFF; Or if you prefer a single line: (bitmap[BIT_WORD(start)] >> (start % BITS_PER_LONG)) & 0xFF; Would it be better to define bitmap_get_value8 as a macro then? William Breathitt Gray _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel