From: "Nuno Sá" <noname.nuno@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
linux-input@vger.kernel.org, Nuno Sa <nuno.sa@analog.com>
Cc: Michael Hennerich <michael.hennerich@analog.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/4] Input: adxl34x - use input_set_capability()
Date: Tue, 11 Jun 2024 11:09:49 +0200 [thread overview]
Message-ID: <a9d1a7771d78fdb0c5a165775645befe440af4ef.camel@gmail.com> (raw)
In-Reply-To: <20240610164301.1048482-2-dmitry.torokhov@gmail.com>
On Mon, 2024-06-10 at 09:42 -0700, Dmitry Torokhov wrote:
> Switch to using input_set_capability() instead of using __set_bit() to
> make clear what exactly kinds of events (EV_KEY, EV_REL) are being
> declared.
>
> Also drop redundant calls setting EV_ABS and ABS_X|Y|Z bits as that is
> taken care by input_set_abs_params().
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
>
> v2: new patch, split out from devm conversion at Nino's request
>
> drivers/input/misc/adxl34x.c | 32 +++++++++++++-------------------
> 1 file changed, 13 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c
> index fbe5a56c19d1..830acf29c32b 100644
> --- a/drivers/input/misc/adxl34x.c
> +++ b/drivers/input/misc/adxl34x.c
> @@ -769,18 +769,12 @@ struct adxl34x *adxl34x_probe(struct device *dev, int
> irq,
>
> input_set_drvdata(input_dev, ac);
>
> - __set_bit(ac->pdata.ev_type, input_dev->evbit);
> -
> if (ac->pdata.ev_type == EV_REL) {
> - __set_bit(REL_X, input_dev->relbit);
> - __set_bit(REL_Y, input_dev->relbit);
> - __set_bit(REL_Z, input_dev->relbit);
> + input_set_capability(input_dev, EV_REL, REL_X);
> + input_set_capability(input_dev, EV_REL, REL_Y);
> + input_set_capability(input_dev, EV_REL, REL_Z);
> } else {
> /* EV_ABS */
> - __set_bit(ABS_X, input_dev->absbit);
> - __set_bit(ABS_Y, input_dev->absbit);
> - __set_bit(ABS_Z, input_dev->absbit);
> -
> if (pdata->data_range & FULL_RES)
> range = ADXL_FULLRES_MAX_VAL; /* Signed 13-bit */
> else
> @@ -791,18 +785,18 @@ struct adxl34x *adxl34x_probe(struct device *dev, int
> irq,
> input_set_abs_params(input_dev, ABS_Z, -range, range, 3, 3);
> }
>
> - __set_bit(EV_KEY, input_dev->evbit);
> - __set_bit(pdata->ev_code_tap[ADXL_X_AXIS], input_dev->keybit);
> - __set_bit(pdata->ev_code_tap[ADXL_Y_AXIS], input_dev->keybit);
> - __set_bit(pdata->ev_code_tap[ADXL_Z_AXIS], input_dev->keybit);
> + input_set_capability(input_dev, EV_KEY, pdata-
> >ev_code_tap[ADXL_X_AXIS]);
> + input_set_capability(input_dev, EV_KEY, pdata-
> >ev_code_tap[ADXL_Y_AXIS]);
> + input_set_capability(input_dev, EV_KEY, pdata-
> >ev_code_tap[ADXL_Z_AXIS]);
>
> if (pdata->ev_code_ff) {
> ac->int_mask = FREE_FALL;
> - __set_bit(pdata->ev_code_ff, input_dev->keybit);
> + input_set_capability(input_dev, EV_KEY, pdata->ev_code_ff);
> }
>
> if (pdata->ev_code_act_inactivity)
> - __set_bit(pdata->ev_code_act_inactivity, input_dev->keybit);
> + input_set_capability(input_dev, EV_KEY,
> + pdata->ev_code_act_inactivity);
>
> ac->int_mask |= ACTIVITY | INACTIVITY;
>
> @@ -874,13 +868,13 @@ struct adxl34x *adxl34x_probe(struct device *dev, int
> irq,
>
> if (pdata->orientation_enable & ADXL_EN_ORIENTATION_3D)
> for (i = 0; i < ARRAY_SIZE(pdata-
> >ev_codes_orient_3d); i++)
> - __set_bit(pdata->ev_codes_orient_3d[i],
> - input_dev->keybit);
> + input_set_capability(input_dev, EV_KEY,
> + pdata-
> >ev_codes_orient_3d[i]);
>
> if (pdata->orientation_enable & ADXL_EN_ORIENTATION_2D)
> for (i = 0; i < ARRAY_SIZE(pdata-
> >ev_codes_orient_2d); i++)
> - __set_bit(pdata->ev_codes_orient_2d[i],
> - input_dev->keybit);
> + input_set_capability(input_dev, EV_KEY,
> + pdata-
> >ev_codes_orient_2d[i]);
> } else {
> ac->pdata.orientation_enable = 0;
> }
next prev parent reply other threads:[~2024-06-11 9:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-10 16:42 [PATCH v2 1/4] Input: adxl34x - use device core to create driver-specific device attributes Dmitry Torokhov
2024-06-10 16:42 ` [PATCH v2 2/4] Input: adxl34x - use input_set_capability() Dmitry Torokhov
2024-06-11 9:09 ` Nuno Sá [this message]
2024-06-10 16:42 ` [PATCH v2 3/4] Input: adxl34x - switch to using managed resources Dmitry Torokhov
2024-06-11 9:11 ` Nuno Sá
2024-06-10 16:43 ` [PATCH v2 4/4] Input: adxl34x- switch to using "guard" notation Dmitry Torokhov
2024-06-11 8:45 ` [PATCH v2 1/4] Input: adxl34x - use device core to create driver-specific device attributes Hennerich, Michael
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=a9d1a7771d78fdb0c5a165775645befe440af4ef.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.hennerich@analog.com \
--cc=nuno.sa@analog.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).