summaryrefslogtreecommitdiff
path: root/drivers/staging/vme/devices/vme_user.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-11 21:59:44 (GMT)
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-11 21:59:44 (GMT)
commit8966961b31c251b854169e9886394c2a20f2cea7 (patch)
tree248a625b23335acbd5ca4b55eb136fe0dc8ba0aa /drivers/staging/vme/devices/vme_user.c
parent6a5971d8fea1f4a8c33dfe0cec6a1c490f0c9cde (diff)
parent7bcb57cde66c19df378f3468ea342166a8a4504d (diff)
downloadlinux-fsl-qoriq-8966961b31c251b854169e9886394c2a20f2cea7.tar.xz
Merge tag 'staging-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver tree merge from Greg Kroah-Hartman: "Here's the big staging tree merge for 3.8-rc1 There's a lot of patches in here, the majority being the comedi rework/cleanup that has been ongoing and is causing a huge reduction in overall code size, which is amazing to watch. We also removed some older drivers (telephony and rts_pstor), and added a new one (fwserial which also came in through the tty tree due to tty api changes, take that one if you get merge conflicts.) The iio and ipack drivers are moving out of the staging area into their own part of the kernel as they have been cleaned up sufficiently and are working well. Overall, again a reduction of code: 768 files changed, 31887 insertions(+), 82166 deletions(-) All of this has been in the linux-next tree for a while. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>" * tag 'staging-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1298 commits) iio: imu: adis16480: remove duplicated include from adis16480.c iio: gyro: adis16136: remove duplicated include from adis16136.c iio:imu: adis16480: show_firmware() buffer too small iio:gyro: adis16136: divide by zero in write_frequency() iio: adc: Add Texas Instruments ADC081C021/027 support iio:ad7793: Add support for the ad7796 and ad7797 iio:ad7793: Add support for the ad7798 and ad7799 staging:iio: Move ad7793 driver out of staging staging:iio:ad7793: Implement stricter id checking staging:iio:ad7793: Move register definitions from header to source staging:iio:ad7793: Rework regulator handling staging:iio:ad7793: Rework platform data staging:iio:ad7793: Use kstrtol instead of strict_strtol staging:iio:ad7793: Use usleep_range instead of msleep staging:iio:ad7793: Fix temperature scale staging:iio:ad7793: Fix VDD monitor scale staging: gdm72xx: unlock on error in init_usb() staging: panel: pass correct lengths to keypad_send_key() staging: comedi: addi_apci_2032: fix interrupt support staging: comedi: addi_apci_2032: move i_APCI2032_ConfigDigitalOutput() ...
Diffstat (limited to 'drivers/staging/vme/devices/vme_user.c')
-rw-r--r--drivers/staging/vme/devices/vme_user.c83
1 files changed, 39 insertions, 44 deletions
diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c
index c3f94f3..4ef852c 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>
@@ -135,8 +137,8 @@ static loff_t vme_user_llseek(struct file *, loff_t, int);
static long vme_user_unlocked_ioctl(struct file *, unsigned int, unsigned long);
static int vme_user_match(struct vme_dev *);
-static int __devinit vme_user_probe(struct vme_dev *);
-static int __devexit vme_user_remove(struct vme_dev *);
+static int vme_user_probe(struct vme_dev *);
+static int vme_user_remove(struct vme_dev *);
static const struct file_operations vme_user_fops = {
.open = vme_user_open,
@@ -170,7 +172,7 @@ static int vme_user_open(struct inode *inode, struct file *file)
mutex_lock(&image[minor].mutex);
/* Allow device to be opened if a resource is needed and allocated. */
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;
goto err_res;
}
@@ -225,13 +227,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(KERN_INFO "User copy failed\n");
+ pr_info("User copy failed\n");
return -EINVAL;
}
} else {
/* 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 */
/* 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,
image[minor].kern_buf, copied, *ppos);
} else {
/* 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 */
/* Call vme_master_write to do the transfer */
@@ -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);
if (retval != 0) {
retval = (count - retval);
- printk(KERN_WARNING "Partial copy to userspace\n");
+ pr_warn("Partial copy to userspace\n");
} else
retval = count;
@@ -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);
if (retval != 0) {
retval = (count - retval);
- printk(KERN_WARNING "Partial copy to userspace\n");
+ pr_warn("Partial copy to userspace\n");
} else
retval = count;
@@ -476,7 +478,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
copied = copy_from_user(&irq_req, argp,
sizeof(struct vme_irq_id));
if (copied != 0) {
- printk(KERN_WARNING "Partial copy from userspace\n");
+ pr_warn("Partial copy from userspace\n");
return -EFAULT;
}
@@ -503,8 +505,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
copied = copy_to_user(argp, &master,
sizeof(struct vme_master));
if (copied != 0) {
- printk(KERN_WARNING "Partial copy to "
- "userspace\n");
+ pr_warn("Partial copy to userspace\n");
return -EFAULT;
}
@@ -515,8 +516,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
copied = copy_from_user(&master, argp, sizeof(master));
if (copied != 0) {
- printk(KERN_WARNING "Partial copy from "
- "userspace\n");
+ pr_warn("Partial copy from userspace\n");
return -EFAULT;
}
@@ -546,8 +546,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
copied = copy_to_user(argp, &slave,
sizeof(struct vme_slave));
if (copied != 0) {
- printk(KERN_WARNING "Partial copy to "
- "userspace\n");
+ pr_warn("Partial copy to userspace\n");
return -EFAULT;
}
@@ -558,8 +557,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
copied = copy_from_user(&slave, argp, sizeof(slave));
if (copied != 0) {
- printk(KERN_WARNING "Partial copy from "
- "userspace\n");
+ pr_warn("Partial copy from userspace\n");
return -EFAULT;
}
@@ -599,8 +597,8 @@ static void buf_unalloc(int num)
{
if (image[num].kern_buf) {
#ifdef VME_DEBUG
- printk(KERN_DEBUG "UniverseII:Releasing buffer at %p\n",
- image[num].pci_buf);
+ pr_debug("UniverseII:Releasing buffer at %p\n",
+ image[num].pci_buf);
#endif
vme_free_consistent(image[num].resource, image[num].size_buf,
@@ -612,7 +610,7 @@ static void buf_unalloc(int num)
#ifdef VME_DEBUG
} else {
- printk(KERN_DEBUG "UniverseII: Buffer not allocated\n");
+ pr_debug("UniverseII: Buffer not allocated\n");
#endif
}
}
@@ -621,7 +619,7 @@ static struct vme_driver vme_user_driver = {
.name = driver_name,
.match = vme_user_match,
.probe = vme_user_probe,
- .remove = __devexit_p(vme_user_remove),
+ .remove = vme_user_remove,
};
@@ -629,11 +627,10 @@ static int __init vme_user_init(void)
{
int retval = 0;
- 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");
retval = -ENODEV;
goto err_nocard;
}
@@ -642,8 +639,8 @@ static int __init vme_user_init(void)
* in future revisions if that ever becomes necessary.
*/
if (bus_num > VME_USER_BUS_MAX) {
- printk(KERN_ERR "%s: Driver only able to handle %d buses\n",
- driver_name, VME_USER_BUS_MAX);
+ pr_err("Driver only able to handle %d buses\n",
+ VME_USER_BUS_MAX);
bus_num = VME_USER_BUS_MAX;
}
@@ -676,15 +673,14 @@ static int vme_user_match(struct vme_dev *vdev)
* as practical. We will therefore reserve the buffers and request the images
* here so that we don't have to do it later.
*/
-static int __devinit vme_user_probe(struct vme_dev *vdev)
+static int vme_user_probe(struct vme_dev *vdev)
{
int i, err;
char name[12];
/* 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);
+ dev_err(&vdev->dev, "Driver can only be loaded for 1 device\n");
err = -EINVAL;
goto err_dev;
}
@@ -707,8 +703,8 @@ static int __devinit vme_user_probe(struct vme_dev *vdev)
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);
+ dev_warn(&vdev->dev, "Error getting Major Number %d for driver.\n",
+ VME_MAJOR);
goto err_region;
}
@@ -718,7 +714,7 @@ static int __devinit vme_user_probe(struct vme_dev *vdev)
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);
+ dev_warn(&vdev->dev, "cdev_all failed\n");
goto err_char;
}
@@ -732,16 +728,16 @@ static int __devinit vme_user_probe(struct vme_dev *vdev)
image[i].resource = vme_slave_request(vme_user_bridge,
VME_A24, VME_SCT);
if (image[i].resource == NULL) {
- printk(KERN_WARNING "Unable to allocate slave "
- "resource\n");
+ dev_warn(&vdev->dev,
+ "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");
+ dev_warn(&vdev->dev,
+ "Unable to allocate memory for buffer\n");
image[i].pci_buf = 0;
vme_slave_free(image[i].resource);
err = -ENOMEM;
@@ -758,15 +754,15 @@ static int __devinit vme_user_probe(struct vme_dev *vdev)
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");
+ dev_warn(&vdev->dev,
+ "Unable to allocate master resource\n");
goto err_master;
}
image[i].size_buf = PCI_BUF_SIZE;
image[i].kern_buf = kmalloc(image[i].size_buf, GFP_KERNEL);
if (image[i].kern_buf == NULL) {
- printk(KERN_WARNING "Unable to allocate memory for "
- "master window buffers\n");
+ dev_warn(&vdev->dev,
+ "Unable to allocate memory for master window buffers\n");
err = -ENOMEM;
goto err_master_buf;
}
@@ -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 */
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");
+ dev_err(&vdev->dev, "Error creating vme_user class.\n");
err = PTR_ERR(vme_user_sysfs_class);
goto err_class;
}
@@ -803,8 +799,7 @@ static int __devinit vme_user_probe(struct vme_dev *vdev)
image[i].device = device_create(vme_user_sysfs_class, NULL,
MKDEV(VME_MAJOR, i), NULL, name, num);
if (IS_ERR(image[i].device)) {
- printk(KERN_INFO "%s: Error creating sysfs device\n",
- driver_name);
+ dev_info(&vdev->dev, "Error creating sysfs device\n");
err = PTR_ERR(image[i].device);
goto err_sysfs;
}
@@ -851,7 +846,7 @@ err_dev:
return err;
}
-static int __devexit vme_user_remove(struct vme_dev *dev)
+static int vme_user_remove(struct vme_dev *dev)
{
int i;