* Copyright (C) 2013-2020 Microchip Technology Germany II GmbH & Co. KG
*/
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/slab.h>
spin_unlock_irqrestore(&c->fifo_lock, hf_flags);
if (unlikely((!list_empty(&c->fifo) || !list_empty(&c->halt_fifo))))
- pr_info("WARN: fifo | trash fifo not empty\n");
+ dev_warn(&mc.dev, "fifo | trash fifo not empty\n");
}
/**
}
if (i == ARRAY_SIZE(ch_data_type))
- pr_info("WARN: invalid attribute settings\n");
+ dev_warn(&mc.dev, "invalid attribute settings\n");
return 0;
}
} else if (!strcmp(buf, "tx")) {
c->cfg.direction = MOST_CH_TX;
} else {
- pr_info("Invalid direction\n");
+ dev_err(&mc.dev, "Invalid direction\n");
return -ENODATA;
}
return 0;
mutex_unlock(&c->nq_mutex);
if (unlikely(ret)) {
- pr_err("hdm enqueue failed\n");
+ dev_err(&mc.dev, "hdm enqueue failed\n");
nq_hdm_mbo(mbo);
c->hdm_enqueue_task = NULL;
return 0;
c = mbo->context;
if (mbo->status == MBO_E_INVAL)
- pr_info("WARN: Tx MBO status: invalid\n");
+ dev_warn(&mc.dev, "Tx MBO status: invalid\n");
if (unlikely(c->is_poisoned || (mbo->status == MBO_E_CLOSE)))
trash_mbo(mbo);
else
goto out; /* already started by another component */
if (!try_module_get(iface->mod)) {
- pr_info("failed to acquire HDM lock\n");
+ dev_err(&mc.dev, "failed to acquire HDM lock\n");
mutex_unlock(&c->start_mutex);
return -ENOLCK;
}
c->cfg.extra_len = 0;
if (c->iface->configure(c->iface, c->channel_id, &c->cfg)) {
- pr_info("channel configuration failed. Go check settings...\n");
+ dev_err(&mc.dev, "channel configuration failed. Go check settings...\n");
ret = -EINVAL;
goto err_put_module;
}
struct most_channel *c;
if (unlikely((!iface) || (id >= iface->num_channels) || (id < 0))) {
- pr_err("Bad interface or index out of range\n");
+ dev_err(&mc.dev, "Bad interface or index out of range\n");
return -EINVAL;
}
c = iface->p->channel[id];
c->is_poisoned = true;
if (c->iface->poison_channel(c->iface, c->channel_id)) {
- pr_err("Cannot stop channel %d of mdev %s\n", c->channel_id,
- c->iface->description);
+ dev_err(&mc.dev, "Cannot stop channel %d of mdev %s\n", c->channel_id,
+ c->iface->description);
mutex_unlock(&c->start_mutex);
return -EAGAIN;
}
#ifdef CMPL_INTERRUPTIBLE
if (wait_for_completion_interruptible(&c->cleanup)) {
- pr_info("Interrupted while clean up ch %d\n", c->channel_id);
+ dev_err(&mc.dev, "Interrupted while clean up ch %d\n", c->channel_id);
mutex_unlock(&c->start_mutex);
return -EINTR;
}
int most_register_component(struct most_component *comp)
{
if (!comp) {
- pr_err("Bad component\n");
+ dev_err(&mc.dev, "Bad component\n");
return -EINVAL;
}
list_add_tail(&comp->list, &mc.comp_list);
- pr_info("registered new core component %s\n", comp->name);
+ dev_info(&mc.dev, "registered new core component %s\n", comp->name);
return 0;
}
EXPORT_SYMBOL_GPL(most_register_component);
int most_deregister_component(struct most_component *comp)
{
if (!comp) {
- pr_err("Bad component\n");
+ dev_err(&mc.dev, "Bad component\n");
return -EINVAL;
}
bus_for_each_dev(&mc.bus, NULL, comp, disconnect_channels);
list_del(&comp->list);
- pr_info("deregistering component %s\n", comp->name);
+ dev_info(&mc.dev, "deregistering component %s\n", comp->name);
return 0;
}
EXPORT_SYMBOL_GPL(most_deregister_component);
static void release_interface(struct device *dev)
{
- pr_info("releasing interface dev %s...\n", dev_name(dev));
+ dev_info(&mc.dev, "releasing interface dev %s...\n", dev_name(dev));
}
static void release_channel(struct device *dev)
{
- pr_info("releasing channel dev %s...\n", dev_name(dev));
+ dev_info(&mc.dev, "releasing channel dev %s...\n", dev_name(dev));
}
/**
if (!iface || !iface->enqueue || !iface->configure ||
!iface->poison_channel || (iface->num_channels > MAX_CHANNELS)) {
- pr_err("Bad interface or channel overflow\n");
+ dev_err(&mc.dev, "Bad interface or channel overflow\n");
return -EINVAL;
}
id = ida_simple_get(&mdev_id, 0, 0, GFP_KERNEL);
if (id < 0) {
- pr_info("Failed to alloc mdev ID\n");
+ dev_err(&mc.dev, "Failed to alloc mdev ID\n");
return id;
}
iface->dev.groups = interface_attr_groups;
iface->dev.release = release_interface;
if (device_register(&iface->dev)) {
- pr_err("registering iface->dev failed\n");
+ dev_err(&mc.dev, "registering iface->dev failed\n");
kfree(iface->p);
ida_simple_remove(&mdev_id, id);
return -ENOMEM;
mutex_init(&c->nq_mutex);
list_add_tail(&c->list, &iface->p->channel_list);
if (device_register(&c->dev)) {
- pr_err("registering c->dev failed\n");
+ dev_err(&mc.dev, "registering c->dev failed\n");
goto err_free_most_channel;
}
}
- pr_info("registered new device mdev%d (%s)\n",
- id, iface->description);
+ dev_info(&mc.dev, "registered new device mdev%d (%s)\n",
+ id, iface->description);
most_interface_register_notify(iface->description);
return 0;
int i;
struct most_channel *c;
- pr_info("deregistering device %s (%s)\n", dev_name(&iface->dev),
- iface->description);
+ dev_info(&mc.dev, "deregistering device %s (%s)\n", dev_name(&iface->dev),
+ iface->description);
for (i = 0; i < iface->num_channels; i++) {
c = iface->p->channel[i];
if (c->pipe0.comp)
static void release_most_sub(struct device *dev)
{
- pr_info("releasing most_subsystem\n");
+ dev_info(&mc.dev, "releasing most_subsystem\n");
}
static int __init most_init(void)
{
int err;
- pr_info("init()\n");
+ dev_info(&mc.dev, "init()\n");
INIT_LIST_HEAD(&mc.comp_list);
ida_init(&mdev_id);
err = bus_register(&mc.bus);
if (err) {
- pr_info("Cannot register most bus\n");
+ dev_err(&mc.dev, "Cannot register most bus\n");
return err;
}
err = driver_register(&mc.drv);
if (err) {
- pr_info("Cannot register core driver\n");
+ dev_err(&mc.dev, "Cannot register core driver\n");
goto err_unregister_bus;
}
mc.dev.init_name = "most_bus";
static void __exit most_exit(void)
{
- pr_info("exit core module\n");
+ dev_info(&mc.dev, "exit core module\n");
device_unregister(&mc.dev);
driver_unregister(&mc.drv);
bus_unregister(&mc.bus);