Skip to contentSkip to conversation

hw/input/lm832x: move LM8323 declarations to input/keypad.h

PATCH In review Philippe Mathieu-Daudé 3 participants 3 messages Sep 19, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/input/lm832x: move LM8323 declarations to input/keypad.h

---
Based-on: [email protected]

$ ./scripts/get_maintainer.pl -f hw/input/lm832x.c
get_maintainer.pl: No maintainers found, printing recent contributors.
 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
include/hw/i2c/i2c.h +0 -3
index 24e95d0155..8fdf3e47d6 100644
@@ -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) {                          \
include/hw/input/keypad.h new file +23 -0
new file mode 100644
index 0000000000..efacef6458
@@ -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
hw/arm/nseries.c +2 -1
index a32ac82702..594b7e878c 100644
@@ -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);
 }
 
hw/input/lm832x.c +1 -2
index 2340523da0..868ddfe5ea 100644
@@ -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 {
Signature · 1 line
2.14.1
#1 lore raw
This series seems to have some coding style problems. See output below for more information:

Hi,

This series seems to have some coding style problems. See output below for more information:

Subject: [Qemu-devel] [PATCH] hw/input/lm832x: move LM8323 declarations to input/keypad.h
Message-id: [email protected]
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
error: Could not fetch 3c8cf5a9c21ff8782164d1def7f44bd888713384 Traceback (most recent call last):
File "/usr/bin/patchew", line 442, in test_one

    git_clone_repo(clone, r["repo"], r["head"], logf)

File "/usr/bin/patchew", line 48, in git_clone_repo
stdout=logf, stderr=logf)
File "/usr/lib64/python3.6/subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['git', 'remote', 'add', '-f', '--mirror=fetch', '3c8cf5a9c21ff8782164d1def7f44bd888713384', 'https://github.com/patchew-project/qemu']' returned non-zero exit status 1.

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]

#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 6 lines · Philippe Mathieu-Daudé

---
Based-on: [email protected]

$ ./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

Quoted 90 lines
 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
include/hw/i2c/i2c.h +0 -3
index 24e95d0155..8fdf3e47d6 100644
@@ -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) {                          \
include/hw/input/keypad.h new file +23 -0
new file mode 100644
index 0000000000..efacef6458
@@ -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
hw/arm/nseries.c +2 -1
index a32ac82702..594b7e878c 100644
@@ -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);
 }
 
hw/input/lm832x.c +1 -2
index 2340523da0..868ddfe5ea 100644
@@ -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 {