Commit 25ec6c06 authored by Alessandro Rubini's avatar Alessandro Rubini

kernel and doc: prefer &fmc->dev to fmc->hwdev in messages

For multi-mezzanine environments, the hwdev name (the carrier)
is not very meaningful, so use fmc->dev for messages as soon as the
device is registered.

Change suggested by David Cobas.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent b7036bfd
......@@ -348,7 +348,7 @@ registration:
@item @t{fpga_base}: the I/O memory address (may be NULL).
@item @t{slot_id}: the index of this slot (starting from zero).
@item @t{memlen}: if @t{fpga_base} is valid, the length of I/O memory.
@item @t{hwdev}: to be used in @i{dev_err()} calls.
@item @t{hwdev}: to be used in some @i{dev_err()} calls.
@item @t{device_id}: a slot-specific unique integer number.
@end itemize
......@@ -1073,21 +1073,14 @@ Pretty often, the mezzanine drivers need to register a new device of
some kind: a network card, an input device, or something else.
Several mezzanines may be installed in the same host computer, and we
need a way to tell which is which: using sequential numbering is not
reliable. The problem for diagnostics is already solved by the
@i{hwdev} field in the device structure: mezzanine drivers use
@code{dev_err(fmc->hwdev)} so the message includes proper identifiers
(e.g. the bus and slot numbers for PCI cards).
reliable.
When we moved the @i{fine-delay} driver from being a @sc{spec}-only driver
to a mezzanine @i{fmc-bus} driver, we found we needed an identifier to
register our top-level device (here, a @sc{zio} driver). The right
solution to this problems is for carrier drivers to already spell out
an identifier in the @code{fmc_device} structure, so mezzanine drivers
can use it. This requires a version change.
@b{Note:} this change is not currently active, we are waiting to find
other issues and cluster all required changes in a single version
bump.
can use it. This required a version change.
Drivers designed to work with an older versions of @i{fmc-bus} can
just be recompiled: they won't exploit the new feature but they will
......
......@@ -150,7 +150,7 @@ static int fc_probe(struct fmc_device *fmc)
list_add(&fc->list, &fc_devices);
}
spin_unlock(&fc_lock);
dev_info(fc->fmc->hwdev, "Created misc device \"%s\"\n",
dev_info(&fc->fmc->dev, "Created misc device \"%s\"\n",
fc->misc.name);
return ret;
}
......@@ -163,7 +163,7 @@ static int fc_remove(struct fmc_device *fmc)
if (fc->fmc == fmc)
break;
if (fc->fmc != fmc) {
dev_err(fmc->hwdev, "remove called but not found\n");
dev_err(&fmc->dev, "remove called but not found\n");
return -ENODEV;
}
......
......@@ -149,7 +149,8 @@ int fmc_device_register_n(struct fmc_device **devs, int n)
for (i = 0; i < n; i++) {
fmc = devarray[i];
if (!fmc->hwdev) {
pr_err("%s: device has no hwdev pointer\n", __func__);
pr_err("%s: device nr. %i has no hwdev pointer\n",
__func__, i);
return -EINVAL;
}
if (fmc->flags == FMC_DEVICE_NO_MEZZANINE) {
......@@ -158,17 +159,20 @@ int fmc_device_register_n(struct fmc_device **devs, int n)
continue;
}
if (!fmc->eeprom) {
dev_err(fmc->hwdev, "no eeprom provided to fmc bus\n");
dev_err(fmc->hwdev, "no eeprom provided for slot %i\n",
fmc->slot_id);
ret = -EINVAL;
}
if (!fmc->eeprom_addr) {
dev_err(fmc->hwdev, "eeprom_addr must be set\n");
dev_err(fmc->hwdev, "no eeprom_addr for slot %i\n",
fmc->slot_id);
ret = -EINVAL;
}
if (!fmc->carrier_name || !fmc->carrier_data || \
!fmc->device_id) {
dev_err(fmc->hwdev,
"carrier name, data or dev_id not set\n");
"deivce nr %i: carrier name, "
"data or dev_id not set\n", i);
ret = -EINVAL;
}
if (ret)
......@@ -208,13 +212,13 @@ int fmc_device_register_n(struct fmc_device **devs, int n)
device_id);
ret = device_add(&fmc->dev);
if (ret < 0) {
dev_err(fmc->hwdev, "Failed in registering \"%s\"\n",
fmc->dev.kobj.name);
dev_err(fmc->hwdev, "Slot %i: Failed in registering "
"\"%s\"\n", fmc->slot_id, fmc->dev.kobj.name);
goto out;
}
ret = sysfs_create_bin_file(&fmc->dev.kobj, &fmc_eeprom_attr);
if (ret < 0) {
dev_err(fmc->hwdev, "Failed in registering eeprom\n");
dev_err(&fmc->dev, "Failed in registering eeprom\n");
goto out1;
}
/* This device went well, give information to the user */
......
......@@ -49,8 +49,8 @@ void fmc_dump_eeprom(const struct fmc_device *fmc)
if (!fmc_must_dump_eeprom)
return;
pr_info("FMC: mezzanine %i: %s on %s\n", fmc->slot_id,
dev_name(fmc->hwdev), fmc->carrier_name);
pr_info("FMC: %s (%s), slot %i, device %s\n", dev_name(fmc->hwdev),
fmc->carrier_name, fmc->slot_id, dev_name(&fmc->dev));
pr_info("FMC: dumping eeprom 0x%x (%i) bytes\n", fmc->eeprom_len,
fmc->eeprom_len);
......@@ -87,8 +87,8 @@ void fmc_dump_sdb(const struct fmc_device *fmc)
*
* So, lazily, just dump the top-level array
*/
pr_info("FMC: mezzanine %i: %s on %s\n", fmc->slot_id,
dev_name(fmc->hwdev), fmc->carrier_name);
pr_info("FMC: %s (%s), slot %i, device %s\n", dev_name(fmc->hwdev),
fmc->carrier_name, fmc->slot_id, dev_name(&fmc->dev));
pr_info("FMC: poor dump of sdb first level:\n");
len = fmc->sdb->len * sizeof(union sdb_record);
......
......@@ -101,7 +101,7 @@ static int ff_reprogram(struct fmc_device *fmc, struct fmc_driver *drv,
}
dev_info(&fmc->dev, "reprogramming with %s\n", gw);
ret = request_firmware(&fw, gw, fmc->hwdev);
ret = request_firmware(&fw, gw, &fmc->dev);
if (ret < 0) {
dev_warn(&fmc->dev, "request firmware \"%s\": error %i\n",
gw, ret);
......
......@@ -140,7 +140,7 @@ int fmc_reprogram(struct fmc_device *fmc, struct fmc_driver *d, char *gw,
/* We are required to find SDB at a given offset */
ret = fmc_scan_sdb_tree(fmc, sdb_entry);
if (ret < 0) {
dev_err(fmc->hwdev, "Can't find SDB at address 0x%x\n",
dev_err(&fmc->dev, "Can't find SDB at address 0x%x\n",
sdb_entry);
return -ENODEV;
}
......@@ -166,7 +166,7 @@ static void __fmc_show_sdb_tree(const struct fmc_device *fmc,
base = 0;
for (ap = arr; ap; ap = ap->parent)
base += ap->baseaddr;
dev_info(fmc->hwdev, "SDB: ");
dev_info(&fmc->dev, "SDB: ");
for (j = 0; j < level; j++)
printk(" ");
......
......@@ -19,7 +19,7 @@ irqreturn_t t_handler(int irq, void *dev_id)
struct fmc_device *fmc = dev_id;
fmc->op->irq_ack(fmc);
dev_info(fmc->hwdev, "received irq %i\n", irq);
dev_info(&fmc->dev, "received irq %i\n", irq);
return IRQ_HANDLED;
}
......
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