i don't like the use of generic "int" qualifiers at all, even more the
unsigned version for things like absolute addresses, lengths and sizes.
of course negative values make sense in return types to indicate errors
and in the case a function returns the length of actually bytes written
on success and negative values on errors it makes sense to keep the
parameters the same type (else the parameter length might be too big to
return it on success).
i would also like to change the types to more accurate ones someday
(uint32_t etc.) instead, but i think that is not important as
signedness.
i want to assure myself that no one objects changing the following
things to unsigned before i create a patch (which should be straight
forward, but of course i will need to change quite many lines and also
check that all functions will stay correct...). please speak up now or
forever hold your peace etc... :)
spi_programmer:
int max_data_read;
int max_data_write;
(start + len parameters of:)
int (*read)(struct flashchip *flash, uint8_t *buf, int start, int len);
int (*write_256)(struct flashchip *flash, uint8_t *buf, int start, int len);
(the return values just indicate success and failure with 0 and 1)
struct flashchip:
int total_size;
(should also be converted to bytes instead of kB... i know this is on the todo already)
int page_size;
(start + len parameters of:)
int (*write) (struct flashchip *flash, uint8_t *buf, int start, int len);
int (*read) (struct flashchip *flash, uint8_t *buf, int start, int len);
(again, the return value just indicates success, not bytes written)
};
--
Kind regards/Mit freundlichen Grüßen, Stefan Tauner