All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Tero Kristo <tero.kristo@linux.intel.com>
Cc: "open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
	Jiri Kosina <jikos@kernel.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	lkml <linux-kernel@vger.kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Peter Hutterer <peter.hutterer@who-t.net>
Subject: Re: [RFCv3 1/7] HID: Add map_msc() to avoid boilerplate code
Date: Wed, 8 Dec 2021 16:03:02 +0100	[thread overview]
Message-ID: <CAO-hwJLUA8ErS-s3mA351WH48ebXCYJ-s5xj-oVarqAz43DUkg@mail.gmail.com> (raw)
In-Reply-To: <20211201164301.44653-2-tero.kristo@linux.intel.com>

On Wed, Dec 1, 2021 at 5:43 PM Tero Kristo <tero.kristo@linux.intel.com> wrote:
>
> From: Mika Westerberg <mika.westerberg@linux.intel.com>
>
> Since we are going to have more MSC events too, add map_msc() that can
> be used to fill in necessary fields and avoid boilerplate code.
>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>

This one looks good to me and I should be able to take it in v5.17.

Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

> ---
>  drivers/hid/hid-input.c | 6 ++----
>  include/linux/hid.h     | 4 ++++
>  2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
> index 2c72ce4147b1..39ebedb2323b 100644
> --- a/drivers/hid/hid-input.c
> +++ b/drivers/hid/hid-input.c
> @@ -52,6 +52,7 @@ static const struct {
>  #define map_rel(c)     hid_map_usage(hidinput, usage, &bit, &max, EV_REL, (c))
>  #define map_key(c)     hid_map_usage(hidinput, usage, &bit, &max, EV_KEY, (c))
>  #define map_led(c)     hid_map_usage(hidinput, usage, &bit, &max, EV_LED, (c))
> +#define map_msc(c)     hid_map_usage(hidinput, usage, &bit, &max, EV_MSC, (c))
>
>  #define map_abs_clear(c)       hid_map_usage_clear(hidinput, usage, &bit, \
>                 &max, EV_ABS, (c))
> @@ -872,10 +873,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
>
>                 case 0x5b: /* TransducerSerialNumber */
>                 case 0x6e: /* TransducerSerialNumber2 */
> -                       usage->type = EV_MSC;
> -                       usage->code = MSC_SERIAL;
> -                       bit = input->mscbit;
> -                       max = MSC_MAX;
> +                       map_msc(MSC_SERIAL);
>                         break;
>
>                 default:  goto unknown;
> diff --git a/include/linux/hid.h b/include/linux/hid.h
> index e95800bab56a..96eaca0d5322 100644
> --- a/include/linux/hid.h
> +++ b/include/linux/hid.h
> @@ -766,6 +766,10 @@ static inline void hid_map_usage(struct hid_input *hidinput,
>                 bmap = input->ledbit;
>                 limit = LED_MAX;
>                 break;
> +       case EV_MSC:
> +               bmap = input->mscbit;
> +               limit = MSC_MAX;
> +               break;
>         }
>
>         if (unlikely(c > limit || !bmap)) {
> --
> 2.25.1
>


  reply	other threads:[~2021-12-08 15:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01 16:42 [RFCv3 0/7] USI stylus support series Tero Kristo
2021-12-01 16:42 ` [RFCv3 1/7] HID: Add map_msc() to avoid boilerplate code Tero Kristo
2021-12-08 15:03   ` Benjamin Tissoires [this message]
2021-12-01 16:42 ` [RFCv3 2/7] HID: hid-input: Add suffix also for HID_DG_PEN Tero Kristo
2021-12-08 15:06   ` Benjamin Tissoires
2021-12-01 16:42 ` [RFCv3 3/7] HID: core: Add support for USI style events Tero Kristo
2021-12-08 15:18   ` Benjamin Tissoires
2021-12-08 16:33     ` Benjamin Tissoires
2021-12-10 10:31     ` Tero Kristo
2021-12-01 16:42 ` [RFCv3 4/7] HID: input: Make hidinput_find_field() static Tero Kristo
2021-12-08 15:19   ` Benjamin Tissoires
2021-12-01 16:42 ` [RFCv3 5/7] HID: debug: Add USI usages Tero Kristo
2021-12-01 16:43 ` [RFCv3 6/7] samples: hid: add new hid-usi sample Tero Kristo
2021-12-01 16:43 ` [RFCv3 7/7] samples: hid: convert USI sample to use unix socket for comms Tero Kristo
2021-12-08 15:30 ` [RFCv3 0/7] USI stylus support series Benjamin Tissoires
2021-12-09  7:51   ` Tero Kristo

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=CAO-hwJLUA8ErS-s3mA351WH48ebXCYJ-s5xj-oVarqAz43DUkg@mail.gmail.com \
    --to=benjamin.tissoires@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=peter.hutterer@who-t.net \
    --cc=tero.kristo@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.