DriverDev-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Christian Gromm <christian.gromm@microchip.com>
To: <gregkh@linuxfoundation.org>
Cc: Christian Gromm <christian.gromm@microchip.com>,
	driverdev-devel@linuxdriverproject.org
Subject: [PATCH RFC v3 2/9] staging: most: core: use dev_* function for logging
Date: Tue, 14 Jan 2020 16:57:51 +0100
Message-ID: <1579017478-3339-3-git-send-email-christian.gromm@microchip.com> (raw)
In-Reply-To: <1579017478-3339-1-git-send-email-christian.gromm@microchip.com>

This patch replaces all calls to pr_* functions and uses
the dev_* functions instead.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
---
v3:
	This patch has been added to the series.

 drivers/staging/most/core.c | 61 ++++++++++++++++++++++-----------------------
 1 file changed, 30 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 8c8a647..9839b8c 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -5,7 +5,6 @@
  * 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>
@@ -151,7 +150,7 @@ static void flush_channel_fifos(struct most_channel *c)
 	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");
 }
 
 /**
@@ -623,7 +622,7 @@ int most_set_cfg_datatype(char *mdev, char *mdev_ch, char *buf)
 	}
 
 	if (i == ARRAY_SIZE(ch_data_type))
-		pr_info("WARN: invalid attribute settings\n");
+		dev_warn(&mc.dev, "invalid attribute settings\n");
 	return 0;
 }
 
@@ -642,7 +641,7 @@ int most_set_cfg_direction(char *mdev, char *mdev_ch, char *buf)
 	} 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;
@@ -795,7 +794,7 @@ static int hdm_enqueue_thread(void *data)
 		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;
@@ -942,7 +941,7 @@ static void most_write_completion(struct mbo *mbo)
 
 	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
@@ -1101,14 +1100,14 @@ int most_start_channel(struct most_interface *iface, int id,
 		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;
 	}
@@ -1162,7 +1161,7 @@ int most_stop_channel(struct most_interface *iface, int id,
 	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];
@@ -1182,8 +1181,8 @@ int most_stop_channel(struct most_interface *iface, int 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;
 	}
@@ -1192,7 +1191,7 @@ int most_stop_channel(struct most_interface *iface, int id,
 
 #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;
 	}
@@ -1218,11 +1217,11 @@ EXPORT_SYMBOL_GPL(most_stop_channel);
 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);
@@ -1252,25 +1251,25 @@ static int disconnect_channels(struct device *dev, void *data)
 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));
 }
 
 /**
@@ -1288,13 +1287,13 @@ int most_register_interface(struct most_interface *iface)
 
 	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;
 	}
 
@@ -1313,7 +1312,7 @@ int most_register_interface(struct most_interface *iface)
 	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;
@@ -1356,12 +1355,12 @@ int most_register_interface(struct most_interface *iface)
 		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;
 
@@ -1393,8 +1392,8 @@ void most_deregister_interface(struct most_interface *iface)
 	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)
@@ -1464,14 +1463,14 @@ EXPORT_SYMBOL_GPL(most_resume_enqueue);
 
 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);
 
@@ -1483,12 +1482,12 @@ static int __init most_init(void)
 
 	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";
@@ -1509,7 +1508,7 @@ static int __init most_init(void)
 
 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);
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  parent reply index

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14 15:57 [PATCH RFC v3 0/9] staging: most: move core module out of staging Christian Gromm
2020-01-14 15:57 ` [PATCH RFC v3 1/9] staging: most: core: fix date in file comment Christian Gromm
2020-01-14 15:57 ` Christian Gromm [this message]
2020-01-14 15:57 ` [PATCH RFC v3 3/9] staging: most: core: remove noisy log messages Christian Gromm
2020-01-14 15:57 ` [PATCH RFC v3 4/9] staging: most: move interface dev to private section Christian Gromm
2020-01-15 12:17   ` Greg KH
2020-01-15 16:04     ` Christian.Gromm
2020-01-14 15:57 ` [PATCH RFC v3 5/9] staging: most: usb: check for NULL device Christian Gromm
2020-01-15 12:18   ` Greg KH
2020-01-15 15:32     ` Christian.Gromm
2020-01-15 15:37       ` Greg KH
2020-01-14 15:57 ` [PATCH RFC v3 6/9] staging: most: change storage class of struct mostcore Christian Gromm
2020-01-15 12:19   ` Greg KH
2020-01-14 15:57 ` [PATCH RFC v3 7/9] staging: most: move core files out of the staging area Christian Gromm
2020-01-14 15:57 ` [PATCH RFC v3 8/9] staging: most: Documentation: update ABI description Christian Gromm
2020-01-14 15:57 ` [PATCH RFC v3 9/9] staging: most: Documentation: move ABI description files out of staging area Christian Gromm
2020-01-15 12:20 ` [PATCH RFC v3 0/9] staging: most: move core module out of staging Greg KH

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1579017478-3339-3-git-send-email-christian.gromm@microchip.com \
    --to=christian.gromm@microchip.com \
    --cc=driverdev-devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DriverDev-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/driverdev-devel/0 driverdev-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 driverdev-devel driverdev-devel/ https://lore.kernel.org/driverdev-devel \
		driverdev-devel@linuxdriverproject.org devel@driverdev.osuosl.org
	public-inbox-index driverdev-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.linuxdriverproject.driverdev-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git