Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp908329imm; Sun, 2 Sep 2018 03:19:34 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb2ftz1MLyiB74NTURQ2ohooezx7gGPFKhj6+gfww/8YCcIkwWGE8jBbttVHaXqLjS4qnTu X-Received: by 2002:aa7:83cd:: with SMTP id j13-v6mr24078590pfn.236.1535883574125; Sun, 02 Sep 2018 03:19:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535883574; cv=none; d=google.com; s=arc-20160816; b=rShqTOVObu4j50jmfdMCbGR1jBugiFuJ7WxQSueCzx25n3UVYDC2P66eUXp7wazuq+ nAelepf5UQtJbBiIhw6O42wfiI6QekQAyj6RoBK7HD5lfwk/l3r9jMKSu07pCmSwsNFU kKvZdwgYbLLAd09BMBxapSM1mvthoImp5Nk3u5O4k6Z/vd4UJtSR4mbF2P9t+3esZUPS 4Fo8yDhevj+4KgTQEpUW/ZmVi3t/pgmHs1Jy2A7/cZyRkpERyr68+V8EanRMy/WYSgwv 4nnSdIdUuGB4tEBhwcrXXN/7MM6AhkvaYGSb2lRwCVr132ZmhClCpqdc+y/3RkfkKL5p IpXw== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=h3fMok0crc1QBKbOP4mhqwOxX6VMu2jrrFK5Ca4q0QI=; b=X2uR+3bFcpc+mXM22Ox5y65MuLwS+0KmCBt3OaXBhdqwAf7x9q6CaNM3NzokY0tL1M L6NP2KHMFKmfrb3NjAUXd2zEhwsxESNMtBewxTq+AFj+WBrDtwviA+6cA2CAHhHmLdBH /O7c2GSfo55UT1xlcc46RgBa0oeWnaYS6xlbqBmWjfZuHX7FHcDVVxyuWIMPsPedbUdZ YI3BPYI7Q+3A8qRjjs/jHX7LGzct1MHx6OSmSNZdabXd/HJ8+nr4k4hjGG2UnKmvBlKi vsQuabVrQw9koduRt06bvHR909X/ZG16JgGAyez/RG8i0a95/5S97oYNyj1Jf4MJGei0 dRkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="aQn/cmwo"; 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 h3-v6si15118900plh.66.2018.09.02.03.19.19; Sun, 02 Sep 2018 03:19:34 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="aQn/cmwo"; 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 S1727126AbeIBOd1 (ORCPT + 99 others); Sun, 2 Sep 2018 10:33:27 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:46475 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726195AbeIBOd0 (ORCPT ); Sun, 2 Sep 2018 10:33:26 -0400 Received: by mail-lj1-f194.google.com with SMTP id 203-v6so13160714ljj.13; Sun, 02 Sep 2018 03:18:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=h3fMok0crc1QBKbOP4mhqwOxX6VMu2jrrFK5Ca4q0QI=; b=aQn/cmwoPsTt28eG1Kz8hukFvQsbxBS7ZY+d6T2/EgUQiJRfRbfU9iVLPk7O7IwCOs 48zfFWQyx5iA50C2d9Cw22K8zfHCJqySXD5dIoxR63EJPPNjCaxqHy2bq3YiyFW9Csdy XxNKhItcExvLDFDJIPXjm2Wd98TzxJtHVcZUNCYPYaqgQ+JKGEEBmn8t8WyImJRqiH97 6oxqoQULxCBtk9ofaNSucXmgNUWFfixNWmWd58bhvxTDwuwodDF749RFYooXGFzP4tWv s0yVoEW+YnwVA08eFFrrCrd6ypNvKV2TGIxw4FnPwJXXTkwdx7gln5Xq3cpf/T9sUwKK Ohpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=h3fMok0crc1QBKbOP4mhqwOxX6VMu2jrrFK5Ca4q0QI=; b=hN840/pO6HZgjZyAbNNX8+haKZJpzg+7MygvgcuSFybSRwkXy/XCqhkHlDts5xXujj 0IAfwz/xN+wDP7E0YmaWc0Dp13fBJsMstg2oKoSepHwI4Qlhw8M+fOeCKUwBPN7zjLhF +t8/BA6QqhNLxFQqSHMnRKOGaD50sAdSLrzHo3P/fmnWS/xkZNZv/9yqqVrQ/kWgz0qp iwEXcdvEsMOlohvGci2SuGaCLuy1xwa3oSJM6tOxzEfTU+0aDnGKyu0ii9zGMB2yZ95t 074M9nL+tAsWy9kHjbEb2JfsXrABquqsGrBHu1Mbh4pb2VcxR1hSuLx+PdaWoRcQYnaB 7yzw== X-Gm-Message-State: APzg51Cy8P5ZfGVaaUeMVUujQXb/XbI+kXvrLi1HTK9rSwX0SRicP14+ YHkejWBJFUf1NyEZ4+1ss8k= X-Received: by 2002:a2e:5687:: with SMTP id k7-v6mr15730301lje.105.1535883487344; Sun, 02 Sep 2018 03:18:07 -0700 (PDT) Received: from z50.localnet (apn-37-248-210-194.dynamic.gprs.plus.pl. [37.248.210.194]) by smtp.gmail.com with ESMTPSA id k4-v6sm2770411ljc.6.2018.09.02.03.18.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Sep 2018 03:18:06 -0700 (PDT) From: Janusz Krzysztofik To: Miguel Ojeda Cc: Linus Walleij , Jonathan Corbet , Peter Korsgaard , Peter Rosin , Ulf Hansson , Andrew Lunn , Florian Fainelli , "David S. Miller" , Dominik Brodowski , Greg Kroah-Hartman , Kishon Vijay Abraham I , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , Jiri Slaby , Willy Tarreau , Geert Uytterhoeven , Linux Doc Mailing List , linux-i2c@vger.kernel.org, linux-mmc@vger.kernel.org, Network Development , linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-serial@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel , Janusz Krzysztofik Subject: Re: [PATCH v5 1/4] gpiolib: Pass bitmaps, not integer arrays, to get/set array Date: Sun, 02 Sep 2018 12:19:11 +0200 Message-ID: <2195152.WzNjLO0DAH@z50> In-Reply-To: References: <20180820234341.5271-1-jmkrzyszt@gmail.com> <20180829204900.19390-2-jmkrzyszt@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Miguel, On Thursday, August 30, 2018 1:10:59 PM CEST Miguel Ojeda wrote: > Hi Janusz, > > On Wed, Aug 29, 2018 at 10:48 PM, Janusz Krzysztofik > wrote: > > ... > > /* High nibble + RS, RW */ > > - for (i = 4; i < 8; i++) > > - values[PIN_DATA0 + i] = !!(val & BIT(i)); > > - values[PIN_CTRL_RS] = rs; > > + value_bitmap[0] = val; > > + __assign_bit(PIN_CTRL_RS, value_bitmap, rs); > > n = 5; > > if (hd->pins[PIN_CTRL_RW]) { > > - values[PIN_CTRL_RW] = 0; > > + __clear_bit(PIN_CTRL_RW, value_bitmap); > > n++; > > } > > + value_bitmap[0] >>= PIN_DATA4; > > > > /* Present the data to the port */ > > - gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA4], > > - &values[PIN_DATA4]); > > + gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA4], value_bitmap); > > > > hd44780_strobe_gpio(hd); > > > > /* Low nibble */ > > - for (i = 0; i < 4; i++) > > - values[PIN_DATA4 + i] = !!(val & BIT(i)); > > + value_bitmap[0] &= ~((1 << PIN_DATA4) - 1); > > + value_bitmap[0] |= val & ~((1 << PIN_DATA4) - 1); > > This is still wrong! What I originally meant in my v4 review is that > there is an extra ~ in the second line. Indeed, that's wrong, I missed your original point, sorry. > Also, a couple of general comments: > > - Please review the list of CCs (I was not CC'd originally, so maybe > there are other maintainers that aren't, either) That's probably because early versions of the series, prior to v4, were not touching existing GPIO API so there were no changes to users of gpiod_get/ set_array_value() and their variants. From v4 on, you are in the loop so don't worry, you haven't missed anything. But anyway, thanks for your suggestion to review the Cc; list, I've done that for v7 and added still a few people who contributed most to the code being changed. > - In general, the new code seems harder to read than the original one > (but that is my impression). I hope we are slowly approaching acceptable readability in recent iterations. Thanks, Janusz