On 19 December 2015 at 21:45, Peter Crosthwaite
<crosthwaitepe...@gmail.com> wrote:
> On Fri, Dec 11, 2015 at 04:37:10PM +0000, Peter Maydell wrote:
>> Convert the pxa2xx_mmci device from manual save/load
>> functions to a VMStateDescription structure.
>>
>> This is a migration compatibility break.

>> +static bool pxa2xx_mmci_vmstate_validate(void *opaque, int version_id)
>> +{
>> +    PXA2xxMMCIState *s = opaque;
>> +
>> +    return s->tx_start < sizeof(s->tx_fifo)
>> +        && s->rx_start < sizeof(s->rx_fifo)
>> +        && s->tx_len <= sizeof(s->tx_fifo)
>> +        && s->rx_len <= sizeof(s->rx_fifo)
>> +        && s->resp_len <= sizeof(s->resp_fifo);
>
>
> A nit, but I wonder if ARRAY_SIZE should be generally used in this case, as
> it is a little more self documenting and would make code identical to
> non-byte FIFOs.

Yes. In particular ARRAY_SIZE(s->resp_fifo) is correct
and sizeof(s->resp_fifo) is wrong because that array is uint16_t...

>> +}
>> +
>
> Extra blank.
>
>> +
>> +static const VMStateDescription vmstate_pxa2xx_mmci = {
>
> Is the registration in class_init missing?

Does seem to be...

thanks
-- PMM

Reply via email to