Commit 0093e5f8 authored by YAMANE Toshiaki's avatar YAMANE Toshiaki Committed by Greg Kroah-Hartman

staging/vme: Use dev_ or pr_ printks in devices/vme_user.c

fixed below checkpatch warnings.
- WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(...  to printk(KERN_ERR ...
- WARNING: Prefer netdev_info(netdev, ... then dev_info(dev, ... then pr_info(...  to printk(KERN_INFO ...
- WARNING: Prefer netdev_dbg(netdev, ... then dev_dbg(dev, ... then pr_debug(...  to printk(KERN_DEBUG ...
- WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...

and add pr_fmt.
Signed-off-by: default avatarYAMANE Toshiaki <yamanetoshi@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3d20e8e8
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
* option) any later version. * option) any later version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/cdev.h> #include <linux/cdev.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/device.h> #include <linux/device.h>
...@@ -170,7 +172,7 @@ static int vme_user_open(struct inode *inode, struct file *file) ...@@ -170,7 +172,7 @@ static int vme_user_open(struct inode *inode, struct file *file)
mutex_lock(&image[minor].mutex); mutex_lock(&image[minor].mutex);
/* Allow device to be opened if a resource is needed and allocated. */ /* Allow device to be opened if a resource is needed and allocated. */
if (minor < CONTROL_MINOR && image[minor].resource == NULL) { if (minor < CONTROL_MINOR && image[minor].resource == NULL) {
printk(KERN_ERR "No resources allocated for device\n"); pr_err("No resources allocated for device\n");
err = -EINVAL; err = -EINVAL;
goto err_res; goto err_res;
} }
...@@ -225,13 +227,13 @@ static ssize_t resource_to_user(int minor, char __user *buf, size_t count, ...@@ -225,13 +227,13 @@ static ssize_t resource_to_user(int minor, char __user *buf, size_t count,
(unsigned long)copied); (unsigned long)copied);
if (retval != 0) { if (retval != 0) {
copied = (copied - retval); copied = (copied - retval);
printk(KERN_INFO "User copy failed\n"); pr_info("User copy failed\n");
return -EINVAL; return -EINVAL;
} }
} else { } else {
/* XXX Need to write this */ /* XXX Need to write this */
printk(KERN_INFO "Currently don't support large transfers\n"); pr_info("Currently don't support large transfers\n");
/* Map in pages from userspace */ /* Map in pages from userspace */
/* Call vme_master_read to do the transfer */ /* Call vme_master_read to do the transfer */
...@@ -265,7 +267,7 @@ static ssize_t resource_from_user(unsigned int minor, const char __user *buf, ...@@ -265,7 +267,7 @@ static ssize_t resource_from_user(unsigned int minor, const char __user *buf,
image[minor].kern_buf, copied, *ppos); image[minor].kern_buf, copied, *ppos);
} else { } else {
/* XXX Need to write this */ /* XXX Need to write this */
printk(KERN_INFO "Currently don't support large transfers\n"); pr_info("Currently don't support large transfers\n");
/* Map in pages from userspace */ /* Map in pages from userspace */
/* Call vme_master_write to do the transfer */ /* Call vme_master_write to do the transfer */
...@@ -286,7 +288,7 @@ static ssize_t buffer_to_user(unsigned int minor, char __user *buf, ...@@ -286,7 +288,7 @@ static ssize_t buffer_to_user(unsigned int minor, char __user *buf,
retval = __copy_to_user(buf, image_ptr, (unsigned long)count); retval = __copy_to_user(buf, image_ptr, (unsigned long)count);
if (retval != 0) { if (retval != 0) {
retval = (count - retval); retval = (count - retval);
printk(KERN_WARNING "Partial copy to userspace\n"); pr_warn("Partial copy to userspace\n");
} else } else
retval = count; retval = count;
...@@ -305,7 +307,7 @@ static ssize_t buffer_from_user(unsigned int minor, const char __user *buf, ...@@ -305,7 +307,7 @@ static ssize_t buffer_from_user(unsigned int minor, const char __user *buf,
retval = __copy_from_user(image_ptr, buf, (unsigned long)count); retval = __copy_from_user(image_ptr, buf, (unsigned long)count);
if (retval != 0) { if (retval != 0) {
retval = (count - retval); retval = (count - retval);
printk(KERN_WARNING "Partial copy to userspace\n"); pr_warn("Partial copy to userspace\n");
} else } else
retval = count; retval = count;
...@@ -476,7 +478,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, ...@@ -476,7 +478,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
copied = copy_from_user(&irq_req, argp, copied = copy_from_user(&irq_req, argp,
sizeof(struct vme_irq_id)); sizeof(struct vme_irq_id));
if (copied != 0) { if (copied != 0) {
printk(KERN_WARNING "Partial copy from userspace\n"); pr_warn("Partial copy from userspace\n");
return -EFAULT; return -EFAULT;
} }
...@@ -503,8 +505,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, ...@@ -503,8 +505,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
copied = copy_to_user(argp, &master, copied = copy_to_user(argp, &master,
sizeof(struct vme_master)); sizeof(struct vme_master));
if (copied != 0) { if (copied != 0) {
printk(KERN_WARNING "Partial copy to " pr_warn("Partial copy to userspace\n");
"userspace\n");
return -EFAULT; return -EFAULT;
} }
...@@ -515,8 +516,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, ...@@ -515,8 +516,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
copied = copy_from_user(&master, argp, sizeof(master)); copied = copy_from_user(&master, argp, sizeof(master));
if (copied != 0) { if (copied != 0) {
printk(KERN_WARNING "Partial copy from " pr_warn("Partial copy from userspace\n");
"userspace\n");
return -EFAULT; return -EFAULT;
} }
...@@ -546,8 +546,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, ...@@ -546,8 +546,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
copied = copy_to_user(argp, &slave, copied = copy_to_user(argp, &slave,
sizeof(struct vme_slave)); sizeof(struct vme_slave));
if (copied != 0) { if (copied != 0) {
printk(KERN_WARNING "Partial copy to " pr_warn("Partial copy to userspace\n");
"userspace\n");
return -EFAULT; return -EFAULT;
} }
...@@ -558,8 +557,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, ...@@ -558,8 +557,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
copied = copy_from_user(&slave, argp, sizeof(slave)); copied = copy_from_user(&slave, argp, sizeof(slave));
if (copied != 0) { if (copied != 0) {
printk(KERN_WARNING "Partial copy from " pr_warn("Partial copy from userspace\n");
"userspace\n");
return -EFAULT; return -EFAULT;
} }
...@@ -599,7 +597,7 @@ static void buf_unalloc(int num) ...@@ -599,7 +597,7 @@ static void buf_unalloc(int num)
{ {
if (image[num].kern_buf) { if (image[num].kern_buf) {
#ifdef VME_DEBUG #ifdef VME_DEBUG
printk(KERN_DEBUG "UniverseII:Releasing buffer at %p\n", pr_debug("UniverseII:Releasing buffer at %p\n",
image[num].pci_buf); image[num].pci_buf);
#endif #endif
...@@ -612,7 +610,7 @@ static void buf_unalloc(int num) ...@@ -612,7 +610,7 @@ static void buf_unalloc(int num)
#ifdef VME_DEBUG #ifdef VME_DEBUG
} else { } else {
printk(KERN_DEBUG "UniverseII: Buffer not allocated\n"); pr_debug("UniverseII: Buffer not allocated\n");
#endif #endif
} }
} }
...@@ -629,11 +627,10 @@ static int __init vme_user_init(void) ...@@ -629,11 +627,10 @@ static int __init vme_user_init(void)
{ {
int retval = 0; int retval = 0;
printk(KERN_INFO "VME User Space Access Driver\n"); pr_info("VME User Space Access Driver\n");
if (bus_num == 0) { if (bus_num == 0) {
printk(KERN_ERR "%s: No cards, skipping registration\n", pr_err("No cards, skipping registration\n");
driver_name);
retval = -ENODEV; retval = -ENODEV;
goto err_nocard; goto err_nocard;
} }
...@@ -642,8 +639,8 @@ static int __init vme_user_init(void) ...@@ -642,8 +639,8 @@ static int __init vme_user_init(void)
* in future revisions if that ever becomes necessary. * in future revisions if that ever becomes necessary.
*/ */
if (bus_num > VME_USER_BUS_MAX) { if (bus_num > VME_USER_BUS_MAX) {
printk(KERN_ERR "%s: Driver only able to handle %d buses\n", pr_err("Driver only able to handle %d buses\n",
driver_name, VME_USER_BUS_MAX); VME_USER_BUS_MAX);
bus_num = VME_USER_BUS_MAX; bus_num = VME_USER_BUS_MAX;
} }
...@@ -683,8 +680,7 @@ static int __devinit vme_user_probe(struct vme_dev *vdev) ...@@ -683,8 +680,7 @@ static int __devinit vme_user_probe(struct vme_dev *vdev)
/* Save pointer to the bridge device */ /* Save pointer to the bridge device */
if (vme_user_bridge != NULL) { if (vme_user_bridge != NULL) {
printk(KERN_ERR "%s: Driver can only be loaded for 1 device\n", dev_err(&vdev->dev, "Driver can only be loaded for 1 device\n");
driver_name);
err = -EINVAL; err = -EINVAL;
goto err_dev; goto err_dev;
} }
...@@ -707,8 +703,8 @@ static int __devinit vme_user_probe(struct vme_dev *vdev) ...@@ -707,8 +703,8 @@ static int __devinit vme_user_probe(struct vme_dev *vdev)
err = register_chrdev_region(MKDEV(VME_MAJOR, 0), VME_DEVS, err = register_chrdev_region(MKDEV(VME_MAJOR, 0), VME_DEVS,
driver_name); driver_name);
if (err) { if (err) {
printk(KERN_WARNING "%s: Error getting Major Number %d for " dev_warn(&vdev->dev, "Error getting Major Number %d for driver.\n",
"driver.\n", driver_name, VME_MAJOR); VME_MAJOR);
goto err_region; goto err_region;
} }
...@@ -718,7 +714,7 @@ static int __devinit vme_user_probe(struct vme_dev *vdev) ...@@ -718,7 +714,7 @@ static int __devinit vme_user_probe(struct vme_dev *vdev)
vme_user_cdev->owner = THIS_MODULE; vme_user_cdev->owner = THIS_MODULE;
err = cdev_add(vme_user_cdev, MKDEV(VME_MAJOR, 0), VME_DEVS); err = cdev_add(vme_user_cdev, MKDEV(VME_MAJOR, 0), VME_DEVS);
if (err) { if (err) {
printk(KERN_WARNING "%s: cdev_all failed\n", driver_name); dev_warn(&vdev->dev, "cdev_all failed\n");
goto err_char; goto err_char;
} }
...@@ -732,16 +728,16 @@ static int __devinit vme_user_probe(struct vme_dev *vdev) ...@@ -732,16 +728,16 @@ static int __devinit vme_user_probe(struct vme_dev *vdev)
image[i].resource = vme_slave_request(vme_user_bridge, image[i].resource = vme_slave_request(vme_user_bridge,
VME_A24, VME_SCT); VME_A24, VME_SCT);
if (image[i].resource == NULL) { if (image[i].resource == NULL) {
printk(KERN_WARNING "Unable to allocate slave " dev_warn(&vdev->dev,
"resource\n"); "Unable to allocate slave resource\n");
goto err_slave; goto err_slave;
} }
image[i].size_buf = PCI_BUF_SIZE; image[i].size_buf = PCI_BUF_SIZE;
image[i].kern_buf = vme_alloc_consistent(image[i].resource, image[i].kern_buf = vme_alloc_consistent(image[i].resource,
image[i].size_buf, &image[i].pci_buf); image[i].size_buf, &image[i].pci_buf);
if (image[i].kern_buf == NULL) { if (image[i].kern_buf == NULL) {
printk(KERN_WARNING "Unable to allocate memory for " dev_warn(&vdev->dev,
"buffer\n"); "Unable to allocate memory for buffer\n");
image[i].pci_buf = 0; image[i].pci_buf = 0;
vme_slave_free(image[i].resource); vme_slave_free(image[i].resource);
err = -ENOMEM; err = -ENOMEM;
...@@ -758,15 +754,15 @@ static int __devinit vme_user_probe(struct vme_dev *vdev) ...@@ -758,15 +754,15 @@ static int __devinit vme_user_probe(struct vme_dev *vdev)
image[i].resource = vme_master_request(vme_user_bridge, image[i].resource = vme_master_request(vme_user_bridge,
VME_A32, VME_SCT, VME_D32); VME_A32, VME_SCT, VME_D32);
if (image[i].resource == NULL) { if (image[i].resource == NULL) {
printk(KERN_WARNING "Unable to allocate master " dev_warn(&vdev->dev,
"resource\n"); "Unable to allocate master resource\n");
goto err_master; goto err_master;
} }
image[i].size_buf = PCI_BUF_SIZE; image[i].size_buf = PCI_BUF_SIZE;
image[i].kern_buf = kmalloc(image[i].size_buf, GFP_KERNEL); image[i].kern_buf = kmalloc(image[i].size_buf, GFP_KERNEL);
if (image[i].kern_buf == NULL) { if (image[i].kern_buf == NULL) {
printk(KERN_WARNING "Unable to allocate memory for " dev_warn(&vdev->dev,
"master window buffers\n"); "Unable to allocate memory for master window buffers\n");
err = -ENOMEM; err = -ENOMEM;
goto err_master_buf; goto err_master_buf;
} }
...@@ -775,7 +771,7 @@ static int __devinit vme_user_probe(struct vme_dev *vdev) ...@@ -775,7 +771,7 @@ static int __devinit vme_user_probe(struct vme_dev *vdev)
/* Create sysfs entries - on udev systems this creates the dev files */ /* Create sysfs entries - on udev systems this creates the dev files */
vme_user_sysfs_class = class_create(THIS_MODULE, driver_name); vme_user_sysfs_class = class_create(THIS_MODULE, driver_name);
if (IS_ERR(vme_user_sysfs_class)) { if (IS_ERR(vme_user_sysfs_class)) {
printk(KERN_ERR "Error creating vme_user class.\n"); dev_err(&vdev->dev, "Error creating vme_user class.\n");
err = PTR_ERR(vme_user_sysfs_class); err = PTR_ERR(vme_user_sysfs_class);
goto err_class; goto err_class;
} }
...@@ -803,8 +799,7 @@ static int __devinit vme_user_probe(struct vme_dev *vdev) ...@@ -803,8 +799,7 @@ static int __devinit vme_user_probe(struct vme_dev *vdev)
image[i].device = device_create(vme_user_sysfs_class, NULL, image[i].device = device_create(vme_user_sysfs_class, NULL,
MKDEV(VME_MAJOR, i), NULL, name, num); MKDEV(VME_MAJOR, i), NULL, name, num);
if (IS_ERR(image[i].device)) { if (IS_ERR(image[i].device)) {
printk(KERN_INFO "%s: Error creating sysfs device\n", dev_info(&vdev->dev, "Error creating sysfs device\n");
driver_name);
err = PTR_ERR(image[i].device); err = PTR_ERR(image[i].device);
goto err_sysfs; goto err_sysfs;
} }
......
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