[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/57] hw/misc/pca9552: Rename 'nr_leds' as 'pin_count'
From: |
Peter Maydell |
Subject: |
[PULL 05/57] hw/misc/pca9552: Rename 'nr_leds' as 'pin_count' |
Date: |
Fri, 26 Jun 2020 16:13:32 +0100 |
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
The PCA9552 device does not expose LEDs, but simple pins
to connnect LEDs to. To be clearer with the device model,
rename 'nr_leds' as 'pin_count'.
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Cédric Le Goater <clg@kaod.org>
Message-id: 20200623072723.6324-3-f4bug@amsat.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
include/hw/misc/pca9552.h | 2 +-
hw/misc/pca9552.c | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/hw/misc/pca9552.h b/include/hw/misc/pca9552.h
index ebb43c63fe1..bc5ed310878 100644
--- a/include/hw/misc/pca9552.h
+++ b/include/hw/misc/pca9552.h
@@ -26,7 +26,7 @@ typedef struct PCA9552State {
uint8_t regs[PCA9552_NR_REGS];
uint8_t max_reg;
- uint8_t nr_leds;
+ uint8_t pin_count;
} PCA9552State;
#endif
diff --git a/hw/misc/pca9552.c b/hw/misc/pca9552.c
index cac729e35af..81da757a7ea 100644
--- a/hw/misc/pca9552.c
+++ b/hw/misc/pca9552.c
@@ -37,7 +37,7 @@ static void pca9552_update_pin_input(PCA9552State *s)
{
int i;
- for (i = 0; i < s->nr_leds; i++) {
+ for (i = 0; i < s->pin_count; i++) {
uint8_t input_reg = PCA9552_INPUT0 + (i / 8);
uint8_t input_shift = (i % 8);
uint8_t config = pca9552_pin_get_config(s, i);
@@ -185,7 +185,7 @@ static void pca9552_get_led(Object *obj, Visitor *v, const
char *name,
error_setg(errp, "%s: error reading %s", __func__, name);
return;
}
- if (led < 0 || led > s->nr_leds) {
+ if (led < 0 || led > s->pin_count) {
error_setg(errp, "%s invalid led %s", __func__, name);
return;
}
@@ -228,7 +228,7 @@ static void pca9552_set_led(Object *obj, Visitor *v, const
char *name,
error_setg(errp, "%s: error reading %s", __func__, name);
return;
}
- if (led < 0 || led > s->nr_leds) {
+ if (led < 0 || led > s->pin_count) {
error_setg(errp, "%s invalid led %s", __func__, name);
return;
}
@@ -291,9 +291,9 @@ static void pca9552_initfn(Object *obj)
* PCA955X device
*/
s->max_reg = PCA9552_LS3;
- s->nr_leds = 16;
+ s->pin_count = 16;
- for (led = 0; led < s->nr_leds; led++) {
+ for (led = 0; led < s->pin_count; led++) {
char *name;
name = g_strdup_printf("led%d", led);
--
2.20.1
- [PULL 00/57] target-arm queue, Peter Maydell, 2020/06/26
- [PULL 01/57] hw/arm/aspeed: Remove extraneous MemoryRegion object owner, Peter Maydell, 2020/06/26
- [PULL 02/57] hw/arm/aspeed: Rename AspeedBoardState as AspeedMachineState, Peter Maydell, 2020/06/26
- [PULL 03/57] hw/arm/aspeed: QOM'ify AspeedMachineState, Peter Maydell, 2020/06/26
- [PULL 05/57] hw/misc/pca9552: Rename 'nr_leds' as 'pin_count',
Peter Maydell <=
- [PULL 04/57] hw/i2c/core: Add i2c_try_create_slave() and i2c_realize_and_unref(), Peter Maydell, 2020/06/26
- [PULL 06/57] hw/misc/pca9552: Rename generic code as pca955x, Peter Maydell, 2020/06/26
- [PULL 09/57] hw/misc/pca9552: Trace GPIO High/Low events, Peter Maydell, 2020/06/26
- [PULL 07/57] hw/misc/pca9552: Add generic PCA955xClass, parent of TYPE_PCA9552, Peter Maydell, 2020/06/26
- [PULL 08/57] hw/misc/pca9552: Add a 'description' property for debugging purpose, Peter Maydell, 2020/06/26
- [PULL 12/57] hw/misc/pca9552: Model qdev output GPIOs, Peter Maydell, 2020/06/26
- [PULL 10/57] hw/arm/aspeed: Describe each PCA9552 device, Peter Maydell, 2020/06/26
- [PULL 11/57] hw/misc/pca9552: Trace GPIO change events, Peter Maydell, 2020/06/26
- [PULL 15/57] target/arm: Add support for MTE to SCTLR_ELx, Peter Maydell, 2020/06/26
- [PULL 14/57] target/arm: Improve masking of SCR RES0 bits, Peter Maydell, 2020/06/26