Commit 367b743d authored by Alessandro Rubini's avatar Alessandro Rubini

userspace: general cleanup of missing prototypes

And force the compiler to complain. It used to be on by default, bah....
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 0d894a74
...@@ -20,6 +20,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy ...@@ -20,6 +20,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump OBJDUMP = $(CROSS_COMPILE)objdump
CFLAGS = -Wall -I. -O2 -ggdb \ CFLAGS = -Wall -I. -O2 -ggdb \
-Wstrict-prototypes \
-DLIBWR_INTERNAL \ -DLIBWR_INTERNAL \
-I./include \ -I./include \
-I../include \ -I../include \
......
...@@ -198,7 +198,7 @@ static float tmp100_read_temp(int dev_addr) ...@@ -198,7 +198,7 @@ static float tmp100_read_temp(int dev_addr)
return ((float)(temp >> 4)) / 16.0; return ((float)(temp >> 4)) / 16.0;
} }
static int shw_init_i2c_sensors() static int shw_init_i2c_sensors(void)
{ {
if (i2c_init_bus(&fpga_sensors_i2c) < 0) { if (i2c_init_bus(&fpga_sensors_i2c) < 0) {
pr_error( pr_error(
......
...@@ -95,7 +95,7 @@ int shw_i2c_io_scan(uint8_t * dev_map) ...@@ -95,7 +95,7 @@ int shw_i2c_io_scan(uint8_t * dev_map)
return detect; return detect;
} }
int shw_get_hw_ver() int shw_get_hw_ver(void)
{ {
uint8_t ret; uint8_t ret;
struct i2c_bus *bus = &i2c_io_bus; struct i2c_bus *bus = &i2c_io_bus;
...@@ -125,7 +125,7 @@ int shw_get_hw_ver() ...@@ -125,7 +125,7 @@ int shw_get_hw_ver()
} }
} }
uint8_t shw_get_fpga_type() uint8_t shw_get_fpga_type(void)
{ {
struct i2c_bus *bus = &i2c_io_bus; struct i2c_bus *bus = &i2c_io_bus;
......
...@@ -22,7 +22,7 @@ extern struct i2c_bus i2c_io_bus; ...@@ -22,7 +22,7 @@ extern struct i2c_bus i2c_io_bus;
int shw_i2c_io_init(void); int shw_i2c_io_init(void);
int shw_i2c_io_scan(uint8_t * dev_map); int shw_i2c_io_scan(uint8_t * dev_map);
int shw_get_hw_ver(); int shw_get_hw_ver(void);
uint8_t shw_get_fpga_type(); uint8_t shw_get_fpga_type(void);
#endif //I2C_IO_H #endif //I2C_IO_H
...@@ -51,11 +51,11 @@ void shw_pio_configure(const pio_pin_t * pin); ...@@ -51,11 +51,11 @@ void shw_pio_configure(const pio_pin_t * pin);
void shw_pio_configure_pins(const pio_pin_t * pins); void shw_pio_configure_pins(const pio_pin_t * pins);
int shw_clock_out_enable(int pck_num, int prescaler, int source); int shw_clock_out_enable(int pck_num, int prescaler, int source);
volatile uint8_t *shw_pio_get_sys_base(); volatile uint8_t *shw_pio_get_sys_base(void);
volatile uint8_t *shw_pio_get_port_base(int port); volatile uint8_t *shw_pio_get_port_base(int port);
void shw_set_fp_led(int led, int state); void shw_set_fp_led(int led, int state);
int shw_pio_mmap_init(); int shw_pio_mmap_init(void);
void shw_pio_toggle_pin(pio_pin_t * pin, uint32_t udelay); void shw_pio_toggle_pin(pio_pin_t * pin, uint32_t udelay);
void shw_pio_configure(const pio_pin_t * pin); void shw_pio_configure(const pio_pin_t * pin);
......
...@@ -10,13 +10,13 @@ ...@@ -10,13 +10,13 @@
#define PPSG_ADJUST_NSEC 0x2 #define PPSG_ADJUST_NSEC 0x2
/* Initializes the PPS Generator. 0 on success, negative on failure. */ /* Initializes the PPS Generator. 0 on success, negative on failure. */
int shw_pps_gen_init(); int shw_pps_gen_init(void);
/* Adjusts the <counter> (PPSG_ADJUST_SEC/NSEC) by (how_much) seconds/nanoseconds */ /* Adjusts the <counter> (PPSG_ADJUST_SEC/NSEC) by (how_much) seconds/nanoseconds */
int shw_pps_gen_adjust(int counter, int64_t how_much); int shw_pps_gen_adjust(int counter, int64_t how_much);
/* Returns 1 when the PPS is busy adjusting its time counters, 0 if PPS gen idle */ /* Returns 1 when the PPS is busy adjusting its time counters, 0 if PPS gen idle */
int shw_pps_gen_busy(); int shw_pps_gen_busy(void);
/* Enables/disables PPS Generator PPS output */ /* Enables/disables PPS Generator PPS output */
int shw_pps_gen_enable_output(int enable); int shw_pps_gen_enable_output(int enable);
......
...@@ -77,7 +77,7 @@ struct wr_tstamp { ...@@ -77,7 +77,7 @@ struct wr_tstamp {
// - opens devices // - opens devices
// - does necessary ioctls() // - does necessary ioctls()
// - initializes connection with the mighty HAL daemon // - initializes connection with the mighty HAL daemon
int ptpd_netif_init(); int ptpd_netif_init(void);
// Creates UDP or Ethernet RAW socket (determined by sock_type) bound to bind_addr. If PTPD_FLAG_MULTICAST is set, the socket is // Creates UDP or Ethernet RAW socket (determined by sock_type) bound to bind_addr. If PTPD_FLAG_MULTICAST is set, the socket is
// automatically added to multicast group. User can specify physical_port field to bind the socket to specific switch port only. // automatically added to multicast group. User can specify physical_port field to bind the socket to specific switch port only.
......
...@@ -90,8 +90,8 @@ typedef struct { ...@@ -90,8 +90,8 @@ typedef struct {
extern const shw_io_t _all_shw_io[]; extern const shw_io_t _all_shw_io[];
//Functions //Functions
int shw_io_init(); int shw_io_init(void);
int shw_io_configure_all(); int shw_io_configure_all(void);
const shw_io_t *get_shw_io(shw_io_id_t id); const shw_io_t *get_shw_io(shw_io_id_t id);
const pio_pin_t *get_pio_pin(shw_io_id_t id); const pio_pin_t *get_pio_pin(shw_io_id_t id);
uint32_t shw_io_read(shw_io_id_t id); uint32_t shw_io_read(shw_io_id_t id);
......
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
void shw_udelay_init(void); void shw_udelay_init(void);
void shw_udelay(uint32_t microseconds); void shw_udelay(uint32_t microseconds);
uint64_t shw_get_tics(); uint64_t shw_get_tics(void);
#endif /* __LIBWR_HW_UTIL_H */ #endif /* __LIBWR_HW_UTIL_H */
...@@ -35,7 +35,7 @@ int shw_init() ...@@ -35,7 +35,7 @@ int shw_init()
return 0; return 0;
} }
int shw_exit_fatal() int shw_exit_fatal(void)
{ {
pr_error("exiting due to fatal error.\n"); pr_error("exiting due to fatal error.\n");
exit(-1); exit(-1);
......
...@@ -48,7 +48,7 @@ struct etherpacket { ...@@ -48,7 +48,7 @@ struct etherpacket {
char data[ETH_DATA_LEN]; char data[ETH_DATA_LEN];
}; };
static uint64_t get_tics() static uint64_t get_tics(void)
{ {
struct timezone tz = { 0, 0 }; struct timezone tz = { 0, 0 };
struct timeval tv; struct timeval tv;
......
...@@ -26,6 +26,7 @@ OBJDUMP = $(CROSS_COMPILE)objdump ...@@ -26,6 +26,7 @@ OBJDUMP = $(CROSS_COMPILE)objdump
# LOTs of includes # LOTs of includes
CFLAGS = -O2 -g -Wall \ CFLAGS = -O2 -g -Wall \
-Wstrict-prototypes \
-I$(LINUX)/include \ -I$(LINUX)/include \
-I$(LINUX)/arch/arm/mach-at91/include \ -I$(LINUX)/arch/arm/mach-at91/include \
-I../wrsw_rtud \ -I../wrsw_rtud \
......
...@@ -80,7 +80,7 @@ int read_servo(void){ ...@@ -80,7 +80,7 @@ int read_servo(void){
} }
void ppsi_connect_minipc() void ppsi_connect_minipc(void)
{ {
if (ptp_ch) { if (ptp_ch) {
/* close minipc, if connected before */ /* close minipc, if connected before */
...@@ -421,7 +421,7 @@ void show_temperatures(void) ...@@ -421,7 +421,7 @@ void show_temperatures(void)
int track_onoff = 1; int track_onoff = 1;
void show_all() void show_all(void)
{ {
int hal_alive; int hal_alive;
int ppsi_alive; int ppsi_alive;
......
...@@ -211,7 +211,7 @@ static struct { ...@@ -211,7 +211,7 @@ static struct {
int hits; int hits;
} bslides[MAX_BITSLIDES]; } bslides[MAX_BITSLIDES];
int bslide_bins() int bslide_bins(void)
{ {
int i, hits = 0; int i, hits = 0;
...@@ -241,7 +241,7 @@ void sighandler(int sig) ...@@ -241,7 +241,7 @@ void sighandler(int sig)
quit = 1; quit = 1;
} }
static void print_cal_stats() static void print_cal_stats(void)
{ {
int i,last_occupied = -1; int i,last_occupied = -1;
printf("Calibration statistics: \n"); printf("Calibration statistics: \n");
......
...@@ -67,10 +67,10 @@ static struct s_port_vlans vlans[NPORTS]; ...@@ -67,10 +67,10 @@ static struct s_port_vlans vlans[NPORTS];
static unsigned long portmask; static unsigned long portmask;
static int print_help(); static int print_help(char *prgname);
static void print_config(struct s_port_vlans *vlans); static void print_config(struct s_port_vlans *vlans);
static int apply_settings(struct s_port_vlans *vlans); static int apply_settings(struct s_port_vlans *vlans);
static int clear_all(); static int clear_all(void);
static int set_rtu_vlan(int vid, int fid, int pmask, int drop, int prio, static int set_rtu_vlan(int vid, int fid, int pmask, int drop, int prio,
int del, int flags); int del, int flags);
static void free_rtu_vlans(struct rtu_vlans_t *ptr); static void free_rtu_vlans(struct rtu_vlans_t *ptr);
...@@ -503,7 +503,7 @@ static void list_ep_vlans(void) ...@@ -503,7 +503,7 @@ static void list_ep_vlans(void)
return; return;
} }
static int clear_all() static int clear_all(void)
{ {
uint32_t r; uint32_t r;
int val, i; int val, i;
......
...@@ -17,6 +17,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy ...@@ -17,6 +17,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump OBJDUMP = $(CROSS_COMPILE)objdump
CFLAGS = -O -g -Wall \ CFLAGS = -O -g -Wall \
-Wstrict-prototypes \
-I../include \ -I../include \
-I../libwr/include \ -I../libwr/include \
-I../mini-rpc \ -I../mini-rpc \
......
...@@ -17,6 +17,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy ...@@ -17,6 +17,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump OBJDUMP = $(CROSS_COMPILE)objdump
CFLAGS = -O -g -Wall \ CFLAGS = -O -g -Wall \
-Wstrict-prototypes \
-I../include \ -I../include \
-I../libwr/include \ -I../libwr/include \
-I../mini-rpc \ -I../mini-rpc \
......
...@@ -142,9 +142,9 @@ int halexp_pps_cmd(int cmd, hexp_pps_params_t * params) ...@@ -142,9 +142,9 @@ int halexp_pps_cmd(int cmd, hexp_pps_params_t * params)
return -1; /* fixme: real error code */ return -1; /* fixme: real error code */
} }
extern int hal_port_any_locked(); extern int hal_port_any_locked(void);
static void hal_cleanup_wripc() static void hal_cleanup_wripc(void)
{ {
minipc_close(hal_ch); minipc_close(hal_ch);
} }
......
...@@ -43,7 +43,7 @@ int hal_add_cleanup_callback(hal_cleanup_callback_t cb) ...@@ -43,7 +43,7 @@ int hal_add_cleanup_callback(hal_cleanup_callback_t cb)
} }
/* Calls all cleanup callbacks */ /* Calls all cleanup callbacks */
static void call_cleanup_cbs() static void call_cleanup_cbs(void)
{ {
int i; int i;
...@@ -65,16 +65,16 @@ static void sighandler(int sig) ...@@ -65,16 +65,16 @@ static void sighandler(int sig)
exit(0); exit(0);
} }
static int hal_shutdown() static int hal_shutdown(void)
{ {
call_cleanup_cbs(); call_cleanup_cbs();
return 0; return 0;
} }
static void hal_daemonize(); static void hal_daemonize(void);
/* Main initialization function */ /* Main initialization function */
static int hal_init() static int hal_init(void)
{ {
//trace_log_stderr(); //trace_log_stderr();
...@@ -113,7 +113,7 @@ static int hal_init() ...@@ -113,7 +113,7 @@ static int hal_init()
} }
/* Turns a nice and well-behaving HAL into an evil servant of satan. */ /* Turns a nice and well-behaving HAL into an evil servant of satan. */
static void hal_daemonize() static void hal_daemonize(void)
{ {
pid_t pid, sid; pid_t pid, sid;
...@@ -152,7 +152,7 @@ static void hal_daemonize() ...@@ -152,7 +152,7 @@ static void hal_daemonize()
freopen("/dev/null", "r", stdin); freopen("/dev/null", "r", stdin);
} }
static void show_help() static void show_help(void)
{ {
printf("WR Switch Hardware Abstraction Layer daemon (wrsw_hal)\n\ printf("WR Switch Hardware Abstraction Layer daemon (wrsw_hal)\n\
Usage: wrsw_hal [options], where [options] can be:\n\ Usage: wrsw_hal [options], where [options] can be:\n\
......
...@@ -51,7 +51,7 @@ static int hal_port_nports; ...@@ -51,7 +51,7 @@ static int hal_port_nports;
int hal_port_check_lock(const char *port_name); int hal_port_check_lock(const char *port_name);
int hal_port_any_locked() int hal_port_any_locked(void)
{ {
if (!hal_port_rts_state_valid) if (!hal_port_rts_state_valid)
return -1; return -1;
...@@ -286,7 +286,7 @@ int hal_port_pshifter_busy() ...@@ -286,7 +286,7 @@ int hal_port_pshifter_busy()
/* Updates the current value of the phase shift on a given /* Updates the current value of the phase shift on a given
* port. Called by the main update function regularly. */ * port. Called by the main update function regularly. */
static void poll_rts_state() static void poll_rts_state(void)
{ {
struct rts_pll_state *hs = &hal_port_rts_state; struct rts_pll_state *hs = &hal_port_rts_state;
...@@ -530,7 +530,7 @@ static void hal_port_remove_sfp(struct hal_port_state * p) ...@@ -530,7 +530,7 @@ static void hal_port_remove_sfp(struct hal_port_state * p)
} }
/* detects insertion/removal of SFP transceivers */ /* detects insertion/removal of SFP transceivers */
static void hal_port_poll_sfp() static void hal_port_poll_sfp(void)
{ {
if (tmo_expired(&hal_port_tmo_sfp)) { if (tmo_expired(&hal_port_tmo_sfp)) {
uint32_t mask = shw_sfp_module_scan(); uint32_t mask = shw_sfp_module_scan();
......
...@@ -11,7 +11,7 @@ typedef struct { ...@@ -11,7 +11,7 @@ typedef struct {
uint64_t timeout; uint64_t timeout;
} timeout_t; } timeout_t;
static inline uint64_t tm_get_tics() static inline uint64_t tm_get_tics(void)
{ {
struct timezone tz = { 0, 0 }; struct timezone tz = { 0, 0 };
struct timeval tv; struct timeval tv;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include <inttypes.h> #include <inttypes.h>
typedef void (*hal_cleanup_callback_t)(); typedef void (*hal_cleanup_callback_t)(void);
int hal_check_running(void); int hal_check_running(void);
......
...@@ -18,6 +18,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy ...@@ -18,6 +18,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump OBJDUMP = $(CROSS_COMPILE)objdump
CFLAGS = -O2 -Wall -ggdb \ CFLAGS = -O2 -Wall -ggdb \
-Wstrict-prototypes \
-I../mini-rpc \ -I../mini-rpc \
-I../include \ -I../include \
-I../libwr/include \ -I../libwr/include \
......
...@@ -96,12 +96,12 @@ static inline struct rtu_filtering_entry *rtu_fe_clean( ...@@ -96,12 +96,12 @@ static inline struct rtu_filtering_entry *rtu_fe_clean(
/** /**
* \brief Returns number of seconds since the epoch. * \brief Returns number of seconds since the epoch.
*/ */
static inline unsigned long now() static inline unsigned long now(void)
{ {
return (unsigned long)time(NULL); return (unsigned long)time(NULL);
} }
int rtud_init_exports(); int rtud_init_exports(void);
void rtud_handle_wripc(); void rtud_handle_wripc(void);
#endif /*__WHITERABBIT_RTU_H*/ #endif /*__WHITERABBIT_RTU_H*/
...@@ -301,7 +301,7 @@ int rtu_mfifo_is_empty(void) ...@@ -301,7 +301,7 @@ int rtu_mfifo_is_empty(void)
return RTU_MFIFO_CSR_EMPTY & csr; return RTU_MFIFO_CSR_EMPTY & csr;
} }
static void flush_mfifo() static void flush_mfifo(void)
{ {
uint32_t gcr = rtu_rd(GCR); uint32_t gcr = rtu_rd(GCR);
rtu_wr(GCR, gcr | RTU_GCR_MFIFOTRIG); rtu_wr(GCR, gcr | RTU_GCR_MFIFOTRIG);
......
...@@ -37,9 +37,9 @@ void rtux_add_ff_mac_range(int mac_id, int valid, uint8_t mac_lower[ETH_ALEN], ...@@ -37,9 +37,9 @@ void rtux_add_ff_mac_range(int mac_id, int valid, uint8_t mac_lower[ETH_ALEN],
void rtux_set_port_mirror(uint32_t mirror_src_mask, uint32_t mirror_dst_mask, void rtux_set_port_mirror(uint32_t mirror_src_mask, uint32_t mirror_dst_mask,
int rx, int tx); int rx, int tx);
void rtux_set_hp_prio_mask(uint8_t hp_prio_mask); void rtux_set_hp_prio_mask(uint8_t hp_prio_mask);
uint8_t rtux_get_hp_prio_mask(); uint8_t rtux_get_hp_prio_mask(void);
int rtux_get_cpu_port(); int rtux_get_cpu_port(void);
void rtux_set_feature_ctrl(int mr, int mac_ptp, int mac_ll, int mac_single, void rtux_set_feature_ctrl(int mr, int mac_ptp, int mac_ll, int mac_single,
int mac_range, int mac_br, int at_fm); int mac_range, int mac_br, int at_fm);
void rtux_set_fw_to_CPU(int hp, int unrec); void rtux_set_fw_to_CPU(int hp, int unrec);
......
...@@ -88,7 +88,7 @@ int read_ports(void){ ...@@ -88,7 +88,7 @@ int read_ports(void){
* @return error code * @return error code
*/ */
static int rtu_create_static_entries() static int rtu_create_static_entries(void)
{ {
uint8_t bcast_mac[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; uint8_t bcast_mac[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
uint8_t slow_proto_mac[] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x01 }; uint8_t slow_proto_mac[] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x01 };
...@@ -149,7 +149,7 @@ static int rtu_create_static_entries() ...@@ -149,7 +149,7 @@ static int rtu_create_static_entries()
return 0; return 0;
} }
static void rtu_update_ports_state() static void rtu_update_ports_state(void)
{ {
int i; int i;
int link_up; int link_up;
...@@ -209,7 +209,7 @@ static void *rtu_daemon_wripc_process(void *arg) ...@@ -209,7 +209,7 @@ static void *rtu_daemon_wripc_process(void *arg)
* \brief Handles the learning process. * \brief Handles the learning process.
* @return error code * @return error code
*/ */
static int rtu_daemon_learning_process() static int rtu_daemon_learning_process(void)
{ {
int err, i, port_down; int err, i, port_down;
struct rtu_request req; // Request read from learning queue struct rtu_request req; // Request read from learning queue
...@@ -322,7 +322,7 @@ static int rtu_daemon_init(uint16_t poly, unsigned long aging_time) ...@@ -322,7 +322,7 @@ static int rtu_daemon_init(uint16_t poly, unsigned long aging_time)
/** /**
* \brief RTU shutdown. * \brief RTU shutdown.
*/ */
static void rtu_daemon_destroy() static void rtu_daemon_destroy(void)
{ {
// Threads stuff // Threads stuff
pthread_cancel(wripc_process); pthread_cancel(wripc_process);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment