Signed-off-by: Joe Perches <joe@xxxxxxxxxxx> --- drivers/staging/vme/devices/vme_user.c | 63 ++++++++++++++------------------ 1 files changed, 27 insertions(+), 36 deletions(-) diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 7891288..45b252f 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -15,6 +15,8 @@ * option) any later version. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/cdev.h> #include <linux/delay.h> #include <linux/device.h> @@ -168,7 +170,7 @@ static int vme_user_open(struct inode *inode, struct file *file) down(&image[minor].sem); /* Only allow device to be opened if a resource is allocated */ if (image[minor].resource == NULL) { - printk(KERN_ERR "No resources allocated for device\n"); + pr_err("No resources allocated for device\n"); err = -EINVAL; goto err_res; } @@ -224,13 +226,13 @@ static ssize_t resource_to_user(int minor, char __user *buf, size_t count, (unsigned long)copied); if (retval != 0) { copied = (copied - retval); - printk("User copy failed\n"); + pr_info("User copy failed\n"); return -EINVAL; } } else { /* XXX Need to write this */ - printk("Currently don't support large transfers\n"); + pr_info("Currently don't support large transfers\n"); /* Map in pages from userspace */ /* Call vme_master_read to do the transfer */ @@ -264,7 +266,7 @@ static ssize_t resource_from_user(unsigned int minor, const char *buf, image[minor].kern_buf, copied, *ppos); } else { /* XXX Need to write this */ - printk("Currently don't support large transfers\n"); + pr_info("Currently don't support large transfers\n"); /* Map in pages from userspace */ /* Call vme_master_write to do the transfer */ @@ -285,7 +287,7 @@ static ssize_t buffer_to_user(unsigned int minor, char __user *buf, retval = __copy_to_user(buf, image_ptr, (unsigned long)count); if (retval != 0) { retval = (count - retval); - printk(KERN_WARNING "Partial copy to userspace\n"); + pr_warning("Partial copy to userspace\n"); } else retval = count; @@ -304,7 +306,7 @@ static ssize_t buffer_from_user(unsigned int minor, const char *buf, retval = __copy_from_user(image_ptr, buf, (unsigned long)count); if (retval != 0) { retval = (count - retval); - printk(KERN_WARNING "Partial copy to userspace\n"); + pr_warning("Partial copy to userspace\n"); } else retval = count; @@ -401,7 +403,7 @@ static ssize_t vme_user_write(struct file *file, const char *buf, size_t count, static loff_t vme_user_llseek(struct file *file, loff_t off, int whence) { - printk(KERN_ERR "Llseek currently incomplete\n"); + pr_err("llseek currently incomplete\n"); return -EINVAL; } @@ -446,8 +448,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, copied = copy_to_user((char *)arg, &master, sizeof(struct vme_master)); if (copied != 0) { - printk(KERN_WARNING "Partial copy to " - "userspace\n"); + pr_warning("Partial copy to userspace\n"); return -EFAULT; } @@ -459,8 +460,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, copied = copy_from_user(&master, (char *)arg, sizeof(master)); if (copied != 0) { - printk(KERN_WARNING "Partial copy from " - "userspace\n"); + pr_warning("Partial copy from userspace\n"); return -EFAULT; } @@ -490,8 +490,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, copied = copy_to_user((char *)arg, &slave, sizeof(struct vme_slave)); if (copied != 0) { - printk(KERN_WARNING "Partial copy to " - "userspace\n"); + pr_warning("Partial copy to userspace\n"); return -EFAULT; } @@ -503,8 +502,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, copied = copy_from_user(&slave, (char *)arg, sizeof(slave)); if (copied != 0) { - printk(KERN_WARNING "Partial copy from " - "userspace\n"); + pr_warning("Partial copy from userspace\n"); return -EFAULT; } @@ -563,11 +561,10 @@ static int __init vme_user_init(void) int i; struct vme_device_id *ids; - printk(KERN_INFO "VME User Space Access Driver\n"); + pr_info("VME User Space Access Driver\n"); if (bus_num == 0) { - printk(KERN_ERR "%s: No cards, skipping registration\n", - driver_name); + pr_err("No cards, skipping registration\n"); goto err_nocard; } @@ -575,8 +572,8 @@ static int __init vme_user_init(void) * in future revisions if that ever becomes necessary. */ if (bus_num > USER_BUS_MAX) { - printk(KERN_ERR "%s: Driver only able to handle %d PIO2 " - "Cards\n", driver_name, USER_BUS_MAX); + pr_err("Driver only able to handle %d PIO2 Cards\n", + USER_BUS_MAX); bus_num = USER_BUS_MAX; } @@ -584,8 +581,7 @@ static int __init vme_user_init(void) /* Dynamically create the bind table based on module parameters */ ids = kmalloc(sizeof(struct vme_device_id) * (bus_num + 1), GFP_KERNEL); if (ids == NULL) { - printk(KERN_ERR "%s: Unable to allocate ID table\n", - driver_name); + pr_err("Unable to allocate ID table\n"); goto err_id; } @@ -629,8 +625,7 @@ static int __init vme_user_probe(struct device *dev, int cur_bus, int cur_slot) /* Save pointer to the bridge device */ if (vme_user_bridge != NULL) { - printk(KERN_ERR "%s: Driver can only be loaded for 1 device\n", - driver_name); + pr_err("Driver can only be loaded for 1 device\n"); err = -EINVAL; goto err_dev; } @@ -653,8 +648,8 @@ static int __init vme_user_probe(struct device *dev, int cur_bus, int cur_slot) err = register_chrdev_region(MKDEV(VME_MAJOR, 0), VME_DEVS, driver_name); if (err) { - printk(KERN_WARNING "%s: Error getting Major Number %d for " - "driver.\n", driver_name, VME_MAJOR); + pr_warning("Error getting Major Number %d for driver.\n", + VME_MAJOR); goto err_region; } @@ -664,7 +659,7 @@ static int __init vme_user_probe(struct device *dev, int cur_bus, int cur_slot) vme_user_cdev->owner = THIS_MODULE; err = cdev_add(vme_user_cdev, MKDEV(VME_MAJOR, 0), VME_DEVS); if (err) { - printk(KERN_WARNING "%s: cdev_all failed\n", driver_name); + pr_warning("cdev_all failed\n"); goto err_char; } @@ -674,16 +669,14 @@ static int __init vme_user_probe(struct device *dev, int cur_bus, int cur_slot) image[i].resource = vme_slave_request(vme_user_bridge, VME_A16, VME_SCT); if (image[i].resource == NULL) { - printk(KERN_WARNING "Unable to allocate slave " - "resource\n"); + pr_warning("Unable to allocate slave resource\n"); goto err_slave; } image[i].size_buf = PCI_BUF_SIZE; image[i].kern_buf = vme_alloc_consistent(image[i].resource, image[i].size_buf, &(image[i].pci_buf)); if (image[i].kern_buf == NULL) { - printk(KERN_WARNING "Unable to allocate memory for " - "buffer\n"); + pr_warning("Unable to allocate memory for buffer\n"); image[i].pci_buf = 0; vme_slave_free(image[i].resource); err = -ENOMEM; @@ -700,8 +693,7 @@ static int __init vme_user_probe(struct device *dev, int cur_bus, int cur_slot) image[i].resource = vme_master_request(vme_user_bridge, VME_A32, VME_SCT, VME_D32); if (image[i].resource == NULL) { - printk(KERN_WARNING "Unable to allocate master " - "resource\n"); + pr_warning("Unable to allocate master resource\n"); goto err_master; } } @@ -709,7 +701,7 @@ static int __init vme_user_probe(struct device *dev, int cur_bus, int cur_slot) /* Create sysfs entries - on udev systems this creates the dev files */ vme_user_sysfs_class = class_create(THIS_MODULE, driver_name); if (IS_ERR(vme_user_sysfs_class)) { - printk(KERN_ERR "Error creating vme_user class.\n"); + pr_err("Error creating vme_user class.\n"); err = PTR_ERR(vme_user_sysfs_class); goto err_class; } @@ -737,8 +729,7 @@ static int __init vme_user_probe(struct device *dev, int cur_bus, int cur_slot) MKDEV(VME_MAJOR, i), NULL, name, (type[i] == SLAVE_MINOR)? i - (MASTER_MAX + 1) : i); if (IS_ERR(image[i].device)) { - printk("%s: Error creating sysfs device\n", - driver_name); + pr_err("Error creating sysfs device\n"); err = PTR_ERR(image[i].device); goto err_sysfs; } -- 1.6.5.rc3.dirty _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel