Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp354209imu; Fri, 11 Jan 2019 01:25:23 -0800 (PST) X-Google-Smtp-Source: ALg8bN6y8ygg7xvle02FRydwGPzFVCK3y80ou2vadL70hAkVHGDDMu4iH3PZT6Q/adEiJRYCIk2k X-Received: by 2002:a63:790e:: with SMTP id u14mr12643131pgc.452.1547198723838; Fri, 11 Jan 2019 01:25:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547198723; cv=none; d=google.com; s=arc-20160816; b=K4e1LbNiHGb+HuBlt0usRTNJ10P91bS/z7y8mNzYQ0zjKadIyZDeQ/uZdy5wEnsEHh NAsdpMMGUuobxgdu5pkWt92nEd0ADM1TPdKiiVzfKGYCjreYQat40RjJsEh8MLyY/F5/ rvDs0+8rODlaWO7NrSyCX+QdjWpyeAlzrBbbQCBZHFgkLwfhjf+hpn7SLJ2vOpsfx4Pk qNFupIcZwteNSUrPWmOT0mx0YB/bAGysCCNz/ysdo7vu7HMsJXmb3qjX24gWjlUCUgNw hY6smMvzryO82wkBsHs8icfWt1c3qifo6NKsj8BhJG9E8NQQRGtGsaa3OrMgLV4ubDbX tBvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=CQ99kQH6090Vq0ywZzm4rO7tsvvrGnIumq72c0Ryxq0=; b=RrBnWzuuz5wUOpI5qv6dsBneJK9H1xX2HBqwdjjygcraUvgQhkJAKOMxLpPhsxBtQL j2WPhBaqOUILCR0yLEZWGYgUkYfngwPP1gJzuEdU+8fKYo41vKl0/O3fAxSY3Nu8GWZn kLzQwcPOGyCkGoGgmmYl61QtGXUw7KxzMk2xwqrdN2S9ogoqvaVx7uluftPop+b3ydTa WWfF7bP3ju/itXzIb4zhr3RRo/TTHjXw2ZVETRYCp+5+MByRkjc3Ju/17uBbJSEa3Ssh sjl2gZgc/vAIWuIcd7aQcqh3hJCTdZn2rgRezDEA81i2d+jSoJcBB9EnPZyMmDfrrFOb +1FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=WcGjhygG; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u5si13973113pgi.146.2019.01.11.01.25.05; Fri, 11 Jan 2019 01:25:23 -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=@rasmusvillemoes.dk header.s=google header.b=WcGjhygG; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729262AbfAKJAu (ORCPT + 99 others); Fri, 11 Jan 2019 04:00:50 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:40026 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725779AbfAKJAu (ORCPT ); Fri, 11 Jan 2019 04:00:50 -0500 Received: by mail-lj1-f195.google.com with SMTP id n18-v6so12257399lji.7 for ; Fri, 11 Jan 2019 01:00:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=CQ99kQH6090Vq0ywZzm4rO7tsvvrGnIumq72c0Ryxq0=; b=WcGjhygGzeA6SntGqSZ2AN+fuaY59mWFkLrV6I7Gz+bxvRBLsIPxAbEeHjLn4l33rH +RsaN1kYIsLDQJY5lxVemA3n0X8hHbja+C7s5CbF8ut+pspnzZ8OHkQLvTb9n7CYgcSo RFAKfCMitcxVAXlzWt35sAcpDnn4R5VLC6QTY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=CQ99kQH6090Vq0ywZzm4rO7tsvvrGnIumq72c0Ryxq0=; b=MOF5qmU6ehMG1HW53v3gh1AcO1hy3L8yDkN4pFiNblhu/bZYhdOT+B530kg6bqf1X/ 6BoX73WYj82FjjiZlaPPeyW4ql6XXEChq/ff25us0ncpcrqCPZqtbJYvQ/89RrPAA0OA pzW9Qh3KBylZFqnJGlekcO9LEFcQ0dOiTUHyPUFJpIyWb+vGfXFd6ZpRDlCVW5InP17D UHSa86mSyB4pgYHeItIEp3HJX3qchq1xnK7dYg3M5NqyHe+rb+nNedrVzMcphJ+9ZzpL eKkvo9Bq87T9lpNgRqhMfbikijPuD76akiIDxDQDBbNQzfNDpOAdRjMZuQKlqSxGvClO +HYw== X-Gm-Message-State: AJcUukf8p0y3mvsbWqm275TxYP3FueRAAAgz1khlWxXtrPiW7MrHRDxX mLGE0pz71Vjgs89La9RmQ3vTOZML4x4pxQ== X-Received: by 2002:a2e:5d12:: with SMTP id r18-v6mr8943211ljb.89.1547197248403; Fri, 11 Jan 2019 01:00:48 -0800 (PST) Received: from [172.16.11.26] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id j76-v6sm15901860ljb.12.2019.01.11.01.00.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Jan 2019 01:00:47 -0800 (PST) Subject: Re: [PATCH v6 1/8] bitops: Introduce the for_each_set_clump8 macro To: William Breathitt Gray , linus.walleij@linaro.org Cc: akpm@linux-foundation.org, linux-gpio@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, andriy.shevchenko@linux.intel.com, Andy Shevchenko , Arnd Bergmann References: <9fb3981cbcfbce3fb8b42bf419d734c0e5a44d0e.1545198260.git.vilhelm.gray@gmail.com> From: Rasmus Villemoes Message-ID: <81f3038e-301b-7c0d-a6ef-90b9dadcab51@rasmusvillemoes.dk> Date: Fri, 11 Jan 2019 10:00:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <9fb3981cbcfbce3fb8b42bf419d734c0e5a44d0e.1545198260.git.vilhelm.gray@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/12/2018 07.00, William Breathitt Gray wrote: > +/** > + * bitmap_set_value8 - set an 8-bit value within a memory region > + * @bitmap: address to the bitmap memory region > + * @value: the 8-bit value > + * @start: bit offset of the 8-bit value > + */ > +void bitmap_set_value8(unsigned long *const bitmap, > + const unsigned long *const 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) & mask; > +} errh, why pass the value by reference? That seems rather odd. Also, if anybody passes a value that doesn't fit in 8 bits, they get what they deserve; IOW I don't see a reason for the masking in the last line, but if its convenient for the users, keep it. In any case, please change the type of value. Rasmus