Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f426a40e authored by Ira Weiny's avatar Ira Weiny Committed by Roland Dreier
Browse files

IB/umad: Update module to [pr|dev]_* style print messages



Use dev_* style print when struct device is available.

Also combine previously line broken user-visible strings as per
Documentation/CodingStyle:

"However, never break user-visible strings such as printk messages,
because that breaks the ability to grep for them."

Signed-off-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent 64aa90f2
Loading
Loading
Loading
Loading
+15 −11
Original line number Original line Diff line number Diff line
@@ -33,6 +33,8 @@
 * SOFTWARE.
 * SOFTWARE.
 */
 */


#define pr_fmt(fmt) "user_mad: " fmt

#include <linux/module.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/device.h>
@@ -673,10 +675,11 @@ found:
	if (!file->already_used) {
	if (!file->already_used) {
		file->already_used = 1;
		file->already_used = 1;
		if (!file->use_pkey_index) {
		if (!file->use_pkey_index) {
			printk(KERN_WARNING "user_mad: process %s did not enable "
			dev_warn(file->port->dev,
			       "P_Key index support.\n", current->comm);
				"process %s did not enable P_Key index support.\n",
			printk(KERN_WARNING "user_mad:   Documentation/infiniband/user_mad.txt "
				current->comm);
			       "has info on the new ABI.\n");
			dev_warn(file->port->dev,
				"   Documentation/infiniband/user_mad.txt has info on the new ABI.\n");
		}
		}
	}
	}


@@ -983,7 +986,7 @@ static CLASS_ATTR_STRING(abi_version, S_IRUGO,


static dev_t overflow_maj;
static dev_t overflow_maj;
static DECLARE_BITMAP(overflow_map, IB_UMAD_MAX_PORTS);
static DECLARE_BITMAP(overflow_map, IB_UMAD_MAX_PORTS);
static int find_overflow_devnum(void)
static int find_overflow_devnum(struct ib_device *device)
{
{
	int ret;
	int ret;


@@ -991,7 +994,8 @@ static int find_overflow_devnum(void)
		ret = alloc_chrdev_region(&overflow_maj, 0, IB_UMAD_MAX_PORTS * 2,
		ret = alloc_chrdev_region(&overflow_maj, 0, IB_UMAD_MAX_PORTS * 2,
					  "infiniband_mad");
					  "infiniband_mad");
		if (ret) {
		if (ret) {
			printk(KERN_ERR "user_mad: couldn't register dynamic device number\n");
			dev_err(&device->dev,
				"couldn't register dynamic device number\n");
			return ret;
			return ret;
		}
		}
	}
	}
@@ -1014,7 +1018,7 @@ static int ib_umad_init_port(struct ib_device *device, int port_num,
	devnum = find_first_zero_bit(dev_map, IB_UMAD_MAX_PORTS);
	devnum = find_first_zero_bit(dev_map, IB_UMAD_MAX_PORTS);
	if (devnum >= IB_UMAD_MAX_PORTS) {
	if (devnum >= IB_UMAD_MAX_PORTS) {
		spin_unlock(&port_lock);
		spin_unlock(&port_lock);
		devnum = find_overflow_devnum();
		devnum = find_overflow_devnum(device);
		if (devnum < 0)
		if (devnum < 0)
			return -1;
			return -1;


@@ -1200,14 +1204,14 @@ static int __init ib_umad_init(void)
	ret = register_chrdev_region(base_dev, IB_UMAD_MAX_PORTS * 2,
	ret = register_chrdev_region(base_dev, IB_UMAD_MAX_PORTS * 2,
				     "infiniband_mad");
				     "infiniband_mad");
	if (ret) {
	if (ret) {
		printk(KERN_ERR "user_mad: couldn't register device number\n");
		pr_err("couldn't register device number\n");
		goto out;
		goto out;
	}
	}


	umad_class = class_create(THIS_MODULE, "infiniband_mad");
	umad_class = class_create(THIS_MODULE, "infiniband_mad");
	if (IS_ERR(umad_class)) {
	if (IS_ERR(umad_class)) {
		ret = PTR_ERR(umad_class);
		ret = PTR_ERR(umad_class);
		printk(KERN_ERR "user_mad: couldn't create class infiniband_mad\n");
		pr_err("couldn't create class infiniband_mad\n");
		goto out_chrdev;
		goto out_chrdev;
	}
	}


@@ -1215,13 +1219,13 @@ static int __init ib_umad_init(void)


	ret = class_create_file(umad_class, &class_attr_abi_version.attr);
	ret = class_create_file(umad_class, &class_attr_abi_version.attr);
	if (ret) {
	if (ret) {
		printk(KERN_ERR "user_mad: couldn't create abi_version attribute\n");
		pr_err("couldn't create abi_version attribute\n");
		goto out_class;
		goto out_class;
	}
	}


	ret = ib_register_client(&umad_client);
	ret = ib_register_client(&umad_client);
	if (ret) {
	if (ret) {
		printk(KERN_ERR "user_mad: couldn't register ib_umad client\n");
		pr_err("couldn't register ib_umad client\n");
		goto out_class;
		goto out_class;
	}
	}