[flashrom] [commit] r1585 - trunk
repository service
svn at flashrom.org
Mon Aug 27 02:44:42 CEST 2012
Author: stefanct
Date: Mon Aug 27 02:44:42 2012
New Revision: 1585
URL: http://flashrom.org/trac/flashrom/changeset/1585
Log:
Some ISO C fixes.
This patch just fixes a limited number of bits not conforming to c99 by using
- __asm__ instead of just asm
- {0} instead of {} for struct initialization
- h_addr_list[0] instead of h_addr to access the host address in
struct hostent
- #include <strings.h> where needed (for ffs and strcasecmp)
Based on a previous patch by Carl-Daniel.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
Signed-off-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
Modified:
trunk/atahpt.c
trunk/board_enable.c
trunk/buspirate_spi.c
trunk/cbtable.c
trunk/chipset_enable.c
trunk/dmi.c
trunk/drkaiser.c
trunk/flashchips.c
trunk/flashrom.c
trunk/ft2232_spi.c
trunk/gfxnvidia.c
trunk/hwaccess.c
trunk/hwaccess.h
trunk/internal.c
trunk/it87spi.c
trunk/nic3com.c
trunk/nicintel.c
trunk/nicintel_spi.c
trunk/nicnatsemi.c
trunk/nicrealtek.c
trunk/ogp_spi.c
trunk/pony_spi.c
trunk/print.c
trunk/rayer_spi.c
trunk/satamv.c
trunk/satasii.c
trunk/serprog.c
trunk/udelay.c
Modified: trunk/atahpt.c
==============================================================================
--- trunk/atahpt.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/atahpt.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -38,7 +38,7 @@
{0x1103, 0x0005, NT, "Highpoint", "HPT372A/372N"},
{0x1103, 0x0006, NT, "Highpoint", "HPT302/302N"},
- {},
+ {0},
};
static void atahpt_chip_writeb(const struct flashctx *flash, uint8_t val,
Modified: trunk/board_enable.c
==============================================================================
--- trunk/board_enable.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/board_enable.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -24,6 +24,7 @@
* Contains the board specific flash enables.
*/
+#include <strings.h>
#include <string.h>
#include <stdlib.h>
#include "flash.h"
@@ -292,7 +293,7 @@
void probe_superio_winbond(void)
{
- struct superio s = {};
+ struct superio s = {0};
uint16_t winbond_ports[] = {WINBOND_SUPERIO_PORT1, WINBOND_SUPERIO_PORT2, 0};
uint16_t *i = winbond_ports;
uint8_t model;
Modified: trunk/buspirate_spi.c
==============================================================================
--- trunk/buspirate_spi.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/buspirate_spi.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -18,6 +18,7 @@
*/
#include <stdio.h>
+#include <strings.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
Modified: trunk/cbtable.c
==============================================================================
--- trunk/cbtable.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/cbtable.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -25,6 +25,7 @@
#include <unistd.h>
#include <stdio.h>
#include <ctype.h>
+#include <strings.h>
#include <string.h>
#include "flash.h"
#include "programmer.h"
Modified: trunk/chipset_enable.c
==============================================================================
--- trunk/chipset_enable.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/chipset_enable.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -1466,7 +1466,7 @@
{0x8086, 0x8c5e, NT, "Intel", "Lynx Point", enable_flash_pch8},
{0x8086, 0x8c5f, NT, "Intel", "Lynx Point", enable_flash_pch8},
#endif
- {},
+ {0},
};
int chipset_flash_enable(void)
Modified: trunk/dmi.c
==============================================================================
--- trunk/dmi.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/dmi.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <strings.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
Modified: trunk/drkaiser.c
==============================================================================
--- trunk/drkaiser.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/drkaiser.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -35,7 +35,8 @@
const struct pcidev_status drkaiser_pcidev[] = {
{0x1803, 0x5057, OK, "Dr. Kaiser", "PC-Waechter (Actel FPGA)"},
- {},
+
+ {0},
};
static uint8_t *drkaiser_bar;
@@ -61,7 +62,7 @@
/* Flash write is disabled automatically by PCI restore. */
pci_cleanup(pacc);
return 0;
-};
+}
int drkaiser_init(void)
{
Modified: trunk/flashchips.c
==============================================================================
--- trunk/flashchips.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/flashchips.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -9496,7 +9496,7 @@
.unlock = spi_disable_blockprotect, /* is this safe? */
.read = spi_chip_read,
/* FIXME: some vendor extensions define this */
- .voltage = {},
+ .voltage = {0},
/* Everything below will be set by the probing function. */
.write = NULL,
.total_size = 0,
Modified: trunk/flashrom.c
==============================================================================
--- trunk/flashrom.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/flashrom.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -263,7 +263,7 @@
},
#endif
- {}, /* This entry corresponds to PROGRAMMER_INVALID. */
+ {0}, /* This entry corresponds to PROGRAMMER_INVALID. */
};
#define SHUTDOWN_MAXFN 32
Modified: trunk/ft2232_spi.c
==============================================================================
--- trunk/ft2232_spi.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/ft2232_spi.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -21,6 +21,7 @@
#if CONFIG_FT2232_SPI == 1
#include <stdio.h>
+#include <strings.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
@@ -61,7 +62,8 @@
{OLIMEX_VID, OLIMEX_ARM_TINY_PID, OK, "Olimex", "ARM-USB-TINY"},
{OLIMEX_VID, OLIMEX_ARM_OCD_H_PID, NT, "Olimex", "ARM-USB-OCD-H"},
{OLIMEX_VID, OLIMEX_ARM_TINY_H_PID, NT, "Olimex", "ARM-USB-TINY-H"},
- {},
+
+ {0},
};
Modified: trunk/gfxnvidia.c
==============================================================================
--- trunk/gfxnvidia.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/gfxnvidia.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -59,7 +59,7 @@
{0x10de, 0x0202, NT, "NVIDIA", "GeForce 3 nFX Ultra" },
{0x10de, 0x0203, NT, "NVIDIA", "Quadro 3 DDC" },
- {},
+ {0},
};
static void gfxnvidia_chip_writeb(const struct flashctx *flash, uint8_t val,
Modified: trunk/hwaccess.c
==============================================================================
--- trunk/hwaccess.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/hwaccess.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -97,7 +97,7 @@
* Such reordering and/or merging would break device accesses which
* depend on the exact access order.
*/
- asm("eieio" : : : "memory");
+ ___asm___ volatile ("eieio" : : : "memory");
}
/* PCI port I/O is not yet implemented on PowerPC. */
Modified: trunk/hwaccess.h
==============================================================================
--- trunk/hwaccess.h Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/hwaccess.h Mon Aug 27 02:44:42 2012 (r1585)
@@ -174,7 +174,6 @@
/* for iopl and outb under Solaris */
#if defined (__sun) && (defined(__i386) || defined(__amd64))
-#include <strings.h>
#include <sys/sysi86.h>
#include <sys/psw.h>
#include <asm/sunddi.h>
@@ -263,37 +262,37 @@
static inline void outb(uint8_t value, uint16_t port)
{
- asm volatile ("outb %b0,%w1": :"a" (value), "Nd" (port));
+ __asm__ volatile ("outb %b0,%w1": :"a" (value), "Nd" (port));
}
static inline uint8_t inb(uint16_t port)
{
uint8_t value;
- asm volatile ("inb %w1,%0":"=a" (value):"Nd" (port));
+ __asm__ volatile ("inb %w1,%0":"=a" (value):"Nd" (port));
return value;
}
static inline void outw(uint16_t value, uint16_t port)
{
- asm volatile ("outw %w0,%w1": :"a" (value), "Nd" (port));
+ __asm__ volatile ("outw %w0,%w1": :"a" (value), "Nd" (port));
}
static inline uint16_t inw(uint16_t port)
{
uint16_t value;
- asm volatile ("inw %w1,%0":"=a" (value):"Nd" (port));
+ __asm__ volatile ("inw %w1,%0":"=a" (value):"Nd" (port));
return value;
}
static inline void outl(uint32_t value, uint16_t port)
{
- asm volatile ("outl %0,%w1": :"a" (value), "Nd" (port));
+ __asm__ volatile ("outl %0,%w1": :"a" (value), "Nd" (port));
}
static inline uint32_t inl(uint16_t port)
{
uint32_t value;
- asm volatile ("inl %1,%0":"=a" (value):"Nd" (port));
+ __asm__ volatile ("inl %1,%0":"=a" (value):"Nd" (port));
return value;
}
#endif
Modified: trunk/internal.c
==============================================================================
--- trunk/internal.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/internal.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <strings.h>
#include <string.h>
#include <stdlib.h>
#include "flash.h"
Modified: trunk/it87spi.c
==============================================================================
--- trunk/it87spi.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/it87spi.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -74,7 +74,7 @@
void probe_superio_ite(void)
{
- struct superio s = {};
+ struct superio s = {0};
uint16_t ite_ports[] = {ITE_SUPERIO_PORT1, ITE_SUPERIO_PORT2, 0};
uint16_t *i = ite_ports;
Modified: trunk/nic3com.c
==============================================================================
--- trunk/nic3com.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/nic3com.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -53,7 +53,7 @@
/* 3C980C */
{0x10b7, 0x9805, NT, "3COM", "3C980C: EtherLink Server 10/100 PCI (TX)" },
- {},
+ {0},
};
static void nic3com_chip_writeb(const struct flashctx *flash, uint8_t val,
Modified: trunk/nicintel.c
==============================================================================
--- trunk/nicintel.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/nicintel.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -31,7 +31,7 @@
{PCI_VENDOR_ID_INTEL, 0x1209, NT, "Intel", "8255xER/82551IT Fast Ethernet Controller"},
{PCI_VENDOR_ID_INTEL, 0x1229, OK, "Intel", "82557/8/9/0/1 Ethernet Pro 100"},
- {},
+ {0},
};
/* Arbitrary limit, taken from the datasheet I just had lying around.
Modified: trunk/nicintel_spi.c
==============================================================================
--- trunk/nicintel_spi.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/nicintel_spi.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -73,7 +73,7 @@
{PCI_VENDOR_ID_INTEL, 0x107c, OK, "Intel", "82541PI Gigabit Ethernet Controller"},
{PCI_VENDOR_ID_INTEL, 0x10b9, OK, "Intel", "82572EI Gigabit Ethernet Controller"},
- {},
+ {0},
};
static void nicintel_request_spibus(void)
Modified: trunk/nicnatsemi.c
==============================================================================
--- trunk/nicnatsemi.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/nicnatsemi.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -33,7 +33,8 @@
const struct pcidev_status nics_natsemi[] = {
{0x100b, 0x0020, NT, "National Semiconductor", "DP83815/DP83816"},
{0x100b, 0x0022, NT, "National Semiconductor", "DP83820"},
- {},
+
+ {0},
};
static void nicnatsemi_chip_writeb(const struct flashctx *flash, uint8_t val,
Modified: trunk/nicrealtek.c
==============================================================================
--- trunk/nicrealtek.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/nicrealtek.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -34,7 +34,8 @@
const struct pcidev_status nics_realtek[] = {
{0x10ec, 0x8139, OK, "Realtek", "RTL8139/8139C/8139C+"},
{0x1113, 0x1211, OK, "SMC2", "1211TX"}, /* RTL8139 clone */
- {},
+
+ {0},
};
static void nicrealtek_chip_writeb(const struct flashctx *flash, uint8_t val,
Modified: trunk/ogp_spi.c
==============================================================================
--- trunk/ogp_spi.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/ogp_spi.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -18,6 +18,7 @@
*/
#include <stdlib.h>
+#include <strings.h>
#include <string.h>
#include "flash.h"
#include "programmer.h"
@@ -48,7 +49,8 @@
const struct pcidev_status ogp_spi[] = {
{PCI_VENDOR_ID_OGP, 0x0000, OK, "Open Graphics Project", "Development Board OGD1"},
- {},
+
+ {0},
};
static void ogp_request_spibus(void)
Modified: trunk/pony_spi.c
==============================================================================
--- trunk/pony_spi.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/pony_spi.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -22,6 +22,7 @@
*/
#include <stdlib.h>
+#include <strings.h>
#include <string.h>
#include "flash.h"
Modified: trunk/print.c
==============================================================================
--- trunk/print.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/print.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -1033,7 +1033,7 @@
B("ZOTAC", "ZBOX HD-ID11", OK, NULL, NULL),
#endif
- {},
+ {0},
};
/* Please keep this list alphabetically ordered by vendor/board. */
@@ -1059,6 +1059,6 @@
B("Lenovo", "3000 V100 TF05Cxx", OK, "http://www5.pc.ibm.com/europe/products.nsf/products?openagent&brand=Lenovo3000Notebook&series=Lenovo+3000+V+Series#viewallmodelstop", NULL),
#endif
- {},
+ {0},
};
#endif
Modified: trunk/rayer_spi.c
==============================================================================
--- trunk/rayer_spi.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/rayer_spi.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -31,6 +31,7 @@
#if defined(__i386__) || defined(__x86_64__)
#include <stdlib.h>
+#include <strings.h>
#include <string.h>
#include "flash.h"
#include "programmer.h"
Modified: trunk/satamv.c
==============================================================================
--- trunk/satamv.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/satamv.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -33,7 +33,7 @@
/* 88SX6041 and 88SX6042 are the same according to the datasheet. */
{0x11ab, 0x7042, OK, "Marvell", "88SX7042 PCI-e 4-port SATA-II"},
- {},
+ {0},
};
#define NVRAM_PARAM 0x1045c
Modified: trunk/satasii.c
==============================================================================
--- trunk/satasii.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/satasii.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -38,7 +38,7 @@
{0x1095, 0x3132, OK, "Silicon Image", "SiI 3132 SATA Raid II Ctrl"},
{0x1095, 0x3512, OK, "Silicon Image", "SiI 3512 [SATALink/SATARaid] SATA Ctrl"},
- {},
+ {0},
};
static void satasii_chip_writeb(const struct flashctx *flash, uint8_t val, chipaddr addr);
Modified: trunk/serprog.c
==============================================================================
--- trunk/serprog.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/serprog.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <strings.h>
#include <string.h>
#include <ctype.h>
#include <fcntl.h>
@@ -125,7 +126,7 @@
}
sp.si.sin_family = AF_INET;
sp.si.sin_port = htons(port);
- (void)memcpy(&sp.si.sin_addr, hostPtr->h_addr, hostPtr->h_length);
+ (void)memcpy(&sp.si.sin_addr, hostPtr->h_addr_list[0], hostPtr->h_length);
if (connect(sock, &sp.s, sizeof(sp.si)) < 0) {
close(sock);
msg_perr("Error: serprog cannot connect: %s\n", strerror(errno));
Modified: trunk/udelay.c
==============================================================================
--- trunk/udelay.c Sun Aug 26 23:50:36 2012 (r1584)
+++ trunk/udelay.c Mon Aug 27 02:44:42 2012 (r1585)
@@ -35,7 +35,7 @@
unsigned long i;
for (i = 0; i < usecs * micro; i++) {
/* Make sure the compiler doesn't optimize the loop away. */
- asm volatile ("" : : "rm" (i) );
+ __asm__ volatile ("" : : "rm" (i) );
}
}
More information about the flashrom
mailing list