[flashrom] RFC: magic constants in ft2232_spi.c

Stefan Tauner stefan.tauner at alumni.tuwien.ac.at
Wed Jan 14 22:57:31 CET 2015


On Wed, 14 Jan 2015 10:06:42 +0400
Antony Pavlov <antonynpavlov at gmail.com> wrote:

> Hi All!
> 
> Please see this ft2232_spi.c fragment:
> 
> 363         msg_pdbg("Set clock divisor\n");
> 364         buf[0] = 0x86;          /* command "set divisor" */
> 365         buf[1] = (divisor / 2 - 1) & 0xff;
> 366         buf[2] = ((divisor / 2 - 1) >> 8) & 0xff;
> 367         if (send_buf(ftdic, buf, 3)) {
> 368                 ret = -6;
> 369                 goto ftdi_err;
> 370         }
> 
> Can we use ftdi.h constant here?
> E.g.:
> 
> 364         buf[0] = TCK_DIVISOR;

Hi,

yes, in general this is a good idea. I just wonder how long these
constants have been in existence... i.e. if such a patch would
introduce compile errors on some relevant platforms. I guess the risk
is rather low for that because even with libftdi 0.20 this is a problem
and we want to migrate to libftdi 1.xx someday anyway.
Do you want to create a patch?
-- 
Kind regards/Mit freundlichen Grüßen, Stefan Tauner




More information about the flashrom mailing list