aboutsummaryrefslogtreecommitdiff
path: root/hw/max7310.c
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
parent5626b017d623cb88d973b53bca11613c766b1715 (diff)
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 2816611a80..ee57581030 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;