~jderose/ubuntu/raring/qemu/vde-again

« back to all changes in this revision

Viewing changes to hw/max7310.c

  • Committer: Bazaar Package Importer
  • Author(s): Aurelien Jarno, Aurelien Jarno
  • Date: 2009-03-22 10:13:17 UTC
  • mfrom: (1.2.1 upstream) (6.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090322101317-iigjtnu5qil35dtb
Tags: 0.10.1-1
[ Aurelien Jarno ]
* New upstream stable release:
  - patches/80_stable-branch.patch: remove.
* debian/control: 
  - Remove depends on proll.
  - Move depends on device-tree-compiler to build-depends.
  - Bump Standards-Version to 3.8.1 (no changes).
* patches/82_qemu-img_decimal.patch: new patch from upstream to make
  qemu-img accept sizes with decimal values (closes: bug#501400).

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
        s->i2c_command_byte = 1;
135
135
        break;
136
136
    case I2C_FINISH:
 
137
#ifdef VERBOSE
137
138
        if (s->len == 1)
138
 
#ifdef VERBOSE
139
139
            printf("%s: message too short (%i bytes)\n", __FUNCTION__, s->len);
140
140
#endif
141
141
        break;
177
177
    return 0;
178
178
}
179
179
 
180
 
static int max7310_iid = 0;
181
 
 
182
180
static void max7310_gpio_set(void *opaque, int line, int level)
183
181
{
184
182
    struct max7310_s *s = (struct max7310_s *) opaque;
185
 
    if (line >= sizeof(s->handler) / sizeof(*s->handler) || line  < 0)
 
183
    if (line >= ARRAY_SIZE(s->handler) || line  < 0)
186
184
        hw_error("bad GPIO line");
187
185
 
188
186
    if (level)
201
199
    s->i2c.recv = max7310_rx;
202
200
    s->i2c.send = max7310_tx;
203
201
    s->gpio_in = qemu_allocate_irqs(max7310_gpio_set, s,
204
 
                    sizeof(s->handler) / sizeof(*s->handler));
 
202
                    ARRAY_SIZE(s->handler));
205
203
 
206
204
    max7310_reset(&s->i2c);
207
205
 
208
 
    register_savevm("max7310", max7310_iid ++, 0,
209
 
                    max7310_save, max7310_load, s);
 
206
    register_savevm("max7310", -1, 0, max7310_save, max7310_load, s);
210
207
 
211
208
    return &s->i2c;
212
209
}
220
217
void max7310_gpio_out_set(i2c_slave *i2c, int line, qemu_irq handler)
221
218
{
222
219
    struct max7310_s *s = (struct max7310_s *) i2c;
223
 
    if (line >= sizeof(s->handler) / sizeof(*s->handler) || line  < 0)
 
220
    if (line >= ARRAY_SIZE(s->handler) || line  < 0)
224
221
        hw_error("bad GPIO line");
225
222
 
226
223
    s->handler[line] = handler;