From: Jonathan Cameron <jic23@kernel.org>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Reyad Attiyat <reyad.attiyat@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
linux-input <linux-input@vger.kernel.org>,
Jiri Kosina <jkosina@suse.cz>
Subject: Re: [PATCHv2 3/3] IIO: hid-sensor-magn-3d: Add in support for True/Magnetic North HID usages
Date: Mon, 09 Jun 2014 18:47:24 +0100 [thread overview]
Message-ID: <5395F32C.10100@kernel.org> (raw)
In-Reply-To: <538F3E6A.4080905@linux.intel.com>
On 04/06/14 16:42, Srinivas Pandruvada wrote:
> On 06/04/2014 08:23 AM, Reyad Attiyat wrote:
>> Hey Srinivas,
>>
>> On Tue, Jun 3, 2014 at 12:43 PM, Srinivas Pandruvada
>> <srinivas.pandruvada@linux.intel.com> wrote:
>>
>>>
>>> May be we should have a field in const struct iio_chan_spec, so that we
>>> can dynamically enable disable channels. In this way we can statically
>>> define channels, but can be enabled/disabled dynamically.
>>>
>> Would this require changing iio subsystem to create sysfs entries only
>> when enabled? Would we need to add functions to disable and enable
>> later on?
>
> This is just a thought. You don't have to change it. I am sure Jonathan will have some opinion this.
Replied to earlier message. If there is some common code we can factor out into
the core then I'm happy to do so, but I don't see an advantage in using
a field, rather than just tailoring the copy in the first place. e.g.
1) Pass whatever is needed to figure out how many channels are present.
2) Allocate space for that many channels.
3) Copy said channels from predefined versions, perhaps amending as necessary.
This is a reasonably common pattern in complex parts or those with hugely
variable numbers of channels...
>
>>>
>>> I think we need to present angle in radians. Are you basing change present
>>> in linux-next? This will automatically do in this function.
>>>
>> I'll look into this. What function should I use to make the iio chanel
>> to report radians?
> I think it will work if the existing sequence is maintained
> st->scale_precision = hid_sensor_format_scale(
> HID_USAGE_SENSOR_COMPASS_3D,
> &st->magn[CHANNEL_SCAN_INDEX_X],
> &st->scale_pre_decml, &st->scale_post_decml);
>
> So as long as you call this function, the scale value to user space will
> be returned correctly.
>
>>>
>>>
>>> I don't see kfree. Try devm_kcalloc?
>>>
>> I changed kmemdup to kcalloc so there is still a kfree in the exsiting
>> code. I can change this to devm_kcalloc but only if we don't go with
>> static channels that are enabled as found.
>>
> Since you are changing this part, devm_ calls are preferred, I think.
As long as it doesn't add complexity or possibility of race conditions,
devm calls are usually a good idea.
>
> Thanks,
> Srinivas
>
>
>> Thanks,
>> Reyad Attiyat
>>
>
next prev parent reply other threads:[~2014-06-09 17:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-02 23:14 [PATCHv2 0/3] IIO: Add support for compass north usage attribute Reyad Attiyat
[not found] ` <1401750890-31854-1-git-send-email-reyad.attiyat-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-06-02 23:14 ` [PATCHv2 1/3] IIO: Documentation: Add north attribute to ABI docs Reyad Attiyat
[not found] ` <1401750890-31854-2-git-send-email-reyad.attiyat-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-06-09 17:50 ` Jonathan Cameron
2014-06-02 23:14 ` [PATCHv2 2/3] IIO: Add iio_chan modifier for True/Magnetic North HID usages Reyad Attiyat
2014-06-09 17:51 ` Jonathan Cameron
[not found] ` <5395F424.4070407-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-06-09 17:52 ` Jonathan Cameron
2014-06-02 23:14 ` [PATCHv2 3/3] IIO: hid-sensor-magn-3d: Add in support " Reyad Attiyat
[not found] ` <1401750890-31854-4-git-send-email-reyad.attiyat-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-06-03 17:43 ` Srinivas Pandruvada
[not found] ` <538E092F.9040004-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-06-04 15:23 ` Reyad Attiyat
2014-06-04 15:42 ` Srinivas Pandruvada
2014-06-09 17:47 ` Jonathan Cameron [this message]
2014-06-09 17:43 ` Jonathan Cameron
2014-06-09 19:55 ` Jonathan Cameron
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=5395F32C.10100@kernel.org \
--to=jic23@kernel.org \
--cc=jkosina@suse.cz \
--cc=linux-iio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=reyad.attiyat@gmail.com \
--cc=srinivas.pandruvada@linux.intel.com \
/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).