Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1655895
| Path | csiph.com!news.redatomik.org!news.albasani.net!news.mixmin.net!news.unit0.net!news.panservice.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Dmitry Torokhov <dmitry.torokhov@gmail.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] Input: synaptics-rmi4 - use %ph to form F34 configuration ID |
| Date | Fri, 02 Jun 2017 07:20:02 +0200 |
| Message-ID | <tNNaa-4HT-5@gated-at.bofh.it> (permalink) |
| References | <tMHgt-2mn-1@gated-at.bofh.it> <tMKHn-4SA-5@gated-at.bofh.it> <tMSEW-1o1-31@gated-at.bofh.it> <tNjc5-1OZ-17@gated-at.bofh.it> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=lPLV+0O9EDA9y8H4I2orFPh9a7OK+HSKGM/dtHu7bK0=; b=Qbh13+5Ewugo36rNZNEKkSodS57eL31UFSThmrHvSMH4tT2Z6nhOGaMiF9jEdvKcPf TI83wrNDHDKPg8a3VijkwSbnyi4S9e1dX39asEfAL0kuRRyYng5O8vWfllZPwbAvgtrK QkoC86vSGokTqBpMe4NB0UbA88XMM/gIzHtGMAlG0NqtvOX1Muc/W7rcIJOxOsFfEg8z Mp+dft9+Pg2RuFIlduSqU2+VBMAV0QhgpQx5nyBLt/Wsz9WQeNLqK/8TAs5H351+pAmf ge1FIq/psnYT5WwVcEmB4n60k+SphHZb2SiniZqutQ9vfsgfEfOck85928tpe8LcqWN3 lv/g== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=lPLV+0O9EDA9y8H4I2orFPh9a7OK+HSKGM/dtHu7bK0=; b=dHJF5Aspedtdf4cMCzfMnznLdPuZ+ei4AgUBgVXaKvP7Fw+WOSZHagfGZsE/ZsXQvC Ryfm+it6fmgW2prIAUSIGR+0aHFWZoohnJw1h5f9JkzOE0xi6OXfktZL8SDyb6fij4dd U+MQPYzIOLNWt/p745xvRjEVeVOfSF30HszTKIU2qGrovOFeWkPBkBCOGasKp5Npc1EV wpFNyFLs3Qg7FK74flgmqguDNHizMJjYogLabIlfWApD25VTLZl9po9ouV5ezj3KG+V/ 4ezuKqZaiN2uNjjNmfv2upO80ksGi/LBftY8J8OeOvI3pGGbdDfc1qRYzqKwAzasYSMT Wn9g== |
| X-Gm-Message-State | AODbwcDmbQZijg7jmvHzHlaw+2GzdpAlm8RzVAmgAQ/bsO2H92684thH o+Ax5r6//K8JXw== |
| X-Received | by 10.98.22.9 with SMTP id 9mr4932820pfw.125.1496380236245; Thu, 01 Jun 2017 22:10:36 -0700 (PDT) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.21 (2010-09-15) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 119 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Benjamin Tissoires <benjamin.tissoires@redhat.com>, linux-input@vger.kernel.org, Dan Carpenter <dan.carpenter@oracle.com>, linux-kernel@vger.kernel.org, Chris Healy <cphealy@gmail.com> |
| X-Original-Date | Thu, 1 Jun 2017 22:10:33 -0700 |
| X-Original-Message-ID | <20170602051033.GB18657@dtor-ws> |
| X-Original-References | <20170530044944.GA33451@dtor-ws> <20170530082358.GB1293@mail.corp.redhat.com> <20170530165913.GD12922@dtor-ws> <20170531211114.GB16264@lava.h.shmanahar.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1655895 |
Show key headers only | View raw
On Wed, May 31, 2017 at 10:11:14PM +0100, Nick Dyer wrote:
> On Tue, May 30, 2017 at 09:59:13AM -0700, Dmitry Torokhov wrote:
> > On Tue, May 30, 2017 at 10:23:58AM +0200, Benjamin Tissoires wrote:
> > > On May 29 2017 or thereabouts, Dmitry Torokhov wrote:
> > > > Instead of printing bytes one by one, let's use %phN to print the buffer in
> > > > one go.
> > > >
> > > > Also use hweight8 to count number of partitions instead of inspecting it
> > > > bit by bit.
> > > >
> > > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > > > ---
> > >
> > > Looks good to me:
> > > Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> >
> > Hm, I just realized taht we'd go from upper to lowercase hex digits. I
> > think it should be OK, but I'd like to hear interested parties (Nick).
> >
> > Or we'd need to introduce %pH I guess.
>
> Hi Dmitry-
>
> I can't see any issue with this: all the firmwares I've encountered are
> purely numerical anyway.
>
> Tested-by: Nick Dyer <nick@shmanahar.org>
Thanks Nick!
>
> >
> > >
> > > Cheers,
> > > Benjamin
> > >
> > > > drivers/input/rmi4/rmi_f34v7.c | 22 ++++++++--------------
> > > > 1 file changed, 8 insertions(+), 14 deletions(-)
> > > >
> > > > diff --git a/drivers/input/rmi4/rmi_f34v7.c b/drivers/input/rmi4/rmi_f34v7.c
> > > > index ae2db1c3aebf..3991d2943660 100644
> > > > --- a/drivers/input/rmi4/rmi_f34v7.c
> > > > +++ b/drivers/input/rmi4/rmi_f34v7.c
> > > > @@ -9,13 +9,14 @@
> > > > * the Free Software Foundation.
> > > > */
> > > >
> > > > +#include <linux/bitops.h>
> > > > #include <linux/kernel.h>
> > > > #include <linux/rmi.h>
> > > > #include <linux/firmware.h>
> > > > -#include <asm/unaligned.h>
> > > > #include <linux/delay.h>
> > > > #include <linux/slab.h>
> > > > #include <linux/jiffies.h>
> > > > +#include <asm/unaligned.h>
> > > >
> > > > #include "rmi_driver.h"
> > > > #include "rmi_f34.h"
> > > > @@ -464,7 +465,7 @@ static int rmi_f34v7_read_queries_bl_version(struct f34_data *f34)
> > > > static int rmi_f34v7_read_queries(struct f34_data *f34)
> > > > {
> > > > int ret;
> > > > - int i, j;
> > > > + int i;
> > > > u8 base;
> > > > int offset;
> > > > u8 *ptable;
> > > > @@ -519,9 +520,6 @@ static int rmi_f34v7_read_queries(struct f34_data *f34)
> > > >
> > > > if (query_0 & HAS_CONFIG_ID) {
> > > > u8 f34_ctrl[CONFIG_ID_SIZE];
> > > > - int i = 0;
> > > > - u8 *p = f34->configuration_id;
> > > > - *p = '\0';
> > > >
> > > > ret = rmi_read_block(f34->fn->rmi_dev,
> > > > f34->fn->fd.control_base_addr,
> > > > @@ -531,13 +529,11 @@ static int rmi_f34v7_read_queries(struct f34_data *f34)
> > > > return ret;
> > > >
> > > > /* Eat leading zeros */
> > > > - while (i < sizeof(f34_ctrl) && !f34_ctrl[i])
> > > > - i++;
> > > > + for (i = 0; i < sizeof(f34_ctrl) - 1 && !f34_ctrl[i]; i++)
> > > > + /* Empty */;
> > > >
> > > > - for (; i < sizeof(f34_ctrl); i++)
> > > > - p += snprintf(p, f34->configuration_id
> > > > - + sizeof(f34->configuration_id) - p,
> > > > - "%02X", f34_ctrl[i]);
> > > > + snprintf(f34->configuration_id, sizeof(f34->configuration_id),
> > > > + "%*phN", (int)sizeof(f34_ctrl) - i, f34_ctrl + i);
> > > >
> > > > rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, "Configuration ID: %s\n",
> > > > f34->configuration_id);
> > > > @@ -545,9 +541,7 @@ static int rmi_f34v7_read_queries(struct f34_data *f34)
> > > >
> > > > f34->v7.partitions = 0;
> > > > for (i = 0; i < sizeof(query_1_7.partition_support); i++)
> > > > - for (j = 0; j < 8; j++)
> > > > - if (query_1_7.partition_support[i] & (1 << j))
> > > > - f34->v7.partitions++;
> > > > + f34->v7.partitions += hweight8(query_1_7.partition_support[i]);
> > > >
> > > > rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, "%s: Supported partitions: %*ph\n",
> > > > __func__, sizeof(query_1_7.partition_support),
> > > > --
> > > > 2.13.0.219.gdb65acc882-goog
> > > >
> > > >
> > > > --
> > > > Dmitry
> >
> > --
> > Dmitry
--
Dmitry
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] Input: synaptics-rmi4 - use %ph to form F34 configuration ID Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-05-30 06:50 +0200
Re: [PATCH] Input: synaptics-rmi4 - use %ph to form F34 configuration ID Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2017-05-30 10:30 +0200
Re: [PATCH] Input: synaptics-rmi4 - use %ph to form F34 configuration ID Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-05-30 19:00 +0200
Re: [PATCH] Input: synaptics-rmi4 - use %ph to form F34 configuration ID Joe Perches <joe@perches.com> - 2017-05-30 19:30 +0200
Re: [PATCH] Input: synaptics-rmi4 - use %ph to form F34 configuration ID Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-05-30 21:10 +0200
Re: [PATCH] Input: synaptics-rmi4 - use %ph to form F34 configuration ID Joe Perches <joe@perches.com> - 2017-05-30 21:20 +0200
Re: [PATCH] Input: synaptics-rmi4 - use %ph to form F34 configuration ID Nick Dyer <nick@shmanahar.org> - 2017-05-31 23:20 +0200
Re: [PATCH] Input: synaptics-rmi4 - use %ph to form F34 configuration ID Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-06-02 07:20 +0200
csiph-web