Commit 1b8a71a0 authored by Adam Wujek's avatar Adam Wujek 💬

userspace/libwr: use pr_* functions instead of printf

Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 2866c22b
......@@ -5,6 +5,7 @@
#include <string.h>
#include <errno.h>
#include <stdarg.h>
#include <libwr/wrs-msg.h>
#include <libwr/config.h>
/* All strings here are strdup'd and then split; you can't free(3) them */
......@@ -173,7 +174,7 @@ int libwr_cfg_read_verify_file(char *dotconfig, char *kconfig)
if (!strcmp(c->name, kc->name))
break;
if (!kc) {
fprintf(stderr, "Configuration \"%s\" not found\n",
pr_error("Configuration \"%s\" not found\n",
c->name);
errors++;
}
......
......@@ -3,6 +3,7 @@
#include <stddef.h>
#include <fpga_io.h>
#include <regs/hwiu-regs.h>
#include <libwr/wrs-msg.h>
#include <libwr/hwiu.h>
#define hwiu_write(reg, val) \
......@@ -43,8 +44,9 @@ int shw_hwiu_gwver(struct gw_info *info)
s_data = (struct gw_info *)data;
*info = *s_data;
if (info->nwords != HWIU_INFO_WORDS) {
printf("nwords: sw=%u, hw=%u, ver=%u, data=%x\n", info->nwords,
HWIU_INFO_WORDS, info->struct_ver, data[0]);
pr_error("nwords: sw=%u, hw=%u, ver=%u, data=%x\n",
info->nwords, HWIU_INFO_WORDS, info->struct_ver,
data[0]);
return -1;
}
//now read info words
......
......@@ -5,6 +5,7 @@
#include <stdlib.h>
#include <string.h>
#include <libwr/util.h> //for shw_udelay();
#include <libwr/wrs-msg.h>
#include "i2c_fpga_reg.h"
......@@ -18,11 +19,11 @@ int i2c_fpga_reg_init_bus(struct i2c_bus *bus)
i2c_fpga_reg_t *priv;
if (!bus->type_specific) {
printf("no type specific structure provided\n");
pr_error("no type specific structure provided\n");
return -1;
}
if (bus->type != I2C_BUS_TYPE_FPGA_REG) {
printf("type doesn't match I2C_BUS_TYPE_FPGA_REG(%d): %d\n",
pr_error("type doesn't match I2C_BUS_TYPE_FPGA_REG(%d): %d\n",
I2C_BUS_TYPE_FPGA_REG, bus->type);
return -1;
}
......@@ -40,7 +41,7 @@ int i2c_fpga_reg_init_bus(struct i2c_bus *bus)
_fpga_writel(priv->base_address + FPGA_I2C_REG_CTR, CTR_EN);
if (!(_fpga_readl(priv->base_address + FPGA_I2C_REG_CTR) & CTR_EN)) {
printf("failed to read from control register\n");
pr_error("failed to read from control register\n");
return -1;
}
......
......@@ -86,10 +86,10 @@ int shw_i2c_io_scan(uint8_t * dev_map)
return -1;
detect = i2c_scan(&i2c_io_bus, dev_map);
printf("\ni2c_bus: %s: %d devices\n", i2c_io_bus.name, detect);
pr_debug("\ni2c_bus: %s: %d devices\n", i2c_io_bus.name, detect);
for (i = 0; i < 128; i++)
if (dev_map[i / 8] & (1 << (i % 8)))
printf("device at: 0x%02X\n", i);
pr_debug("device at: 0x%02X\n", i);
return detect;
}
......
......@@ -215,10 +215,10 @@ int shw_sfp_bus_scan(int num, uint8_t * dev_map)
return -1;
detect = i2c_scan(&i2c_buses[num], dev_map);
printf("\ni2c_bus: %s: %d devices\n", i2c_buses[num].name, detect);
pr_debug("\ni2c_bus: %s: %d devices\n", i2c_buses[num].name, detect);
for (i = 0; i < 128; i++)
if (dev_map[i / 8] & (1 << (i % 8)))
printf("device at: 0x%02X\n", i);
pr_debug("device at: 0x%02X\n", i);
return detect;
}
......@@ -548,12 +548,12 @@ static struct shw_sfp_caldata *shw_sfp_cal_list = NULL;
/* local helper */
static void __err_msg(int index, char *pname, char *pvalue)
{
fprintf(stderr, "Config item \"SFP%02i_PARAMS\": parameter \"%s\" ",
index, pname);
if (pvalue)
fprintf(stderr, "is wrong (\"%s\")\n", pvalue);
pr_error("Config item \"SFP%02i_PARAMS\": parameter \"%s\" "
"is wrong (\"%s\")\n", index, pname, pvalue);
else
fprintf(stderr, "is not specified\n");
pr_error("Config item \"SFP%02i_PARAMS\": parameter \"%s\" "
"is not specified\n", index, pname);
}
int shw_sfp_read_db(void)
......@@ -653,7 +653,6 @@ struct shw_sfp_caldata *shw_sfp_get_cal_data(int num,
t = shw_sfp_cal_list;
/* In the first pass, look for serial number */
while (t) {
// printf("search1 %s %s\n", t->part_num, t->vendor_serial);
if (t->vendor_name[0] == 0
&& strncmp(pn, t->part_num, 16) == 0
&& t->vendor_serial[0] == 0)
......
......@@ -27,6 +27,7 @@
#include <libwr/hal_shmem.h>
#include <libwr/hal_client.h>
#include <libwr/util.h>
#include <libwr/wrs-msg.h>
#include <net/ethernet.h>
#ifdef NETIF_VERBOSE
......@@ -487,8 +488,8 @@ int ptpd_netif_adjust_counters(int64_t adjust_sec, int32_t adjust_nsec)
return 0;
if (adjust_sec && adjust_nsec) {
fprintf(stderr,
" FATAL : trying to adjust both the SEC and the NS counters simultaneously. \n");
pr_error(" FATAL : trying to adjust both the SEC and the NS "
"counters simultaneously.\n");
exit(-1);
}
......
......@@ -43,16 +43,16 @@ int rts_get_state(struct rts_pll_state *state)
return ret;
#ifdef VERBOSE
printf("RTS State Dump: \n");
printf("CurrentRef: %d Mode: %d Flags: %x\n",
pr_debug("RTS State Dump:\n");
pr_debug("CurrentRef: %d Mode: %d Flags: %x\n",
state->current_ref, state->mode, state->flags);
for (i = 0; i < RTS_PLL_CHANNELS; i++)
printf("Ch%d: setpoint: %dps current: %dps "
"loopback: %dps flags: %x\n", i,
state->channels[i].phase_setpoint,
state->channels[i].phase_current,
state->channels[i].phase_loopback,
state->channels[i].flags);
pr_debug("Ch%d: setpoint: %dps current: %dps "
"loopback: %dps flags: %x\n", i,
state->channels[i].phase_setpoint,
state->channels[i].phase_current,
state->channels[i].phase_loopback,
state->channels[i].flags);
#endif
return 0;
......
......@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <sys/time.h>
#include <libwr/wrs-msg.h>
#include <libwr/util.h>
static int loops_per_msec = -1;
......@@ -26,7 +27,7 @@ void shw_udelay_init(void)
loops_per_msec = i * 1000 / min;
if (0)
printf("loops per msec %i\n", loops_per_msec);
pr_debug("loops per msec %i\n", loops_per_msec);
/*
* I get 39400 more or less; it makes sense at 197 bogomips.
* The loop is 6 instructions with 3 (cached) memory accesses
......
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