Skip to contentSkip to conversation

Fpga: fix incorrect test of CFG_FPGA_XILINX macro

PATCH New Grant Likely 2 participants 2 messages Sep 25, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fpga: fix incorrect test of CFG_FPGA_XILINX macro

From: Grant Likely <[email protected]>

CFG_FPGA_XILINX is a bit value used to test against the value in CONFIG_FPGA. Testing for a value will always return TRUE. I don't think that is the intention in this code.

---

Wolfgang, this is a bug-fix only. It might be a good idea to go into 1.3.0, but all I've done is compile tested it. I don't have any hardware which is affected by this.

Cheers,
g.

 common/cmd_fpga.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_fpga.c +1 -1
index 000406e..377a692 100644
@@ -58,6 +58,7 @@ static int fpga_get_op (char *opstr);
 /* Convert bitstream data and load into the fpga */
 int fpga_loadbitstream(unsigned long dev, char* fpgadata, size_t size)
 {
+#if (CONFIG_FPGA & CFG_FPGA_XILINX)
 	unsigned int length;
 	unsigned char* swapdata;
 	unsigned int swapsize;
@@ -70,7 +71,6 @@ int fpga_loadbitstream(unsigned long dev, char* fpgadata, size_t size)
 
 	dataptr = (unsigned char *)fpgadata;
 
-#if CFG_FPGA_XILINX
 	/* skip the first bytes of the bitsteam, their meaning is unknown */
 	length = (*dataptr << 8) + *(dataptr+1);
 	dataptr+=2;
#1 lore raw

PATCH 1/1 Fpga: fix incorrect test of CFG_FPGA_XILINX macro

Dear Grant,

Quoted 11 lines · in message <[email protected]> you…

CFG_FPGA_XILINX is a bit value used to test against the value in CONFIG_FPGA. Testing for a value will always return TRUE. I don't think that is the intention in this code.

---

Wolfgang, this is a bug-fix only. It might be a good idea to go into 1.3.0, but all I've done is compile tested it. I don't have any hardware which is affected by this.

I agree, it's an obvious fix. I will pull it into 1.3.0 ASAP.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Women professionals do tend to over-compensate.
	-- Dr. Elizabeth Dehaver, "Where No Man Has Gone Before",
	   stardate 1312.9.