From: Benjamin Tissoires <benjamin.tissoires@gmail.com>
To: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Jean Delvare <khali@linux-fr.org>,
Linux Kernel <linux-kernel@vger.kernel.org>,
Linux Input <linux-input@vger.kernel.org>,
Allie Xiong <axiong@synaptics.com>, Vivian Ly <vly@synaptics.com>,
Daniel Rosenberg <daniel.rosenberg@synaptics.com>,
Alexandra Chin <alexandra.chin@tw.synaptics.com>,
Joerie de Gram <j.de.gram@gmail.com>,
Wolfram Sang <w.sang@pengutronix.de>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Linus Walleij <linus.walleij@stericsson.com>,
Naveen Kumar Gaddipati <naveen.gaddipati@stericsson.com>
Subject: Re: [RFC PATCH 02/06] input/rmi4: Core files
Date: Tue, 27 Nov 2012 10:33:45 +0100 [thread overview]
Message-ID: <CAN+gG=GmGJYMvAOMHUskuFT6UkUvyEbgCSQ6bfNvXUnGzxB1Zw@mail.gmail.com> (raw)
In-Reply-To: <50B3F31F.6080203@synaptics.com>
On Mon, Nov 26, 2012 at 11:54 PM, Christopher Heiny
<cheiny@synaptics.com> wrote:
> On 11/26/2012 10:41 AM, Benjamin Tissoires wrote:
>>
>> Hi Christopher,
>>
>> On Sat, Nov 17, 2012 at 4:58 AM, Christopher Heiny <cheiny@synaptics.com>
>> wrote:
>>>
>>> rmi_bus.c implements the basic functionality of the RMI bus. This file
>>> is
>>> greatly simplified compared to the previous patch - we've switched from
>>> "do it yourself" device/driver binding to using device_type to
>>> distinguish
>>> between the two kinds of devices on the bus (sensor devices and function
>>> specific devices) and using the standard bus implementation to manage
>>> devices
>>> and drivers.
>>>
>>>
>>> rmi_driver.c is a driver for the general functionality of the RMI sensor
>>> as a
>>> whole, managing those behaviors (including IRQ handling) that are not
>>> specific
>>> to any RMI4 function. It has some unavoidable dependencies on F01
>>> behavior,
>>> though we have worked to minimize those as far as possible.
>>>
>>>
>>> The header file rmi_driver.h provides definitions that are shared among
>>> the modules of the RMI implementation, but not thought to be necessary
>>> outside it.
>>>
>>>
>>> Greg KH - Linus Walleij recommended that we seek your input on these core
>>> files, particularly the bus implementation.
>>>
>>>
>>> Signed-off-by: Christopher Heiny <cheiny@synaptics.com>
>>>
>>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>>> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>>> Cc: Linus Walleij <linus.walleij@stericsson.com>
>>> Cc: Naveen Kumar Gaddipati <naveen.gaddipati@stericsson.com>
>>> Cc: Joeri de Gram <j.de.gram@gmail.com>
>>>
>>> ---
>>>
>>> drivers/input/rmi4/rmi_bus.c | 248 ++++++
>>> drivers/input/rmi4/rmi_driver.c | 1663
>>> +++++++++++++++++++++++++++++++++++++++
>>> drivers/input/rmi4/rmi_driver.h | 139 ++++
>>> include/uapi/linux/input.h | 1 +
>>> 4 files changed, 2051 insertions(+), 0 deletions(-)
>>>
>> [snipped]
>>>
>>> diff --git a/drivers/input/rmi4/rmi_driver.c
>>> b/drivers/input/rmi4/rmi_driver.c
>>> new file mode 100644
>>> index 0000000..05a73ae
>>> --- /dev/null
>>> +++ b/drivers/input/rmi4/rmi_driver.c
>>
>> [snipped]
>>>
>>> +/* extract product ID */
>>> +void get_prod_id(struct rmi_device *rmi_dev, struct rmi_driver_data
>>> *drvdata)
>>> +{
>>> + struct device *dev = &rmi_dev->dev;
>>> + int retval;
>>> + int board = 0, rev = 0;
>>> + int i;
>>> + static const char * const pattern[] = {
>>> + "tm%4d-%d", "s%4d-%d", "s%4d-ver%1d"};
>>> + u8 product_id[RMI_PRODUCT_ID_LENGTH+1];
>>> +
>>> + retval = rmi_read_block(rmi_dev,
>>> + drvdata->f01_container->fd.query_base_addr+
>>> + sizeof(struct f01_basic_queries),
>>> + product_id, RMI_PRODUCT_ID_LENGTH);
>>> + if (retval < 0) {
>>> + dev_err(dev, "Failed to read product id, code=%d!",
>>> retval);
>>> + return;
>>> + }
>>> + product_id[RMI_PRODUCT_ID_LENGTH] = '\0';
>>> +
>>> + for (i = 0; i < sizeof(product_id); i++)
>>> + product_id[i] = tolower(product_id[i]);
>>> +
>>> + for (i = 0; i < sizeof(pattern); i++) {
>>
>>
>> This should be ARRAY_SIZE(pattern).
>> It gave me a wonderful kernel oops :)
>
>
> Yep, that's a bug! Oddly enough, it runs without barfing on my systems
> (though who knows what horrible things are happening under the hood). Thanks
> for letting us know.
That's because the product id advertised by the touchpad you sent to
me is 'DS4 R3.0'. So it's not compliant with the patterns that are
advertised: "tm%4d-%d", "s%4d-%d", "s%4d-ver%1d".
If you present one of these patterns, thanks to the break, you leave
the for loop. But as I'm not in this optimal case, I'm having i > 2,
which introduced segfault.
Cheers,
Benjamin
>
> Chris
>
>>
>> Cheers,
>> Benjamin
>
>
> [snip]
next prev parent reply other threads:[~2012-11-27 9:33 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-17 3:58 [RFC PATCH 00/06] input: Synaptics RMI4 Touchscreen Driver Christopher Heiny
2012-11-17 3:58 ` [RFC PATCH 01/06] input/rmi4: Public header and documentation Christopher Heiny
2012-11-17 22:41 ` Linus Walleij
2012-11-17 3:58 ` [RFC PATCH 02/06] input/rmi4: Core files Christopher Heiny
2012-11-17 21:54 ` Greg Kroah-Hartman
2012-11-20 4:56 ` Christopher Heiny
2012-11-17 22:45 ` Linus Walleij
2012-11-26 18:41 ` Benjamin Tissoires
2012-11-26 22:54 ` Christopher Heiny
2012-11-27 9:33 ` Benjamin Tissoires [this message]
2012-11-17 3:58 ` [RFC PATCH 03/06] input/rmi4: I2C physical interface Christopher Heiny
2012-11-17 22:47 ` Linus Walleij
2012-11-17 3:58 ` [RFC PATCH 04/06] input/rmi4: Config files and makefiles Christopher Heiny
2012-11-17 22:50 ` Linus Walleij
2012-11-17 3:58 ` [RFC PATCH 05/06] input/rmi4: F01 - device control Christopher Heiny
2012-11-17 22:56 ` Linus Walleij
2012-11-26 9:40 ` Dmitry Torokhov
2012-11-26 22:31 ` Christopher Heiny
2012-11-27 9:29 ` Dmitry Torokhov
2012-11-28 2:52 ` Christopher Heiny
2012-11-17 3:58 ` [RFC PATCH 06/06] input/rmi4: F11 - 2D touch interface Christopher Heiny
2012-11-17 22:54 ` Linus Walleij
2012-11-27 13:01 ` Benjamin Tissoires
-- strict thread matches above, loose matches on Subject: below --
2012-10-06 4:09 [RFC PATCH 00/06] input: Synaptics RMI4 Touchscreen Driver Christopher Heiny
2012-10-06 4:09 ` [RFC PATCH 02/06] input/rmi4: Core files Christopher Heiny
2012-10-06 12:19 ` Joe Perches
2012-10-06 13:06 ` devendra.aaru
2012-10-06 13:08 ` devendra.aaru
2012-10-11 2:49 ` Christopher Heiny
2012-10-11 3:06 ` Joe Perches
2012-10-22 21:58 ` Christopher Heiny
2012-10-09 8:40 ` Linus Walleij
2012-10-11 4:15 ` Christopher Heiny
2012-10-11 8:13 ` Dmitry Torokhov
2012-10-23 23:46 ` Christopher Heiny
2012-10-24 0:11 ` Dmitry Torokhov
2012-10-24 0:32 ` Christopher Heiny
2012-10-11 15:37 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAN+gG=GmGJYMvAOMHUskuFT6UkUvyEbgCSQ6bfNvXUnGzxB1Zw@mail.gmail.com' \
--to=benjamin.tissoires@gmail.com \
--cc=alexandra.chin@tw.synaptics.com \
--cc=axiong@synaptics.com \
--cc=cheiny@synaptics.com \
--cc=daniel.rosenberg@synaptics.com \
--cc=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=j.de.gram@gmail.com \
--cc=khali@linux-fr.org \
--cc=linus.walleij@stericsson.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=naveen.gaddipati@stericsson.com \
--cc=vly@synaptics.com \
--cc=w.sang@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).