use dev_* logging calls overall

This is far more informative about what specific mezzanine
originates an error, e.g., low-level traces like

gpio_writel_with_retry: succeded after 66 retries
gpio_writel_with_retry: succeded after 65 retries
gpio_writel_with_retry: succeded after 97 retries
...

coming from nameless devices require identification of the originator.
parent 289428fe
......@@ -64,6 +64,7 @@ static uint64_t output_delay_ps(struct fd_dev *fd, int ch, int fine, int n,
uint64_t *results;
uint64_t res, acc = 0;
int rem;
struct device *dev = &fd->fmc->dev;
results = kmalloc(n * sizeof(*results), GFP_KERNEL);
if (!results)
......@@ -106,9 +107,9 @@ static uint64_t output_delay_ps(struct fd_dev *fd, int ch, int fine, int n,
res = fr * fd->bin;
if (fd->verbose > 3)
pr_info("%s: ch %i, fine %i, bin %x got %08x, "
"res 0x%016llx\n", __func__, ch, fine,
fd->bin, fr, res);
dev_info(dev, "%s: ch %i, fine %i, bin %x got %08x, "
"res 0x%016llx\n", __func__, ch, fine,
fd->bin, fr, res);
results[i] = res;
acc += res;
}
......@@ -125,9 +126,9 @@ static uint64_t output_delay_ps(struct fd_dev *fd, int ch, int fine, int n,
if (results[i] < stats->min) stats->min = results[i];
}
if (fd->verbose > 2)
pr_info("%s: ch %i, taps %i, count %i, result %llx "
"(max-min %llx)\n", __func__, ch, fine, n,
stats->avg, stats->max - stats->min);
dev_info(dev, "%s: ch %i, taps %i, count %i, result %llx "
"(max-min %llx)\n", __func__, ch, fine, n,
stats->avg, stats->max - stats->min);
}
kfree(results);
......@@ -145,6 +146,7 @@ static int fd_find_8ns_tap(struct fd_dev *fd, int ch)
int l = 0, mid, r = FD_NUM_TAPS - 1;
uint64_t bias, dly;
struct delay_stats stats;
struct device *dev = &fd->fmc->dev;
/*
* Measure the delay at zero setting, so it can be further
......@@ -156,7 +158,7 @@ static int fd_find_8ns_tap(struct fd_dev *fd, int ch)
mid = ( l + r) / 2;
dly = output_delay_ps(fd, ch, mid, FD_CAL_STEPS, &stats) - bias;
if (fd->verbose > 1) {
printk("%s: ch%i @ %-5i: ", __func__, ch, mid);
dev_info(dev, "%s: ch%i @ %-5i: ", __func__, ch, mid);
__pr_fixed("bias ", bias, ", ");
__pr_fixed("min ", stats.min - bias, ", ");
__pr_fixed("avg ", stats.avg - bias, ", ");
......@@ -194,10 +196,11 @@ int fd_calibrate_outputs(struct fd_dev *fd)
fd_ch_writel(fd, ch, new, FD_REG_FRR);
fd->ch[ch].frr_cur = new;
if (1) {
pr_info("%s: ch%i: 8ns @%i (f %i, off %i, t %i.%02i)\n",
__func__, FD_CH_EXT(ch),
new, fitted, fd->ch[ch].frr_offset,
fd->temp / 16, (fd->temp & 0xf) * 100 / 16);
dev_info(&fd->fmc->dev,
"%s: ch%i: 8ns @%i (f %i, off %i, t %i.%02i)\n",
__func__, FD_CH_EXT(ch),
new, fitted, fd->ch[ch].frr_offset,
fd->temp / 16, (fd->temp & 0xf) * 100 / 16);
}
}
return 0;
......@@ -217,10 +220,11 @@ void fd_update_calibration(unsigned long arg)
fd_ch_writel(fd, ch, new, FD_REG_FRR);
fd->ch[ch].frr_cur = new;
if (0) {
pr_info("%s: ch%i: 8ns @%i (f %i, off %i, t %i.%02i)\n",
__func__, FD_CH_EXT(ch),
new, fitted, fd->ch[ch].frr_offset,
fd->temp / 16, (fd->temp & 0xf) * 100 / 16);
dev_info(&fd->fmc->dev,
"%s: ch%i: 8ns @%i (f %i, off %i, t %i.%02i)\n",
__func__, FD_CH_EXT(ch),
new, fitted, fd->ch[ch].frr_offset,
fd->temp / 16, (fd->temp & 0xf) * 100 / 16);
}
}
......
......@@ -111,7 +111,7 @@ static int fd_read_calibration_eeprom(struct fmc_device *fmc,
int fd_handle_eeprom_calibration(struct fd_dev *fd)
{
struct fd_calibration *calib;
struct device *d = fd->fmc->hwdev;
struct device *d = &fd->fmc->dev;
int i;
u32 hash, horig;
......
......@@ -91,7 +91,8 @@ int fd_reset_again(struct fd_dev *fd)
msleep(10);
}
if (time_after_eq(jiffies, j)) {
pr_err("%s: timeout waiting for GCR lock bit\n", __func__);
dev_err(&fd->fmc->dev,
"%s: timeout waiting for GCR lock bit\n", __func__);
return -EIO;
}
......@@ -126,7 +127,7 @@ int fd_probe(struct fmc_device *fmc)
{
struct fd_modlist *m;
struct fd_dev *fd;
struct device *dev = fmc->hwdev;
struct device *dev = &fmc->dev;
char *fwname;
int i, index, ret;
......@@ -228,12 +229,12 @@ int fd_probe(struct fmc_device *fmc)
/* init all subsystems */
for (i = 0, m = mods; i < ARRAY_SIZE(mods); i++, m++) {
pr_debug("%s: Calling init for \"%s\"\n", __func__,
m->name);
dev_dbg(dev, "%s: Calling init for \"%s\"\n", __func__,
m->name);
ret = m->init(fd);
if (ret < 0) {
pr_err("%s: error initializing %s\n", __func__,
m->name);
dev_err(dev, "%s: error initializing %s\n", __func__,
m->name);
goto err;
}
}
......
......@@ -290,8 +290,9 @@ int fd_irq_init(struct fd_dev *fd)
/* Check that the sw fifo size is a power of two */
if (fd_sw_fifo_len & (fd_sw_fifo_len - 1)) {
pr_err("%s: fifo len must be a power of 2 (not %d = 0x%x)\n",
KBUILD_MODNAME, fd_sw_fifo_len, fd_sw_fifo_len);
dev_err(&fd->fmc->dev,
"fifo len must be a power of 2 (not %d = 0x%x)\n",
fd_sw_fifo_len, fd_sw_fifo_len);
return -EINVAL;
}
......@@ -309,7 +310,7 @@ int fd_irq_init(struct fd_dev *fd)
tasklet_init(&fd->tlet, fd_tlet, (unsigned long)fd);
if (fd_timer_period_ms) {
dev_info(fd->fmc->hwdev,"Using a timer for input (%i ms)\n",
dev_info(&fd->fmc->dev,"Using a timer for input (%i ms)\n",
jiffies_to_msecs(fd_timer_period_jiffies));
mod_timer(&fd->fifo_timer, jiffies + fd_timer_period_jiffies);
} else {
......
......@@ -556,7 +556,8 @@ static int fd_zio_output(struct zio_cset *cset)
ctrl = zio_get_ctrl(cset->chan->active_block);
if (fd->verbose > 1) {
pr_info("%s: attrs for cset %i: ", __func__, cset->index);
dev_info(&fd->fmc->dev,
"%s: attrs for cset %i: ", __func__, cset->index);
for (i = FD_ATTR_DEV__LAST; i < FD_ATTR_OUT__LAST; i++)
printk("%08x%c", ctrl->attr_channel.ext_val[i],
i == FD_ATTR_OUT__LAST -1 ? '\n' : ' ');
......
......@@ -47,7 +47,8 @@ static int gpio_writel_with_retry(struct fd_dev *fd, int val, int reg)
if(rv >= 0 && (rv == val))
{
if(SPI_RETRIES-1-retries > 0)
pr_info("%s: succeded after %d retries\n",
dev_info(&fd->fmc->dev,
"%s: succeded after %d retries\n",
__func__, SPI_RETRIES - 1 - retries);
return 0;
}
......@@ -86,6 +87,7 @@ void fd_gpio_set_clr(struct fd_dev *fd, int mask, int set)
int fd_gpio_init(struct fd_dev *fd)
{
int i, val;
struct device *dev = &fd->fmc->dev;
fd->mcp_iodir = 0xffff;
fd->mcp_olat = 0;
......@@ -101,16 +103,16 @@ int fd_gpio_init(struct fd_dev *fd)
if (i < 0)
goto out;
if (i != val) {
pr_err("%s: Error in GPIO communication\n",
dev_err(dev, "%s: Error in GPIO communication\n",
KBUILD_MODNAME);
pr_err(" (got 0x%x, expected 0x%x)\n", i, val);
dev_err(dev, " (got 0x%x, expected 0x%x)\n", i, val);
return -EIO;
}
}
/* last time we wrote 0, ok */
return 0;
out:
pr_err("%s: Error in SPI communication\n", KBUILD_MODNAME);
dev_err(dev, "%s: Error in SPI communication\n", KBUILD_MODNAME);
return -EIO;
}
......
......@@ -118,8 +118,9 @@ void mi2c_scan(struct fd_dev *fd)
for(i = 0; i < 256; i += 2) {
mi2c_start(fd);
if(!mi2c_put_byte(fd, i))
pr_info("%s: Found i2c device at 0x%x\n",
KBUILD_MODNAME, i >> 1);
dev_info(&fd->fmc->dev,
"%s: Found i2c device at 0x%x\n",
KBUILD_MODNAME, i >> 1);
mi2c_stop(fd);
}
}
......
......@@ -141,8 +141,7 @@ static int ow_read_block(struct fd_dev *fd, int port, uint8_t *block, int len)
static int ds18x_read_serial(struct fd_dev *fd)
{
if(!ow_reset(fd, 0)) {
pr_err("%s: Failure in resetting one-wire channel\n",
KBUILD_MODNAME);
dev_err(&fd->fmc->dev, "Failure in resetting one-wire channel\n");
return -EIO;
}
......@@ -165,7 +164,7 @@ static int ds18x_access(struct fd_dev *fd)
return ow_write_byte(fd, FD_OW_PORT, CMD_ROM_SKIP);
}
out:
pr_err("%s: Failure in one-wire communication\n", KBUILD_MODNAME);
dev_err(&fd->fmc->dev, "Failure in one-wire communication\n");
return -EIO;
}
......@@ -185,6 +184,7 @@ int fd_read_temp(struct fd_dev *fd, int verbose)
int i, temp;
unsigned long j;
uint8_t data[9];
struct device *dev = &fd->fmc->dev;
/* If first conversion, ask for it first */
if (fd->next_t == 0)
......@@ -204,7 +204,7 @@ int fd_read_temp(struct fd_dev *fd, int verbose)
ow_read_block(fd, FD_OW_PORT, data, 9);
if (verbose > 1) {
pr_info("%s: Scratchpad: ", __func__);
dev_info(dev, "%s: Scratchpad: ", __func__);
for (i = 0; i < 9; i++)
printk("%02x%c", data[i], i == 8 ? '\n' : ':');
}
......@@ -213,7 +213,7 @@ int fd_read_temp(struct fd_dev *fd, int verbose)
temp = -0x10000 + temp;
fd->temp = temp;
if (verbose) {
pr_info("%s: Temperature 0x%x (%i bits: %i.%03i)\n", __func__,
dev_info(dev, "%s: Temperature 0x%x (%i bits: %i.%03i)\n", __func__,
temp, 9 + (data[4] >> 5),
temp / 16, (temp & 0xf) * 1000 / 16);
}
......@@ -234,7 +234,7 @@ int fd_onewire_init(struct fd_dev *fd)
return -EIO;
if (fd->verbose) {
pr_info("%s: Found DS18xx sensor: ", __func__);
dev_info(&fd->fmc->dev, "%s: Found DS18xx sensor: ", __func__);
for (i = 0; i < 8; i++)
printk("%02x%c", fd->ds18_id[i], i == 7 ? '\n' : ':');
}
......
......@@ -39,6 +39,7 @@ int fd_pll_init(struct fd_dev *fd)
int i;
unsigned long j;
const struct ad9516_reg *r;
struct device *dev = &fd->fmc->dev;
if (pll_writel(fd, 0x99, 0x000) < 0)
goto out;
......@@ -48,16 +49,15 @@ int fd_pll_init(struct fd_dev *fd)
if (i < 0)
goto out;
if (i != 0xc3) {
pr_err("%s: Error in PLL communication\n", KBUILD_MODNAME);
pr_err(" (got 0x%x, expected 0xc3)\n", i);
dev_err(dev, "Error in PLL communication\n");
dev_err(dev, " (got 0x%x, expected 0xc3)\n", i);
return -EIO;
}
/* Write the magic config */
for (i = 0, r = __9516_regs; i < ARRAY_SIZE(__9516_regs); i++, r++) {
if (pll_writel(fd, r->val, r->reg) < 0) {
pr_err("%s: Error in configuring PLL (step %i)\n",
KBUILD_MODNAME, i);
dev_err(dev, "Error in configuring PLL (step %i)\n", i);
return -EIO;
}
}
......@@ -95,7 +95,7 @@ int fd_pll_init(struct fd_dev *fd)
return 0;
out:
pr_err("%s: Error in SPI communication\n", KBUILD_MODNAME);
dev_err(dev, "Error in SPI communication\n");
return -EIO;
}
......
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