Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1466005imu; Sat, 12 Jan 2019 00:38:40 -0800 (PST) X-Google-Smtp-Source: ALg8bN5tKrpa0KmvyGq6p6qfVAl4OXCTRymGUpfpmDU41nNxlpz6Ej9TII/khUfvhS8w+oS+4Dxp X-Received: by 2002:a17:902:b090:: with SMTP id p16mr8925498plr.190.1547282320191; Sat, 12 Jan 2019 00:38:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547282320; cv=none; d=google.com; s=arc-20160816; b=R1ZYI1AOMhCoeDUi0UCFtAsj8pO/ePmLitD1JD+Kb2YcLUpOcrlHk2ZPHbNmpSSdiB CBxoONfE2ob97KLgZbRxBBIVn32w67PmSBZ0LVjvF/G744EA3vJg9dcBptKaiEX4cY8h lR3439BRy0/PdW4bvl3wPY83dP1lB4zZ3W9YmaYz9brPza0oyn962vMBwj9R/yipIngI s0zWC4eF/9BzMCnqaFFL7uwror8lEZjASojSLcnN+lJWDAWDbq220ihnZRynLuWHZHYz sZL1BDPGk8yZuNT6fhubncYUgtqSmOVAekzo//A8lDxW3s+soDDHr5l4M4w68bFKnYtP zPzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=y5m+aNrUYSC4rSQdmuKQCdp7QvFw21AXRBfcsx1LdZ4=; b=V5Bp9phZ/ULKDDcUnf/2CJ8S9/KZvSt+pVCUNkBwxy+Iu71CdTweXdhkzNYsN7ior6 lHB/A2yseaD+fFdpca/UDUJGFYzTbZuSlpL/VOE5Akwyp9pat0R/Jwb6vttB03TMSIpr P5Ve1lGDexYEukWTKuupfnCi5YS5byX38cB9Fi8AzHzx5cHOW6UwJV/ou9RG+c1IGhhB kd9YTh7vqrImg9E9gW04/DBkxYTUbTiSWaDuUG5U6V2gekDKGXW4ueuHyV7vwGbYSmvz KYkGsJSQyq/q1fuwfb0dsYBG4U3xoCFLQbMrw8OrhvYpVlrg6LspC57kM1XYTwJtB7NP u6lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=to5SNGx9; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j29si17781308pga.550.2019.01.12.00.38.21; Sat, 12 Jan 2019 00:38:40 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=to5SNGx9; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725853AbfALIhK (ORCPT + 99 others); Sat, 12 Jan 2019 03:37:10 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:36956 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725806AbfALIhJ (ORCPT ); Sat, 12 Jan 2019 03:37:09 -0500 Received: by mail-pg1-f196.google.com with SMTP id c25so7324892pgb.4; Sat, 12 Jan 2019 00:37:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=y5m+aNrUYSC4rSQdmuKQCdp7QvFw21AXRBfcsx1LdZ4=; b=to5SNGx9lwEg0Zp0kIO20cFqCM8ihVAoG6y7bjCYdQu8xpERXrY8vl85RMaH5V01Od PAI55YbbRT3c1WKOiEr6JXYDkHQbRFp+UhObYfsO/RVG6T3x49twY/nGODcn21x0ezMN 5lUFY7Up/NZ4oKDTiEYMMgKY/xtXRNb2QlOkUvGeXPiGohCgKmMBVkGRn6x8+ROrCho6 QYuZz5afKxu41H/1CyKqlgHwzOLcTe3FpLMZWI+C9O5Y4S/QLZokvG6rrRrMW/fjl/nM cJmnXLMvjFUqzfXMMLKF9dM3v098+cpTKdVSHfkGFWIsgH7QHuB2OKO8B8741kuJtQ+m iGFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=y5m+aNrUYSC4rSQdmuKQCdp7QvFw21AXRBfcsx1LdZ4=; b=jFlbYQoAv9cKoFV48p/e3rgnE8V2wfjyCCLlGrvz559s+FRU3ohDkHmD3tbtwVyTA/ QEeFEN98Wsrmsq4EOHEg5cBpDWO1eUe2Wyh/4dDcBoL7xoQ9eYrSuWX/aGL92Te5KxSG hkEmG+8IGwDgagyXwGd+/tolY6HTLOs9i/0jba4H5ggfVcbdSuZwdVN0ZCzRxmnw3N7s hOKpgLmH3vgVv2XBf1mxfAXlSdhUFk3mrNfqQHO39fPOth3y56ct8NPNl6by3a5+/LCn bTCRSyXCcWlCawspfWVSlnbN0hK6KszpzXL7axalilYghO3hHcAVLSTuDgggz7+9PeyY 7pBQ== X-Gm-Message-State: AJcUukdru80QaejJcZRuHU7W654/YSh2voS2hBDc4uQFK6S+MwWwC8+U xyYoeUo3qngaHkkCQHO4VvnqmNDAkIrygCfvM1w= X-Received: by 2002:a63:fe0a:: with SMTP id p10mr13904122pgh.265.1547282228557; Sat, 12 Jan 2019 00:37:08 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Andy Shevchenko Date: Sat, 12 Jan 2019 10:36:57 +0200 Message-ID: Subject: Re: [PATCH v7 1/8] bitops: Introduce the for_each_set_clump8 macro To: William Breathitt Gray Cc: Linus Walleij , Andrew Morton , "open list:GPIO SUBSYSTEM" , Linux-Arch , Linux Kernel Mailing List , Andy Shevchenko , Rasmus Villemoes , Arnd Bergmann Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 12, 2019 at 3:47 AM William Breathitt Gray wrote: > > This macro iterates for each 8-bit group of bits (clump) with set bits, > within a bitmap memory region. For each iteration, "start" is set to the > bit offset of the found clump, while the respective clump value is > stored to the location pointed by "clump". Additionally, the > bitmap_get_value8 and bitmap_set_value8 functions are introduced to > respectively get and set an 8-bit value in a bitmap memory region. > +unsigned int bitmap_get_value8(const unsigned long *const bitmap, > + const unsigned int start); Hmm... Shouldn't be returned value of type unsigned long for sake of consistency? > +/** > + * bitmap_set_value8 - set an 8-bit value within a memory region > + * @bitmap: address to the bitmap memory region > + * @value: the 8-bit value Put the same warning here as you did in cover letter > + * @start: bit offset of the 8-bit value > + */ > +void bitmap_set_value8(unsigned long *const bitmap, > + const unsigned long value, > + const unsigned int start) > +{ > + const size_t index = BIT_WORD(start); > + const unsigned int offset = start % BITS_PER_LONG; > + const unsigned long mask = GENMASK(7, offset); > + > + bitmap[index] &= ~mask; > + bitmap[index] |= value << offset; > +} -- With Best Regards, Andy Shevchenko