Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1737459imm; Mon, 3 Sep 2018 08:09:41 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ+BgaB3GJwdHszw4gRJnrrfPsb8pQ4JYGIQbslxp/0tcaSMMKm9o5NF0A17H4NWycIKzyE X-Received: by 2002:a17:902:bd95:: with SMTP id q21-v6mr27859850pls.284.1535987381137; Mon, 03 Sep 2018 08:09:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535987381; cv=none; d=google.com; s=arc-20160816; b=wLd1KnUJxkGWHfVRFwk1+UlvMzX0HTpCOJmlE+bp5RH0KVf1m0OL2WbDtKEKJmbDUP 4ughtBGP4/Ay8qExLxG/orLZfMB3zR9QnPA9Ap0fSEWz8G9W/w5B4ZzYMuV/mPSwBp+4 vRqFjJC8sN4TTMOnXjCkK83mQzu7xG+ts4mWwY+ExqcG52oyvvUFnaft9yNV3tIycQMS 36AqHmQ7XS40x309jnZ5a4DvwSdwvXmSMVQu2KMJm64ll+WkxBDx3yxY4S4QcY5Kt61L TKmFfO8g9TvnmMeg1H/jjwLfdaj81z74fxAex63D8MYDcY626vd6MM7KY/yIlIhOB2X7 yvng== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :arc-authentication-results; bh=FL1h9oiVA6dgdUVl1XLkr9960WjcQHfEM7KCeuxxO5Q=; b=P9e5EDZKcggB9vsaEv61YeG2Xan6z7JxY5JZAWaa8+TXH4l9u4UUg9ieeqjE2QOXlu hi8sbE+jj6UaO6tJK6mcFF4b5qB1cJrhlI/hX0rRJ5rlvzWzzvUcHISXsO/vHqLM2Lzt vUunnf/Jf/iXlPekgCOeuDZJV9rYyddZwe1SJ6ix3SgrexWo1GG4eJtecQpmbzyDO8P7 ovf6BXfl/27PEIxuNicgekViVGL6WpkcRbD7Bv78emkyLHhHVA9Jh5k+pyWd2xgNqhqr 36w84Wq85rSCOX7hx2EwtZhrbALypZB0fwX8hzmxRglBO8JvnU0AaHUZk3jhbyvHMOI6 GAyA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t21-v6si18215863plj.261.2018.09.03.08.09.25; Mon, 03 Sep 2018 08:09:41 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727472AbeICT2e convert rfc822-to-8bit (ORCPT + 99 others); Mon, 3 Sep 2018 15:28:34 -0400 Received: from mail-vk0-f67.google.com ([209.85.213.67]:46546 "EHLO mail-vk0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725949AbeICT2d (ORCPT ); Mon, 3 Sep 2018 15:28:33 -0400 Received: by mail-vk0-f67.google.com with SMTP id b14-v6so286939vke.13; Mon, 03 Sep 2018 08:07:57 -0700 (PDT) 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:content-transfer-encoding; bh=HPSp+Jn8jv1Vh1YsfpKRDgDd3bmQ8AAw73WdrmW3V5Y=; b=Qw633aw4HPgFKjGwOfuMZ59qefIUkj8fUb5wpiDPEpMSRM6IqqwtbY6KPrs0DZloKK GZwsA0CbxS/cpANq07YgSI4hFNNNbE7J63VNUtSBcV8GI50vOlzk6dcozzPAh09IsjNC nVKhs5AvfxZdbQFWnJiDPon/qa1/SFsi4p8MySryOtbEhs9KP3QqWJ2tImJqxKYoyDPd MgKNGK7pCoCkGrwq/hkjMlg6+RmXOuYWzC0gjdRCZHfhxf9YMAMk7+K8I140RtNMLlK/ UMU/n2pO8+uw3wNskYN5E+XBqDvTEX9veXattmK+LA9woWHXNEbdULCIs7Mb8XLq4PKP 8GFw== X-Gm-Message-State: APzg51CR08Yx4i4jcUSYCUjxTxCuk8J7Mu63IRro/UpEzBNbrxniCv1s xpf2cs/xXg0R5nD/iwpluRQNFY3JUtcHp5tUCkQ= X-Received: by 2002:a1f:6307:: with SMTP id x7-v6mr6412045vkb.111.1535987277086; Mon, 03 Sep 2018 08:07:57 -0700 (PDT) MIME-Version: 1.0 References: <20180831225616.29221-1-jmkrzyszt@gmail.com> <20180902120144.6855-1-jmkrzyszt@gmail.com> <20180902120144.6855-2-jmkrzyszt@gmail.com> In-Reply-To: <20180902120144.6855-2-jmkrzyszt@gmail.com> From: Geert Uytterhoeven Date: Mon, 3 Sep 2018 17:07:44 +0200 Message-ID: Subject: Re: [PATCH v7 1/4] gpiolib: Pass bitmaps, not integer arrays, to get/set array To: Janusz Krzysztofik Cc: Linus Walleij , Jonathan Corbet , Miguel Ojeda Sandonis , peter.korsgaard@barco.com, Peter Rosin , Ulf Hansson , Andrew Lunn , Florian Fainelli , "David S. Miller" , Dominik Brodowski , Greg KH , Kishon Vijay Abraham I , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald , Jiri Slaby , Willy Tarreau , "open list:DOCUMENTATION" , Linux I2C , Linux MMC List , netdev , linux-iio@vger.kernel.org, driverdevel , "open list:SERIAL DRIVERS" , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , sebastien.bourdelin@savoirfairelinux.com, Lukas Wunner , Rojhalat Ibrahim , Russell King , ext Tony Lindgren , Yegor Yefremov , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Janusz, On Sun, Sep 2, 2018 at 2:01 PM Janusz Krzysztofik wrote: > Most users of get/set array functions iterate consecutive bits of data, > usually a single integer, while processing array of results obtained > from, or building an array of values to be passed to those functions. > Save time wasted on those iterations by changing the functions' API to > accept bitmaps. > > All current users are updated as well. > > More benefits from the change are expected as soon as planned support > for accepting/passing those bitmaps directly from/to respective GPIO > chip callbacks if applicable is implemented. > > Cc: Jonathan Corbet > Cc: Miguel Ojeda Sandonis > Cc: Geert Uytterhoeven > Cc: Sebastien Bourdelin > Cc: Lukas Wunner > Cc: Peter Korsgaard > Cc: Peter Rosin > Cc: Andrew Lunn > Cc: Florian Fainelli > Cc: "David S. Miller" > Cc: Rojhalat Ibrahim > Cc: Dominik Brodowski > Cc: Russell King > Cc: Kishon Vijay Abraham I > Cc: Tony Lindgren > Cc: Lars-Peter Clausen > Cc: Michael Hennerich > Cc: Jonathan Cameron > Cc: Hartmut Knaack > Cc: Peter Meerwald-Stadler > Cc: Greg Kroah-Hartman > Cc: Jiri Slaby > Cc: Yegor Yefremov > Cc: Uwe Kleine-König > Signed-off-by: Janusz Krzysztofik > Acked-by: Ulf Hansson > --- a/drivers/auxdisplay/hd44780.c > +++ b/drivers/auxdisplay/hd44780.c > @@ -62,17 +62,12 @@ static void hd44780_strobe_gpio(struct hd44780 *hd) > /* write to an LCD panel register in 8 bit GPIO mode */ > static void hd44780_write_gpio8(struct hd44780 *hd, u8 val, unsigned int rs) > { > - int values[10]; /* for DATA[0-7], RS, RW */ > - unsigned int i, n; > - > - for (i = 0; i < 8; i++) > - values[PIN_DATA0 + i] = !!(val & BIT(i)); > - values[PIN_CTRL_RS] = rs; > - n = 9; > - if (hd->pins[PIN_CTRL_RW]) { > - values[PIN_CTRL_RW] = 0; > - n++; > - } > + DECLARE_BITMAP(values, 10); /* for DATA[0-7], RS, RW */ > + unsigned int n; > + > + *values = val; Given DECLARE_BITMAP() creates an array, the above line looks a bit funny now. IMHO, either you use unsigned long values; values = val; __assign_bit(8, &values, rs); or DECLARE_BITMAP(values, 10); values[0] = val; __assign_bit(8, values, rs); Nevertheless, for hd44780.c: Reviewed-by: Geert Uytterhoeven Tested-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds