From: Jonathan Cameron <jic23@kernel.org>
To: Ye Xiang <xiang.ye@intel.com>
Cc: jikos@kernel.org, srinivas.pandruvada@linux.intel.com,
linux-input@vger.kernel.org, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] iio: hid-sensors: Move get sensitivity attribute to hid-sensor-common
Date: Sat, 23 Jan 2021 16:12:28 +0000 [thread overview]
Message-ID: <20210123161228.3a52121d@archlinux> (raw)
In-Reply-To: <20210120074706.23199-2-xiang.ye@intel.com>
On Wed, 20 Jan 2021 15:47:04 +0800
Ye Xiang <xiang.ye@intel.com> wrote:
> No functional change has been made with this patch. The main intent here
> is to reduce code repetition of get sensitivity attribute.
>
> In the current implementation, sensor_hub_input_get_attribute_info() is
> called from multiple drivers to get attribute info for sensitivity
> field. Moving this to common place will avoid code repetition.
>
> Signed-off-by: Ye Xiang <xiang.ye@intel.com>
One trivial note inline about an accidental indentation change. If that's
all I find in the series I'll fix it up whilst applying.
Thanks,
Jonathan
...
> /* Channel definitions */
> static const struct iio_chan_spec magn_3d_channels[] = {
> {
> @@ -448,32 +453,11 @@ static int magn_3d_parse_report(struct platform_device *pdev,
> &st->rot_attr.scale_pre_decml,
> &st->rot_attr.scale_post_decml);
>
> - /* Set Sensitivity field ids, when there is no individual modifier */
> - if (st->magn_flux_attributes.sensitivity.index < 0) {
> - sensor_hub_input_get_attribute_info(hsdev,
> - HID_FEATURE_REPORT, usage_id,
> - HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS |
> - HID_USAGE_SENSOR_DATA_ORIENTATION,
> - &st->magn_flux_attributes.sensitivity);
> - dev_dbg(&pdev->dev, "Sensitivity index:report %d:%d\n",
> - st->magn_flux_attributes.sensitivity.index,
> - st->magn_flux_attributes.sensitivity.report_id);
> - }
> - if (st->magn_flux_attributes.sensitivity.index < 0) {
> - sensor_hub_input_get_attribute_info(hsdev,
> - HID_FEATURE_REPORT, usage_id,
> - HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS |
> - HID_USAGE_SENSOR_ORIENT_MAGN_FLUX,
> - &st->magn_flux_attributes.sensitivity);
> - dev_dbg(&pdev->dev, "Sensitivity index:report %d:%d\n",
> - st->magn_flux_attributes.sensitivity.index,
> - st->magn_flux_attributes.sensitivity.report_id);
> - }
> if (st->rot_attributes.sensitivity.index < 0) {
> sensor_hub_input_get_attribute_info(hsdev,
> HID_FEATURE_REPORT, usage_id,
> HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS |
> - HID_USAGE_SENSOR_ORIENT_COMP_MAGN_NORTH,
> + HID_USAGE_SENSOR_ORIENT_COMP_MAGN_NORTH,
This change of alignment shouldn't be here.
> &st->rot_attributes.sensitivity);
> dev_dbg(&pdev->dev, "Sensitivity index:report %d:%d\n",
> st->rot_attributes.sensitivity.index,
> @@ -507,12 +491,16 @@ static int hid_magn_3d_probe(struct platform_device *pdev)
>
> ret = hid_sensor_parse_common_attributes(hsdev,
> HID_USAGE_SENSOR_COMPASS_3D,
> - &magn_state->magn_flux_attributes);
> + &magn_state->magn_flux_attributes,
> + magn_3d_sensitivity_addresses,
> + ARRAY_SIZE(magn_3d_sensitivity_addresses));
> if (ret) {
> dev_err(&pdev->dev, "failed to setup common attributes\n");
> return ret;
> }
> magn_state->rot_attributes = magn_state->magn_flux_attributes;
> + /* sensitivity of rot_attribute is not the same as magn_flux_attributes */
> + magn_state->rot_attributes.sensitivity.index = -1;
>
> ret = magn_3d_parse_report(pdev, hsdev,
> &channels, &chan_count,
next prev parent reply other threads:[~2021-01-23 16:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-20 7:47 [PATCH 0/3] resolve read hystersis return invalid argument issue for hid sensors Ye Xiang
2021-01-20 7:47 ` [PATCH 1/3] iio: hid-sensors: Move get sensitivity attribute to hid-sensor-common Ye Xiang
2021-01-23 16:12 ` Jonathan Cameron [this message]
2021-01-20 7:47 ` [PATCH 2/3] hid-sensor-common: Add relative sensitivity check Ye Xiang
2021-01-24 13:14 ` Jonathan Cameron
2021-01-24 16:20 ` Srinivas Pandruvada
2021-01-28 16:35 ` Ye, Xiang
[not found] ` <20210131112648.3299b2a0@archlinux>
2021-01-31 20:32 ` Srinivas Pandruvada
2021-01-20 7:47 ` [PATCH 3/3] hid-sensors: Add more data fields for sensitivity checking Ye Xiang
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=20210123161228.3a52121d@archlinux \
--to=jic23@kernel.org \
--cc=jikos@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=xiang.ye@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).