Commit e174e6ca authored by YAMANE Toshiaki's avatar YAMANE Toshiaki Committed by Mauro Carvalho Chehab

[media] staging/media: Use dev_ or pr_ printks in lirc/lirc_sasem.c

fixed below checkpatch warnings.
- WARNING: Prefer netdev_info(netdev, ... then dev_info(dev, ... then pr_info(...  to printk(KERN_INFO ...
- WARNING: Prefer netdev_warn(netdev, ... then dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
- WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(...  to printk(KERN_ERR ...
and add pr_fmt.
Signed-off-by: default avatarYAMANE Toshiaki <yamanetoshi@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e6da7661
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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/errno.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -171,7 +173,7 @@ static void delete_context(struct sasem_context *context) ...@@ -171,7 +173,7 @@ static void delete_context(struct sasem_context *context)
kfree(context); kfree(context);
if (debug) 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) static void deregister_from_lirc(struct sasem_context *context)
...@@ -181,11 +183,10 @@ static void deregister_from_lirc(struct sasem_context *context) ...@@ -181,11 +183,10 @@ static void deregister_from_lirc(struct sasem_context *context)
retval = lirc_unregister_driver(minor); retval = lirc_unregister_driver(minor);
if (retval) if (retval)
printk(KERN_ERR "%s: unable to deregister from lirc (%d)\n", pr_err("%s: unable to deregister from lirc (%d)\n",
__func__, retval); __func__, retval);
else else
printk(KERN_INFO "Deregistered Sasem driver (minor:%d)\n", pr_info("Deregistered Sasem driver (minor:%d)\n", minor);
minor);
} }
...@@ -206,8 +207,7 @@ static int vfd_open(struct inode *inode, struct file *file) ...@@ -206,8 +207,7 @@ static int vfd_open(struct inode *inode, struct file *file)
subminor = iminor(inode); subminor = iminor(inode);
interface = usb_find_interface(&sasem_driver, subminor); interface = usb_find_interface(&sasem_driver, subminor);
if (!interface) { if (!interface) {
printk(KERN_ERR KBUILD_MODNAME pr_err("%s: could not find interface for minor %d\n",
": %s: could not find interface for minor %d\n",
__func__, subminor); __func__, subminor);
retval = -ENODEV; retval = -ENODEV;
goto exit; goto exit;
...@@ -252,8 +252,7 @@ static long vfd_ioctl(struct file *file, unsigned cmd, unsigned long arg) ...@@ -252,8 +252,7 @@ static long vfd_ioctl(struct file *file, unsigned cmd, unsigned long arg)
context = (struct sasem_context *) file->private_data; context = (struct sasem_context *) file->private_data;
if (!context) { if (!context) {
printk(KERN_ERR KBUILD_MODNAME pr_err("%s: no context for device\n", __func__);
": %s: no context for device\n", __func__);
return -ENODEV; return -ENODEV;
} }
...@@ -266,7 +265,7 @@ static long vfd_ioctl(struct file *file, unsigned cmd, unsigned long arg) ...@@ -266,7 +265,7 @@ static long vfd_ioctl(struct file *file, unsigned cmd, unsigned long arg)
context->vfd_contrast = (unsigned int)arg; context->vfd_contrast = (unsigned int)arg;
break; break;
default: default:
printk(KERN_INFO "Unknown IOCTL command\n"); pr_info("Unknown IOCTL command\n");
mutex_unlock(&context->ctx_lock); mutex_unlock(&context->ctx_lock);
return -ENOIOCTLCMD; /* not supported */ return -ENOIOCTLCMD; /* not supported */
} }
...@@ -287,8 +286,7 @@ static int vfd_close(struct inode *inode, struct file *file) ...@@ -287,8 +286,7 @@ static int vfd_close(struct inode *inode, struct file *file)
context = (struct sasem_context *) file->private_data; context = (struct sasem_context *) file->private_data;
if (!context) { if (!context) {
printk(KERN_ERR KBUILD_MODNAME pr_err("%s: no context for device\n", __func__);
": %s: no context for device\n", __func__);
return -ENODEV; return -ENODEV;
} }
...@@ -299,7 +297,7 @@ static int vfd_close(struct inode *inode, struct file *file) ...@@ -299,7 +297,7 @@ static int vfd_close(struct inode *inode, struct file *file)
retval = -EIO; retval = -EIO;
} else { } else {
context->vfd_isopen = 0; 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) { if (!context->dev_present && !context->ir_isopen) {
/* Device disconnected before close and IR port is /* Device disconnected before close and IR port is
...@@ -373,16 +371,14 @@ static ssize_t vfd_write(struct file *file, const char *buf, ...@@ -373,16 +371,14 @@ static ssize_t vfd_write(struct file *file, const char *buf,
context = (struct sasem_context *) file->private_data; context = (struct sasem_context *) file->private_data;
if (!context) { if (!context) {
printk(KERN_ERR KBUILD_MODNAME pr_err("%s: no context for device\n", __func__);
": %s: no context for device\n", __func__);
return -ENODEV; return -ENODEV;
} }
mutex_lock(&context->ctx_lock); mutex_lock(&context->ctx_lock);
if (!context->dev_present) { if (!context->dev_present) {
printk(KERN_ERR KBUILD_MODNAME pr_err("%s: no Sasem device present\n", __func__);
": %s: no Sasem device present\n", __func__);
retval = -ENODEV; retval = -ENODEV;
goto exit; goto exit;
} }
...@@ -519,7 +515,7 @@ static int ir_open(void *data) ...@@ -519,7 +515,7 @@ static int ir_open(void *data)
__func__, retval); __func__, retval);
else { else {
context->ir_isopen = 1; context->ir_isopen = 1;
printk(KERN_INFO "IR port opened\n"); dev_info(&context->dev->dev, "IR port opened\n");
} }
exit: exit:
...@@ -538,8 +534,7 @@ static void ir_close(void *data) ...@@ -538,8 +534,7 @@ static void ir_close(void *data)
context = (struct sasem_context *)data; context = (struct sasem_context *)data;
if (!context) { if (!context) {
printk(KERN_ERR KBUILD_MODNAME pr_err("%s: no context for device\n", __func__);
": %s: no context for device\n", __func__);
return; return;
} }
...@@ -547,7 +542,7 @@ static void ir_close(void *data) ...@@ -547,7 +542,7 @@ static void ir_close(void *data)
usb_kill_urb(context->rx_urb); usb_kill_urb(context->rx_urb);
context->ir_isopen = 0; context->ir_isopen = 0;
printk(KERN_INFO "IR port closed\n"); pr_info("IR port closed\n");
if (!context->dev_present) { if (!context->dev_present) {
...@@ -584,8 +579,9 @@ static void incoming_packet(struct sasem_context *context, ...@@ -584,8 +579,9 @@ static void incoming_packet(struct sasem_context *context,
int i; int i;
if (len != 8) { if (len != 8) {
printk(KERN_WARNING "%s: invalid incoming packet size (%d)\n", dev_warn(&context->dev->dev,
__func__, len); "%s: invalid incoming packet size (%d)\n",
__func__, len);
return; return;
} }
...@@ -663,7 +659,7 @@ static void usb_rx_callback(struct urb *urb) ...@@ -663,7 +659,7 @@ static void usb_rx_callback(struct urb *urb)
break; break;
default: default:
printk(KERN_WARNING "%s: status (%d): ignored", dev_warn(&urb->dev->dev, "%s: status (%d): ignored",
__func__, urb->status); __func__, urb->status);
break; break;
} }
...@@ -830,8 +826,9 @@ static int sasem_probe(struct usb_interface *interface, ...@@ -830,8 +826,9 @@ static int sasem_probe(struct usb_interface *interface,
retval = lirc_minor; retval = lirc_minor;
goto unlock; goto unlock;
} else } else
printk(KERN_INFO "%s: Registered Sasem driver (minor:%d)\n", dev_info(&interface->dev,
__func__, lirc_minor); "%s: Registered Sasem driver (minor:%d)\n",
__func__, lirc_minor);
/* Needed while unregistering! */ /* Needed while unregistering! */
driver->minor = lirc_minor; driver->minor = lirc_minor;
...@@ -852,15 +849,18 @@ static int sasem_probe(struct usb_interface *interface, ...@@ -852,15 +849,18 @@ static int sasem_probe(struct usb_interface *interface,
if (vfd_ep_found) { if (vfd_ep_found) {
if (debug) 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)) if (usb_register_dev(interface, &sasem_class))
/* Not a fatal error, so ignore */ /* Not a fatal error, so ignore */
printk(KERN_INFO "%s: could not get a minor number " dev_info(&interface->dev,
"for VFD\n", __func__); "%s: could not get a minor number for VFD\n",
__func__);
} }
printk(KERN_INFO "%s: Sasem device on usb<%d:%d> initialized\n", dev_info(&interface->dev,
__func__, dev->bus->busnum, dev->devnum); "%s: Sasem device on usb<%d:%d> initialized\n",
__func__, dev->bus->busnum, dev->devnum);
unlock: unlock:
mutex_unlock(&context->ctx_lock); mutex_unlock(&context->ctx_lock);
...@@ -903,7 +903,8 @@ static void sasem_disconnect(struct usb_interface *interface) ...@@ -903,7 +903,8 @@ static void sasem_disconnect(struct usb_interface *interface)
context = usb_get_intfdata(interface); context = usb_get_intfdata(interface);
mutex_lock(&context->ctx_lock); 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); usb_set_intfdata(interface, NULL);
context->dev_present = 0; context->dev_present = 0;
......
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