qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Andrzej Zaborowski" <balrogg@gmail.com>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] hw/input/lm832x: move LM8323 declarations to input/keypad.h
Date: Tue, 19 Sep 2017 16:52:05 +0200	[thread overview]
Message-ID: <9832b91c-18dd-778a-b7a1-696a27359721@redhat.com> (raw)
In-Reply-To: <20170919125041.2153-1-f4bug@amsat.org>

On 19/09/2017 14:50, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Based-on: 20170919123053.32675-1-f4bug@amsat.org
> 
> $ ./scripts/get_maintainer.pl -f hw/input/lm832x.c
> get_maintainer.pl: No maintainers found, printing recent contributors.

I think the keymap and handler should be moved entirely to
hw/input/lm832x.c, removing the corresponding code from nseries.c; same
for tsc210x.c.

Unfortunately this is not my area, so I'm not very sure about it.  But
it should be relatively easy to write a qtest for lm832x, since it's an
i2c device just like e.g. tmp105.c (you can use QMP to send keys).

Thanks,

Paolo

>  include/hw/i2c/i2c.h      |  3 ---
>  include/hw/input/keypad.h | 23 +++++++++++++++++++++++
>  hw/arm/nseries.c          |  3 ++-
>  hw/input/lm832x.c         |  3 +--
>  4 files changed, 26 insertions(+), 6 deletions(-)
>  create mode 100644 include/hw/input/keypad.h
> 
> diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h
> index 24e95d0155..8fdf3e47d6 100644
> --- a/include/hw/i2c/i2c.h
> +++ b/include/hw/i2c/i2c.h
> @@ -70,9 +70,6 @@ int i2c_recv(I2CBus *bus);
>  
>  DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr);
>  
> -/* lm832x.c */
> -void lm832x_key_event(DeviceState *dev, int key, int state);
> -
>  extern const VMStateDescription vmstate_i2c_slave;
>  
>  #define VMSTATE_I2C_SLAVE(_field, _state) {                          \
> diff --git a/include/hw/input/keypad.h b/include/hw/input/keypad.h
> new file mode 100644
> index 0000000000..efacef6458
> --- /dev/null
> +++ b/include/hw/input/keypad.h
> @@ -0,0 +1,23 @@
> +/*
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms and conditions of the GNU General Public License,
> + * version 2 or later, as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> + * more details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * this program.  If not, see <http://www.gnu.org/licenses/>.
> + */
> +#ifndef HW_KEYPAD_H
> +#define HW_KEYPAD_H
> +
> +#include "hw/hw.h"
> +
> +#define TYPE_LM8323 "lm8323"
> +
> +void lm832x_key_event(DeviceState *dev, int key, int state);
> +
> +#endif
> diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
> index a32ac82702..594b7e878c 100644
> --- a/hw/arm/nseries.c
> +++ b/hw/arm/nseries.c
> @@ -30,6 +30,7 @@
>  #include "ui/console.h"
>  #include "hw/boards.h"
>  #include "hw/i2c/i2c.h"
> +#include "hw/input/keypad.h"
>  #include "hw/devices.h"
>  #include "hw/block/flash.h"
>  #include "hw/hw.h"
> @@ -412,7 +413,7 @@ static void n810_kbd_setup(struct n800_s *s)
>      /* Attach the LM8322 keyboard to the I2C bus,
>       * should happen in n8x0_i2c_setup and s->kbd be initialised here.  */
>      s->kbd = i2c_create_slave(omap_i2c_bus(s->mpu->i2c[0]),
> -                           "lm8323", N810_LM8323_ADDR);
> +                              TYPE_LM8323, N810_LM8323_ADDR);
>      qdev_connect_gpio_out(s->kbd, 0, kbd_irq);
>  }
>  
> diff --git a/hw/input/lm832x.c b/hw/input/lm832x.c
> index 2340523da0..868ddfe5ea 100644
> --- a/hw/input/lm832x.c
> +++ b/hw/input/lm832x.c
> @@ -19,12 +19,11 @@
>   */
>  
>  #include "qemu/osdep.h"
> -#include "hw/hw.h"
>  #include "hw/i2c/i2c.h"
> +#include "hw/input/keypad.h"
>  #include "qemu/timer.h"
>  #include "ui/console.h"
>  
> -#define TYPE_LM8323 "lm8323"
>  #define LM8323(obj) OBJECT_CHECK(LM823KbdState, (obj), TYPE_LM8323)
>  
>  typedef struct {
> 

      parent reply	other threads:[~2017-09-19 14:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19 12:50 [Qemu-devel] [PATCH] hw/input/lm832x: move LM8323 declarations to input/keypad.h Philippe Mathieu-Daudé
2017-09-19 13:56 ` no-reply
2017-09-19 14:52 ` Paolo Bonzini [this message]

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=9832b91c-18dd-778a-b7a1-696a27359721@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=balrogg@gmail.com \
    --cc=f4bug@amsat.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.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).