From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Christopher Heiny <cheiny@synaptics.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Greg KH <gregkh@linuxfoundation.org>,
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>,
Joerie de Gram <j.de.gram@gmail.com>,
Wolfram Sang <w.sang@pengutronix.de>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Linus Walleij <linus.walleij@stericsson.com>,
Naveen Kumar Gaddipati <naveen.gaddipati@stericsson.com>,
Alexandra Chin <alexandra.chin@tw.synaptics.com>
Subject: Re: [RFC PATCH 02/06] input/rmi4: Core files
Date: Tue, 23 Oct 2012 17:11:41 -0700 [thread overview]
Message-ID: <5515083.K7EXLgnYa6@dtor-d630.eng.vmware.com> (raw)
In-Reply-To: <50872C54.4090505@synaptics.com>
On Tuesday, October 23, 2012 04:46:28 PM Christopher Heiny wrote:
> On 10/11/2012 01:13 AM, Dmitry Torokhov wrote:
> > On Thu, Oct 11, 2012 at 04:15:56AM +0000, Christopher Heiny wrote:
> >> On Thursday, October 11, 2012 02:21:53 AM you wrote:
> >>> On Sat, Oct 6, 2012 at 6:09 AM, Christopher Heiny <cheiny@synaptics.com>
wrote:
> >>>> +
> >>>> +/** This is here because all those casts made for some ugly code.
> >>>> + */
> >>>> +static void u8_and(u8 *dest, u8 *target1, u8 *target2, int nbits)
> >>>> +{
> >>>> + bitmap_and((long unsigned int *) dest,
> >>>> + (long unsigned int *) target1,
> >>>> + (long unsigned int *) target2,
> >>>> + nbits);
> >>>> +}
> >>>
> >>> Hm, getting rid of unreadable casts is a valid case.
> >>>
> >>> I'll be OK with this but maybe the real solution is to introduce such
> >>> helpers into <linux/bitmap.h>?
> >>
> >> Hmmm. We'll give that some thought. Thought I'd like to get the RMI4
> >> driver nailed down, just to keep the area of change small. Once we've
> >> got all the kinks worked out here, we'll look at bitmap.h helpers.
> >
> > The question is why you are using u8 for bitmaps instead of doing
> > DECALRE_BITMAP() and using it instead? Then you would not need silly
> > wrappers around existing APIs.
>
> OK, we'll look into that. My big concern is whether the bit-order in
> bitmask.h will be the same as the bit order in the RMI4 sensor
> registers. If that works out OK, we'll switch.
I think if you properly convert data to/from cpu-endianness it will clear
matters a lot.
>
> >>> (...)
> >>>
> >>>> +static int process_interrupt_requests(struct rmi_device *rmi_dev)
> >>>> +{
> >>>> + struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
> >>>> + struct device *dev = &rmi_dev->dev;
> >>>> + struct rmi_function_container *entry;
> >>>> + u8 irq_status[data->num_of_irq_regs];
> >>>
> >>> Looking at this...
> >>>
> >>> What does the data->num_of_irq_regs actually contain?
> >>>
> >>> I just fear that it is something constant like always 2 or always 4,
> >>> so there is actually, in reality, a 16 or 32 bit register hiding in
> >>> there.
> >>>
> >>> In that case what you should do is to represent it as a u16 or u32 here,
> >>> just or the bits into a status word, and then walk over that status
> >>> word with something like ffs(bitword); ...
> >>
> >> Nope, it's not constant. In theory, and RMI4 based sensor can have up
> >> to 128 functions (in practice, it's far fewer), and each function can
> >> have as many as 7 interrupts. So the number of IRQ registers can vary
> >> from RMI4 sensor to RMI4 sensor, and needs to be computed during the
> >> scan of the product descriptor table.
> >
> > Is it a good idea to have it on stack then? Should it be part of
> > rmi_device instead?
>
> It's not coming off the stack. We're allocating it via devm_kzalloc()
> in rmi_driver_probe().
No, look at the part of the code that was quoted. "u8 irq_status[data-
>num_of_irq_regs];" is on stack.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2012-10-24 0:11 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-06 4:09 [RFC PATCH 00/06] input: Synaptics RMI4 Touchscreen Driver Christopher Heiny
2012-10-06 4:09 ` [RFC PATCH 01/06] input/rmi4: Public header and documentation Christopher Heiny
2012-10-09 7:43 ` Linus Walleij
2012-10-09 8:27 ` Mark Brown
2012-10-11 3:56 ` Christopher Heiny
2012-10-12 5:16 ` Mark Brown
2012-10-23 22:10 ` Christopher Heiny
2012-10-24 17:49 ` Mark Brown
2012-10-11 3:41 ` Christopher Heiny
2012-10-11 8:24 ` Dmitry Torokhov
2012-10-23 22:55 ` Christopher Heiny
2012-10-11 15:22 ` Linus Walleij
2012-10-11 15:32 ` Linus Walleij
2012-10-16 6:26 ` Mark Brown
2012-10-23 23:19 ` Christopher Heiny
2012-10-23 23:18 ` Christopher Heiny
2012-10-11 8:20 ` Dmitry Torokhov
2012-10-23 22:39 ` Christopher Heiny
2012-10-23 22:47 ` Dmitry Torokhov
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 [this message]
2012-10-24 0:32 ` Christopher Heiny
2012-10-11 15:37 ` Linus Walleij
2012-10-06 4:10 ` [RFC PATCH 03/06] input/rmi4: I2C physical interface Christopher Heiny
2012-10-09 9:05 ` Linus Walleij
2012-10-11 4:21 ` Christopher Heiny
2012-10-06 4:10 ` [RFC PATCH 04/06] input/rmi4: Config files and makefiles Christopher Heiny
2012-10-09 9:08 ` Linus Walleij
2012-10-11 4:23 ` Christopher Heiny
2012-10-06 4:10 ` [RFC PATCH 05/06] input/rmi4: F01 - device control Christopher Heiny
2012-10-09 9:31 ` Linus Walleij
2012-10-11 4:34 ` Christopher Heiny
2012-10-06 4:10 ` [RFC PATCH 06/06] input/rmi4: F11 - 2D touch interface Christopher Heiny
2012-10-09 10:02 ` Linus Walleij
2012-10-11 4:46 ` Christopher Heiny
2012-10-10 18:21 ` Henrik Rydberg
2012-10-25 21:39 ` Christopher Heiny
2012-11-17 3:58 [RFC PATCH 00/06] input: Synaptics RMI4 Touchscreen Driver Christopher Heiny
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
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=5515083.K7EXLgnYa6@dtor-d630.eng.vmware.com \
--to=dmitry.torokhov@gmail.com \
--cc=alexandra.chin@tw.synaptics.com \
--cc=axiong@synaptics.com \
--cc=cheiny@synaptics.com \
--cc=daniel.rosenberg@synaptics.com \
--cc=gregkh@linuxfoundation.org \
--cc=j.de.gram@gmail.com \
--cc=khali@linux-fr.org \
--cc=linus.walleij@linaro.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
Powered by JetHome