Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2487830imm; Wed, 3 Oct 2018 04:49:06 -0700 (PDT) X-Google-Smtp-Source: ACcGV61q+jMUcmH0cmxZBoqt5vKpMhzOp2EMat+bwNkZYHcUAIaouVReXJf5FK/cRxTO2+qqvY7C X-Received: by 2002:a63:4384:: with SMTP id q126-v6mr1063314pga.142.1538567346608; Wed, 03 Oct 2018 04:49:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538567346; cv=none; d=google.com; s=arc-20160816; b=CHiCIOOCceLpKEu/+Csnhx5Mhym8+kkBXaAAW0qGAXfdzLjj2fHNdwSbcz2ZD6kXXs 0vm/r6+nNRpBzKqZ3W13b8G+a7OQyou37ZTF3pm2reue7Cmy83wlow8mkhkH2+V84MuI dMqIakCidqVTJYNOoOJAMmlduV9jeliGlsPxIXxiDpgPZvENmzYw9nu91Qd/eS8wzOxN XmfM6YAp/w0GXQbHBYK2q1najJ8RqU9doe2yHroQtcl/ICypq0Z1kZl2okAV6JEdqwc6 DtQSX3usHXja2q0CZ+klgc+alwwhY6H6DhwcSuaYFz8hrIQSsmnns1GWoNpspoI0lvH2 CLxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=A7X7lT0hGLUGZ6DUyqgJAP9Zn3sTOpMv57GMWsB4RDY=; b=mOG5ScV3Oejyarz/LsbaDq7AXpmtSGcCUWfF9hMs2UF2aCsex9Y0th3ZKJaE1Zj3eV HAMlTUsaIpR8Qi9ZQuFgnzXdRlyN0kqYPgQBfcYg+7Dfj6qayShK5UQus99dgT+Sey/c KeSvU/gsC+tkOkBB4BNyqK81AMPn1g6MQu63gMQMnC77pL6UevPMEWQgR3QfJCx9LwQm XFH6AEfRMOn2MulH+dH4/eloxH07uckVu4KcDpUJZqP8/KJhVooVYUl5tIZ9NF3eYscS 8rBsrfOlsqtfkQ6zwhu+sas2OV1tYdFxYeCmMjxJTXKzc36ypNaMByXZqqndZ/k+lu7J uojw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t20-v6si1451478plj.261.2018.10.03.04.48.51; Wed, 03 Oct 2018 04:49:06 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727128AbeJCSgS (ORCPT + 99 others); Wed, 3 Oct 2018 14:36:18 -0400 Received: from mga14.intel.com ([192.55.52.115]:26918 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726767AbeJCSgR (ORCPT ); Wed, 3 Oct 2018 14:36:17 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Oct 2018 04:48:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,335,1534834800"; d="scan'208";a="268093825" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by fmsmga005.fm.intel.com with ESMTP; 03 Oct 2018 04:48:05 -0700 Received: from andy by smile with local (Exim 4.91) (envelope-from ) id 1g7fdM-0006OU-EI; Wed, 03 Oct 2018 14:48:04 +0300 Date: Wed, 3 Oct 2018 14:48:04 +0300 From: Andy Shevchenko To: Rasmus Villemoes Cc: William Breathitt Gray , linus.walleij@linaro.org, akpm@linux-foundation.org, linux-gpio@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: Re: [RESEND PATCH v4 1/8] bitops: Introduce the for_each_set_clump macro Message-ID: <20181003114804.GE15943@smile.fi.intel.com> References: <40ecad49-2797-0d30-b52d-a2e6838dc1ab@rasmusvillemoes.dk> <20181002082142.GC15943@smile.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181002082142.GC15943@smile.fi.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 02, 2018 at 11:21:42AM +0300, Andy Shevchenko wrote: > I would rather go with two prototypes to get()/set() a clump in the bitmap > in a way when it's aligned and BITS_PER_LONG % clump_size == 0. To make things much easier, restrict clump_size to the one from the following set: 1, 2, 4, 8, 16, 32 even on 64-bit platforms. If it would be simpler solution to add 64 here (implying 32-bit platform), I would vote for that. For the generic case we might need something like: unsigned long bitmap_get_bits(unsigned long *src, unsigned int start, unsigned int nbits) { assert(nbits > BITS_PER_LONG); /* Something like Rasmus proposed earlier */ } And similar to setter. -- With Best Regards, Andy Shevchenko