pxa27x: Add 'const' attribute to keyboard maps
PATCH 1/1 pxa27x: Add 'const' attribute to keyboard maps
The mapping is a hardware feature, so it is relatively constant.
Signed-off-by Stefan Weil <[email protected]>
--- hw/arm/mainstone.c | 2 +- hw/arm/z2.c | 2 +- hw/input/pxa2xx_keypad.c | 6 +++--- include/hw/arm/pxa.h | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-)
hw/arm/mainstone.c +1 -1
@@ -45,7 +45,7 @@#define S1_STSCHG_IRQ 14#define S1_IRQ 15 -static struct keymap map[0xE0 ] = { +static const struct keymap map[0xE0 ] = { [0 ...0xDF ] = {-1 ,-1 }, [0x1e ] = {0 ,0 },/* a */ [0x30 ] = {0 ,1 },/* b */
hw/arm/z2.c +1 -1
@@ -33,7 +33,7 @@#define DPRINTF (fmt, ...)#endif -static struct keymap map[0x100 ] = { +static const struct keymap map[0x100 ] = { [0 ...0xff ] = {-1 ,-1 }, [0x3b ] = {0 ,0 },/* Option = F1 */ [0xc8 ] = {0 ,1 },/* Up */
hw/input/pxa2xx_keypad.c +3 -3
@@ -85,7 +85,7 @@struct PXA2xxKeyPadState {MemoryRegion iomem;qemu_irq irq; -struct keymap *map; +const struct keymap *map;int pressed_cnt;int alt_code;
@@ -322,8 +322,8 @@ PXA2xxKeyPadState *pxa27x_keypad_init(MemoryRegion *sysmem,return s; } -void pxa27x_register_keypad (PXA2xxKeyPadState *kp,struct keymap *map, -int size) +void pxa27x_register_keypad (PXA2xxKeyPadState *kp, +const struct keymap *map,int size) {if (!map || size <0x80 ) {fprintf (stderr,"%s - No PXA keypad map defined\n" , __FUNCTION__);
include/hw/arm/pxa.h +2 -2
@@ -109,8 +109,8 @@ typedef struct PXA2xxKeyPadState PXA2xxKeyPadState;PXA2xxKeyPadState *pxa27x_keypad_init (MemoryRegion *sysmem,hwaddr base,qemu_irq irq); -void pxa27x_register_keypad (PXA2xxKeyPadState *kp,struct keymap *map, -int size); +void pxa27x_register_keypad (PXA2xxKeyPadState *kp, +const struct keymap *map,int size);/* pxa2xx.c */ typedef struct PXA2xxI2CState PXA2xxI2CState ;
Signature · 1 line
1.7.10.4
Quoted 1 line · Stefan Weil
The mapping is a hardware feature, so it is relatively constant.
This is true but not particularly relevant to whether we should be marking the structs and parameters as 'const' or not. Still, the change is good, so
Reviewed-by Peter Maydell <[email protected]>
thanks
-- PMM
Michael Tokarev
AppliedQuoted 1 line · Stefan Weil
The mapping is a hardware feature, so it is relatively constant.
Thanks, applied to the trivial-patches queue.
/mjt