Revision b1503cda hw/max7310.c

b/hw/max7310.c
180 180
static void max7310_gpio_set(void *opaque, int line, int level)
181 181
{
182 182
    struct max7310_s *s = (struct max7310_s *) opaque;
183
    if (line >= sizeof(s->handler) / sizeof(*s->handler) || line  < 0)
183
    if (line >= ARRAY_SIZE(s->handler) || line  < 0)
184 184
        hw_error("bad GPIO line");
185 185

  
186 186
    if (level)
......
199 199
    s->i2c.recv = max7310_rx;
200 200
    s->i2c.send = max7310_tx;
201 201
    s->gpio_in = qemu_allocate_irqs(max7310_gpio_set, s,
202
                    sizeof(s->handler) / sizeof(*s->handler));
202
                    ARRAY_SIZE(s->handler));
203 203

  
204 204
    max7310_reset(&s->i2c);
205 205

  
......
217 217
void max7310_gpio_out_set(i2c_slave *i2c, int line, qemu_irq handler)
218 218
{
219 219
    struct max7310_s *s = (struct max7310_s *) i2c;
220
    if (line >= sizeof(s->handler) / sizeof(*s->handler) || line  < 0)
220
    if (line >= ARRAY_SIZE(s->handler) || line  < 0)
221 221
        hw_error("bad GPIO line");
222 222

  
223 223
    s->handler[line] = handler;

Also available in: Unified diff