From: "Hemanth V" <hemanthv@ti.com>
To: "Murphy, Dan" <dmurphy@ti.com>
Cc: Jonathan Cameron <jic23@cam.ac.uk>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: RE: [RFC] [PATCH V2 1/2] input: CMA3000 Accelerometer driver
Date: Mon, 16 Aug 2010 15:15:17 +0530 (IST) [thread overview]
Message-ID: <3776.10.24.255.18.1281951917.squirrel@dbdmail.itg.ti.com> (raw)
In-Reply-To: <C9D59C82B94F474B872F2092A87F261412470D0874@dlee07.ent.ti.com>
From: "Murphy, Dan" <dmurphy@ti.com>
> Hemanth
> I have a few comments on this patch.
>
> +static ssize_t cma3000_store_attr_mdfftmr(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + struct platform_device *pdev = to_platform_device(dev);
> + struct cma3000_accl_data *data = platform_get_drvdata(pdev);
> + unsigned long val;
> + int error;
> +
> + error = strict_strtoul(buf, 0, &val);
> + if (error)
> + return error;
> +
> + mutex_lock(&data->mutex);
> + data->pdata.mdfftmr = val;
> +
> + disable_irq(data->client->irq);
> You should use disable_irq_nosync here. This may not work properly on SMP.
Can u explain why disable_irq will not work on SMP.
>
>> + if (val == CMARANGE_2G) {
>> + ctrl |= CMA3000_RANGE2G;
>> + data->pdata.g_range = CMARANGE_2G;
>> + } else if (val == CMARANGE_8G) {
>> + ctrl |= CMA3000_RANGE8G;
>> + data->pdata.g_range = CMARANGE_8G;
>
> Why are you modifying the platform data? Why not just keep it in a global or a glocal structure and modify it that way?
If you look carefully, the variable data is indeed a local structure.
>> + } else {
>> + error = -EINVAL;
>> + goto err_op_failed;
>> + }
>> +
>> + g_range = data->pdata.g_range;
>> + fuzz_x = data->pdata.fuzz_x;
>> + fuzz_y = data->pdata.fuzz_y;
>> + fuzz_z = data->pdata.fuzz_z;
> Why are you storing these locally and then using them once can't we eliminate these completely and just pass the platform data values into the set
> params?
I belive this is already discussed and agreed upon in the previous thread of discussion.
Pl refer the same.
>> +
>> + disable_irq(data->client->irq);
> You should use disable_irq_nosync here. This may not work properly on SMP.
>
Same comment as above
>> + cma3000_set(data, CMA3000_CTRL, ctrl, "ctrl");
>> +
>> + input_set_abs_params(data->input_dev, ABS_X, -g_range,
>> + g_range, fuzz_x, 0);
>> + input_set_abs_params(data->input_dev, ABS_Y, -g_range,
>> + g_range, fuzz_y, 0);
>> + input_set_abs_params(data->input_dev, ABS_Z, -g_range,
>> + g_range, fuzz_z, 0);
> Don't necessarily agree with modifying the parameters for the input device on the fly. Some implementations may be a read once on init and do not
> go back and check this.
Its the user space code that can modify the grange if required, so I suppose it will need to check
these values after modifying the range.
>
>
> + ret = request_threaded_irq(data->client->irq, NULL,
> + cma3000_thread_irq,
> + irqflags | IRQF_ONESHOT,
> + data->client->name, data);
>
> This is implemented wrong. You are doing a lot of processing in the IRQ context here. Especially calls out to a peripheral. The NULL should be
> your handler thread where you do all the device processing.
Are u sure u are referring to threaded irq, all the processing is being done in thread
context. Pl refer documentation for more details on threaded irqs.
>
> Also this implementation only suggests that the HW has the IRQ connected what about devices that the IRQ line was not connected?
>
This is currently not implemented, since I am not aware of any boards with this configuration. A polling method could be added
in future if the need arises.
next prev parent reply other threads:[~2010-08-16 9:45 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-21 6:52 [RFC] [PATCH V2 1/2] input: CMA3000 Accelerometer driver Hemanth V
2010-05-21 11:57 ` Jonathan Cameron
2010-05-21 14:13 ` Hemanth V
2010-08-13 12:47 ` Hemanth V
2010-08-13 13:34 ` Murphy, Dan
2010-08-16 9:45 ` Hemanth V [this message]
2010-08-29 18:24 ` Dmitry Torokhov
2010-08-29 18:49 ` Dmitry Torokhov
2010-08-30 16:04 ` Sensors and the input layer (was Re: [RFC] [PATCH V2 1/2] input: CMA3000 Accelerometer driver) Felipe Balbi
2010-08-30 16:28 ` Dmitry Torokhov
2010-08-30 17:10 ` Felipe Balbi
2010-08-30 17:21 ` Dmitry Torokhov
2010-08-30 18:52 ` Felipe Balbi
2010-08-30 20:50 ` Dmitry Torokhov
2010-08-31 9:53 ` Alan Cox
2010-08-30 17:41 ` Jonathan Cameron
2010-08-30 20:40 ` Alan Cox
2010-08-30 20:44 ` Dmitry Torokhov
2010-08-30 21:28 ` Linus Torvalds
2010-08-30 21:43 ` Dmitry Torokhov
2010-08-30 22:05 ` Linus Torvalds
2010-08-30 22:43 ` Dmitry Torokhov
2010-08-31 5:15 ` Felipe Balbi
2010-08-31 9:44 ` Alan Cox
2010-08-31 12:35 ` Jonathan Cameron
2010-08-31 16:17 ` Dmitry Torokhov
2010-08-31 16:59 ` Alan Cox
2010-08-31 17:09 ` Dmitry Torokhov
2010-08-31 17:24 ` Mohamed Ikbel Boulabiar
2010-08-31 18:14 ` Jonathan Cameron
2010-08-31 22:21 ` Chris Hudson
2010-09-24 13:02 ` Pavel Machek
2010-09-24 13:26 ` Jonathan Cameron
2010-08-31 18:03 ` Jonathan Cameron
2010-08-31 18:20 ` Jonathan Cameron
2010-09-14 7:12 ` Pavel Machek
2010-08-31 9:46 ` Alan Cox
2010-08-31 12:51 ` Jonathan Cameron
2010-08-31 18:18 ` Daniel Barkalow
2010-09-03 10:32 ` [RFC] [PATCH V2 1/2] input: CMA3000 Accelerometer driver Hemanth V
2010-09-03 16:34 ` Dmitry Torokhov
2010-09-06 9:03 ` Hemanth V
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=3776.10.24.255.18.1281951917.squirrel@dbdmail.itg.ti.com \
--to=hemanthv@ti.com \
--cc=akpm@linux-foundation.org \
--cc=dmurphy@ti.com \
--cc=jic23@cam.ac.uk \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
/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).