aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormalc <malc@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-22 20:33:55 +0000
committermalc <malc@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-22 20:33:55 +0000
commitb1503cda1e78cad4dca522ddbb4c69f4c6869bcd (patch)
tree26edd30543fcb27ae90f8762558ea878df42ec57 /hw/max7310.c
parenthw/slavio_misc.c remove address from debug trace (Robert Reif) (diff)
downloadqemu-kvm-b1503cda1e78cad4dca522ddbb4c69f4c6869bcd.tar.gz
qemu-kvm-b1503cda1e78cad4dca522ddbb4c69f4c6869bcd.tar.bz2
qemu-kvm-b1503cda1e78cad4dca522ddbb4c69f4c6869bcd.zip
Use the ARRAY_SIZE() macro where appropriate.
Change from v1: Avoid changing the existing coding style in certain files. Signed-off-by: Stuart Brady <stuart.brady@gmail.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6120 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/max7310.c')
-rw-r--r--hw/max7310.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/max7310.c b/hw/max7310.c
index 2816611a8..ee5758103 100644
--- a/hw/max7310.c
+++ b/hw/max7310.c
@@ -180,7 +180,7 @@ static int max7310_load(QEMUFile *f, void *opaque, int version_id)
static void max7310_gpio_set(void *opaque, int line, int level)
{
struct max7310_s *s = (struct max7310_s *) opaque;
- if (line >= sizeof(s->handler) / sizeof(*s->handler) || line < 0)
+ if (line >= ARRAY_SIZE(s->handler) || line < 0)
hw_error("bad GPIO line");
if (level)
@@ -199,7 +199,7 @@ struct i2c_slave *max7310_init(i2c_bus *bus)
s->i2c.recv = max7310_rx;
s->i2c.send = max7310_tx;
s->gpio_in = qemu_allocate_irqs(max7310_gpio_set, s,
- sizeof(s->handler) / sizeof(*s->handler));
+ ARRAY_SIZE(s->handler));
max7310_reset(&s->i2c);
@@ -217,7 +217,7 @@ qemu_irq *max7310_gpio_in_get(i2c_slave *i2c)
void max7310_gpio_out_set(i2c_slave *i2c, int line, qemu_irq handler)
{
struct max7310_s *s = (struct max7310_s *) i2c;
- if (line >= sizeof(s->handler) / sizeof(*s->handler) || line < 0)
+ if (line >= ARRAY_SIZE(s->handler) || line < 0)
hw_error("bad GPIO line");
s->handler[line] = handler;