[flashrom] RFC: magic constants in ft2232_spi.c

Antony Pavlov antonynpavlov at gmail.com
Thu Jan 15 08:25:03 CET 2015


On Wed, 14 Jan 2015 22:57:31 +0100
Stefan Tauner <stefan.tauner at alumni.tuwien.ac.at> wrote:

> 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?

Ok, I'll make a patch.
 
-- 
Best regards,
  Antony Pavlov




More information about the flashrom mailing list