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
OBJDUMP = $(CROSS_COMPILE)objdump
CFLAGS = -Wall -I. -O2 -ggdb \
-Wstrict-prototypes \
-DLIBWR_INTERNAL \
-I./include \
-I../include \
......
......@@ -198,7 +198,7 @@ static float tmp100_read_temp(int dev_addr)
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) {
pr_error(
......
......@@ -95,7 +95,7 @@ int shw_i2c_io_scan(uint8_t * dev_map)
return detect;
}
int shw_get_hw_ver()
int shw_get_hw_ver(void)
{
uint8_t ret;
struct i2c_bus *bus = &i2c_io_bus;
......@@ -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;
......
......@@ -22,7 +22,7 @@ extern struct i2c_bus i2c_io_bus;
int shw_i2c_io_init(void);
int shw_i2c_io_scan(uint8_t * dev_map);
int shw_get_hw_ver();
uint8_t shw_get_fpga_type();
int shw_get_hw_ver(void);
uint8_t shw_get_fpga_type(void);
#endif //I2C_IO_H
......@@ -51,11 +51,11 @@ void shw_pio_configure(const pio_pin_t * pin);
void shw_pio_configure_pins(const pio_pin_t * pins);
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);
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_configure(const pio_pin_t * pin);
......
......@@ -10,13 +10,13 @@
#define PPSG_ADJUST_NSEC 0x2
/* 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 */
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 */
int shw_pps_gen_busy();
int shw_pps_gen_busy(void);
/* Enables/disables PPS Generator PPS output */
int shw_pps_gen_enable_output(int enable);
......
......@@ -77,7 +77,7 @@ struct wr_tstamp {
// - opens devices
// - does necessary ioctls()
// - 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
// 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 {
extern const shw_io_t _all_shw_io[];
//Functions
int shw_io_init();
int shw_io_configure_all();
int shw_io_init(void);
int shw_io_configure_all(void);
const shw_io_t *get_shw_io(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);
......
......@@ -8,6 +8,6 @@
void shw_udelay_init(void);
void shw_udelay(uint32_t microseconds);
uint64_t shw_get_tics();
uint64_t shw_get_tics(void);
#endif /* __LIBWR_HW_UTIL_H */
......@@ -35,7 +35,7 @@ int shw_init()
return 0;
}
int shw_exit_fatal()
int shw_exit_fatal(void)
{
pr_error("exiting due to fatal error.\n");
exit(-1);
......
......@@ -48,7 +48,7 @@ struct etherpacket {
char data[ETH_DATA_LEN];
};
static uint64_t get_tics()
static uint64_t get_tics(void)
{
struct timezone tz = { 0, 0 };
struct timeval tv;
......
......@@ -26,6 +26,7 @@ OBJDUMP = $(CROSS_COMPILE)objdump
# LOTs of includes
CFLAGS = -O2 -g -Wall \
-Wstrict-prototypes \
-I$(LINUX)/include \
-I$(LINUX)/arch/arm/mach-at91/include \
-I../wrsw_rtud \
......
......@@ -80,7 +80,7 @@ int read_servo(void){
}
void ppsi_connect_minipc()
void ppsi_connect_minipc(void)
{
if (ptp_ch) {
/* close minipc, if connected before */
......@@ -421,7 +421,7 @@ void show_temperatures(void)
int track_onoff = 1;
void show_all()
void show_all(void)
{
int hal_alive;
int ppsi_alive;
......
......@@ -211,7 +211,7 @@ static struct {
int hits;
} bslides[MAX_BITSLIDES];
int bslide_bins()
int bslide_bins(void)
{
int i, hits = 0;
......@@ -241,7 +241,7 @@ void sighandler(int sig)
quit = 1;
}
static void print_cal_stats()
static void print_cal_stats(void)
{
int i,last_occupied = -1;
printf("Calibration statistics: \n");
......
......@@ -67,10 +67,10 @@ static struct s_port_vlans vlans[NPORTS];
static unsigned long portmask;
static int print_help();
static int print_help(char *prgname);
static void print_config(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,
int del, int flags);
static void free_rtu_vlans(struct rtu_vlans_t *ptr);
......@@ -503,7 +503,7 @@ static void list_ep_vlans(void)
return;
}
static int clear_all()
static int clear_all(void)
{
uint32_t r;
int val, i;
......
......@@ -17,6 +17,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
CFLAGS = -O -g -Wall \
-Wstrict-prototypes \
-I../include \
-I../libwr/include \
-I../mini-rpc \
......
......@@ -17,6 +17,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
CFLAGS = -O -g -Wall \
-Wstrict-prototypes \
-I../include \
-I../libwr/include \
-I../mini-rpc \
......
......@@ -142,9 +142,9 @@ int halexp_pps_cmd(int cmd, hexp_pps_params_t * params)
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);
}
......
......@@ -43,7 +43,7 @@ int hal_add_cleanup_callback(hal_cleanup_callback_t cb)
}
/* Calls all cleanup callbacks */
static void call_cleanup_cbs()
static void call_cleanup_cbs(void)
{
int i;
......@@ -65,16 +65,16 @@ static void sighandler(int sig)
exit(0);
}
static int hal_shutdown()
static int hal_shutdown(void)
{
call_cleanup_cbs();
return 0;
}
static void hal_daemonize();
static void hal_daemonize(void);
/* Main initialization function */
static int hal_init()
static int hal_init(void)
{
//trace_log_stderr();
......@@ -113,7 +113,7 @@ static int hal_init()
}
/* 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;
......@@ -152,7 +152,7 @@ static void hal_daemonize()
freopen("/dev/null", "r", stdin);
}
static void show_help()
static void show_help(void)
{
printf("WR Switch Hardware Abstraction Layer daemon (wrsw_hal)\n\
Usage: wrsw_hal [options], where [options] can be:\n\
......
......@@ -51,7 +51,7 @@ static int hal_port_nports;
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)
return -1;
......@@ -286,7 +286,7 @@ int hal_port_pshifter_busy()
/* Updates the current value of the phase shift on a given
* 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;
......@@ -530,7 +530,7 @@ static void hal_port_remove_sfp(struct hal_port_state * p)
}
/* 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)) {
uint32_t mask = shw_sfp_module_scan();
......
......@@ -11,7 +11,7 @@ typedef struct {
uint64_t timeout;
} timeout_t;
static inline uint64_t tm_get_tics()
static inline uint64_t tm_get_tics(void)
{
struct timezone tz = { 0, 0 };
struct timeval tv;
......
......@@ -3,7 +3,7 @@
#include <inttypes.h>
typedef void (*hal_cleanup_callback_t)();
typedef void (*hal_cleanup_callback_t)(void);
int hal_check_running(void);
......
......@@ -18,6 +18,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
CFLAGS = -O2 -Wall -ggdb \
-Wstrict-prototypes \
-I../mini-rpc \
-I../include \
-I../libwr/include \
......
......@@ -96,12 +96,12 @@ static inline struct rtu_filtering_entry *rtu_fe_clean(
/**
* \brief Returns number of seconds since the epoch.
*/
static inline unsigned long now()
static inline unsigned long now(void)
{
return (unsigned long)time(NULL);
}
int rtud_init_exports();
void rtud_handle_wripc();
int rtud_init_exports(void);
void rtud_handle_wripc(void);
#endif /*__WHITERABBIT_RTU_H*/
......@@ -301,7 +301,7 @@ int rtu_mfifo_is_empty(void)
return RTU_MFIFO_CSR_EMPTY & csr;
}
static void flush_mfifo()
static void flush_mfifo(void)
{
uint32_t gcr = rtu_rd(GCR);
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],
void rtux_set_port_mirror(uint32_t mirror_src_mask, uint32_t mirror_dst_mask,
int rx, int tx);
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,
int mac_range, int mac_br, int at_fm);
void rtux_set_fw_to_CPU(int hp, int unrec);
......
......@@ -88,7 +88,7 @@ int read_ports(void){
* @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 slow_proto_mac[] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x01 };
......@@ -149,7 +149,7 @@ static int rtu_create_static_entries()
return 0;
}
static void rtu_update_ports_state()
static void rtu_update_ports_state(void)
{
int i;
int link_up;
......@@ -209,7 +209,7 @@ static void *rtu_daemon_wripc_process(void *arg)
* \brief Handles the learning process.
* @return error code
*/
static int rtu_daemon_learning_process()
static int rtu_daemon_learning_process(void)
{
int err, i, port_down;
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)
/**
* \brief RTU shutdown.
*/
static void rtu_daemon_destroy()
static void rtu_daemon_destroy(void)
{
// Threads stuff
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