Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 357110
b: refs/heads/master
c: e174e6c
h: refs/heads/master
v: v3
  • Loading branch information
YAMANE Toshiaki authored and Mauro Carvalho Chehab committed Dec 21, 2012
1 parent 711dc95 commit 96c67dd
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e6da76617fe79ab76ad8f78606c423e093a284f3
refs/heads/master: e174e6cac62419ab136506e48790ccd36854ed53
65 changes: 33 additions & 32 deletions trunk/drivers/staging/media/lirc/lirc_sasem.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/errno.h>
#include <linux/init.h>
#include <linux/kernel.h>
Expand Down Expand Up @@ -171,7 +173,7 @@ static void delete_context(struct sasem_context *context)
kfree(context);

if (debug)
printk(KERN_INFO "%s: context deleted\n", __func__);
pr_info("%s: context deleted\n", __func__);
}

static void deregister_from_lirc(struct sasem_context *context)
Expand All @@ -181,11 +183,10 @@ static void deregister_from_lirc(struct sasem_context *context)

retval = lirc_unregister_driver(minor);
if (retval)
printk(KERN_ERR "%s: unable to deregister from lirc (%d)\n",
__func__, retval);
pr_err("%s: unable to deregister from lirc (%d)\n",
__func__, retval);
else
printk(KERN_INFO "Deregistered Sasem driver (minor:%d)\n",
minor);
pr_info("Deregistered Sasem driver (minor:%d)\n", minor);

}

Expand All @@ -206,8 +207,7 @@ static int vfd_open(struct inode *inode, struct file *file)
subminor = iminor(inode);
interface = usb_find_interface(&sasem_driver, subminor);
if (!interface) {
printk(KERN_ERR KBUILD_MODNAME
": %s: could not find interface for minor %d\n",
pr_err("%s: could not find interface for minor %d\n",
__func__, subminor);
retval = -ENODEV;
goto exit;
Expand Down Expand Up @@ -252,8 +252,7 @@ static long vfd_ioctl(struct file *file, unsigned cmd, unsigned long arg)
context = (struct sasem_context *) file->private_data;

if (!context) {
printk(KERN_ERR KBUILD_MODNAME
": %s: no context for device\n", __func__);
pr_err("%s: no context for device\n", __func__);
return -ENODEV;
}

Expand All @@ -266,7 +265,7 @@ static long vfd_ioctl(struct file *file, unsigned cmd, unsigned long arg)
context->vfd_contrast = (unsigned int)arg;
break;
default:
printk(KERN_INFO "Unknown IOCTL command\n");
pr_info("Unknown IOCTL command\n");
mutex_unlock(&context->ctx_lock);
return -ENOIOCTLCMD; /* not supported */
}
Expand All @@ -287,8 +286,7 @@ static int vfd_close(struct inode *inode, struct file *file)
context = (struct sasem_context *) file->private_data;

if (!context) {
printk(KERN_ERR KBUILD_MODNAME
": %s: no context for device\n", __func__);
pr_err("%s: no context for device\n", __func__);
return -ENODEV;
}

Expand All @@ -299,7 +297,7 @@ static int vfd_close(struct inode *inode, struct file *file)
retval = -EIO;
} else {
context->vfd_isopen = 0;
printk(KERN_INFO "VFD port closed\n");
dev_info(&context->dev->dev, "VFD port closed\n");
if (!context->dev_present && !context->ir_isopen) {

/* Device disconnected before close and IR port is
Expand Down Expand Up @@ -373,16 +371,14 @@ static ssize_t vfd_write(struct file *file, const char *buf,

context = (struct sasem_context *) file->private_data;
if (!context) {
printk(KERN_ERR KBUILD_MODNAME
": %s: no context for device\n", __func__);
pr_err("%s: no context for device\n", __func__);
return -ENODEV;
}

mutex_lock(&context->ctx_lock);

if (!context->dev_present) {
printk(KERN_ERR KBUILD_MODNAME
": %s: no Sasem device present\n", __func__);
pr_err("%s: no Sasem device present\n", __func__);
retval = -ENODEV;
goto exit;
}
Expand Down Expand Up @@ -519,7 +515,7 @@ static int ir_open(void *data)
__func__, retval);
else {
context->ir_isopen = 1;
printk(KERN_INFO "IR port opened\n");
dev_info(&context->dev->dev, "IR port opened\n");
}

exit:
Expand All @@ -538,16 +534,15 @@ static void ir_close(void *data)

context = (struct sasem_context *)data;
if (!context) {
printk(KERN_ERR KBUILD_MODNAME
": %s: no context for device\n", __func__);
pr_err("%s: no context for device\n", __func__);
return;
}

mutex_lock(&context->ctx_lock);

usb_kill_urb(context->rx_urb);
context->ir_isopen = 0;
printk(KERN_INFO "IR port closed\n");
pr_info("IR port closed\n");

if (!context->dev_present) {

Expand Down Expand Up @@ -584,8 +579,9 @@ static void incoming_packet(struct sasem_context *context,
int i;

if (len != 8) {
printk(KERN_WARNING "%s: invalid incoming packet size (%d)\n",
__func__, len);
dev_warn(&context->dev->dev,
"%s: invalid incoming packet size (%d)\n",
__func__, len);
return;
}

Expand Down Expand Up @@ -663,7 +659,7 @@ static void usb_rx_callback(struct urb *urb)
break;

default:
printk(KERN_WARNING "%s: status (%d): ignored",
dev_warn(&urb->dev->dev, "%s: status (%d): ignored",
__func__, urb->status);
break;
}
Expand Down Expand Up @@ -830,8 +826,9 @@ static int sasem_probe(struct usb_interface *interface,
retval = lirc_minor;
goto unlock;
} else
printk(KERN_INFO "%s: Registered Sasem driver (minor:%d)\n",
__func__, lirc_minor);
dev_info(&interface->dev,
"%s: Registered Sasem driver (minor:%d)\n",
__func__, lirc_minor);

/* Needed while unregistering! */
driver->minor = lirc_minor;
Expand All @@ -852,15 +849,18 @@ static int sasem_probe(struct usb_interface *interface,
if (vfd_ep_found) {

if (debug)
printk(KERN_INFO "Registering VFD with sysfs\n");
dev_info(&interface->dev,
"Registering VFD with sysfs\n");
if (usb_register_dev(interface, &sasem_class))
/* Not a fatal error, so ignore */
printk(KERN_INFO "%s: could not get a minor number "
"for VFD\n", __func__);
dev_info(&interface->dev,
"%s: could not get a minor number for VFD\n",
__func__);
}

printk(KERN_INFO "%s: Sasem device on usb<%d:%d> initialized\n",
__func__, dev->bus->busnum, dev->devnum);
dev_info(&interface->dev,
"%s: Sasem device on usb<%d:%d> initialized\n",
__func__, dev->bus->busnum, dev->devnum);
unlock:
mutex_unlock(&context->ctx_lock);

Expand Down Expand Up @@ -903,7 +903,8 @@ static void sasem_disconnect(struct usb_interface *interface)
context = usb_get_intfdata(interface);
mutex_lock(&context->ctx_lock);

printk(KERN_INFO "%s: Sasem device disconnected\n", __func__);
dev_info(&interface->dev, "%s: Sasem device disconnected\n",
__func__);

usb_set_intfdata(interface, NULL);
context->dev_present = 0;
Expand Down

0 comments on commit 96c67dd

Please sign in to comment.