Commit da0c4901 authored by Joe Perches's avatar Joe Perches Committed by Dmitry Torokhov

Input: use pr_fmt and pr_<level>

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 4eb3c30b
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -23,8 +25,7 @@ static void system_power_event(unsigned int keycode) ...@@ -23,8 +25,7 @@ static void system_power_event(unsigned int keycode)
switch (keycode) { switch (keycode) {
case KEY_SUSPEND: case KEY_SUSPEND:
apm_queue_event(APM_USER_SUSPEND); apm_queue_event(APM_USER_SUSPEND);
pr_info("Requesting system suspend...\n");
printk(KERN_INFO "apm-power: Requesting system suspend...\n");
break; break;
default: default:
break; break;
...@@ -65,18 +66,15 @@ static int apmpower_connect(struct input_handler *handler, ...@@ -65,18 +66,15 @@ static int apmpower_connect(struct input_handler *handler,
error = input_register_handle(handle); error = input_register_handle(handle);
if (error) { if (error) {
printk(KERN_ERR pr_err("Failed to register input power handler, error %d\n",
"apm-power: Failed to register input power handler, " error);
"error %d\n", error);
kfree(handle); kfree(handle);
return error; return error;
} }
error = input_open_device(handle); error = input_open_device(handle);
if (error) { if (error) {
printk(KERN_ERR pr_err("Failed to open input power device, error %d\n", error);
"apm-power: Failed to open input power device, "
"error %d\n", error);
input_unregister_handle(handle); input_unregister_handle(handle);
kfree(handle); kfree(handle);
return error; return error;
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/input.h> #include <linux/input.h>
...@@ -38,8 +40,8 @@ MODULE_LICENSE("GPL"); ...@@ -38,8 +40,8 @@ MODULE_LICENSE("GPL");
static void evbug_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) static void evbug_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
{ {
printk(KERN_DEBUG "evbug.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n", printk(KERN_DEBUG pr_fmt("Event. Dev: %s, Type: %d, Code: %d, Value: %d\n"),
dev_name(&handle->dev->dev), type, code, value); dev_name(&handle->dev->dev), type, code, value);
} }
static int evbug_connect(struct input_handler *handler, struct input_dev *dev, static int evbug_connect(struct input_handler *handler, struct input_dev *dev,
...@@ -64,10 +66,10 @@ static int evbug_connect(struct input_handler *handler, struct input_dev *dev, ...@@ -64,10 +66,10 @@ static int evbug_connect(struct input_handler *handler, struct input_dev *dev,
if (error) if (error)
goto err_unregister_handle; goto err_unregister_handle;
printk(KERN_DEBUG "evbug.c: Connected device: %s (%s at %s)\n", printk(KERN_DEBUG pr_fmt("Connected device: %s (%s at %s)\n"),
dev_name(&dev->dev), dev_name(&dev->dev),
dev->name ?: "unknown", dev->name ?: "unknown",
dev->phys ?: "unknown"); dev->phys ?: "unknown");
return 0; return 0;
...@@ -80,8 +82,8 @@ static int evbug_connect(struct input_handler *handler, struct input_dev *dev, ...@@ -80,8 +82,8 @@ static int evbug_connect(struct input_handler *handler, struct input_dev *dev,
static void evbug_disconnect(struct input_handle *handle) static void evbug_disconnect(struct input_handle *handle)
{ {
printk(KERN_DEBUG "evbug.c: Disconnected device: %s\n", printk(KERN_DEBUG pr_fmt("Disconnected device: %s\n"),
dev_name(&handle->dev->dev)); dev_name(&handle->dev->dev));
input_close_device(handle); input_close_device(handle);
input_unregister_handle(handle); input_unregister_handle(handle);
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
* the Free Software Foundation. * the Free Software Foundation.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#define EVDEV_MINOR_BASE 64 #define EVDEV_MINOR_BASE 64
#define EVDEV_MINORS 32 #define EVDEV_MINORS 32
#define EVDEV_MIN_BUFFER_SIZE 64U #define EVDEV_MIN_BUFFER_SIZE 64U
...@@ -522,12 +524,11 @@ static int handle_eviocgbit(struct input_dev *dev, ...@@ -522,12 +524,11 @@ static int handle_eviocgbit(struct input_dev *dev,
if (type == EV_KEY && size == OLD_KEY_MAX) { if (type == EV_KEY && size == OLD_KEY_MAX) {
len = OLD_KEY_MAX; len = OLD_KEY_MAX;
if (printk_timed_ratelimit(&keymax_warn_time, 10 * 1000)) if (printk_timed_ratelimit(&keymax_warn_time, 10 * 1000))
printk(KERN_WARNING pr_warning("(EVIOCGBIT): Suspicious buffer size %u, "
"evdev.c(EVIOCGBIT): Suspicious buffer size %u, " "limiting output to %zu bytes. See "
"limiting output to %zu bytes. See " "http://userweb.kernel.org/~dtor/eviocgbit-bug.html\n",
"http://userweb.kernel.org/~dtor/eviocgbit-bug.html\n", OLD_KEY_MAX,
OLD_KEY_MAX, BITS_TO_LONGS(OLD_KEY_MAX) * sizeof(long));
BITS_TO_LONGS(OLD_KEY_MAX) * sizeof(long));
} }
return bits_to_user(bits, len, size, p, compat_mode); return bits_to_user(bits, len, size, p, compat_mode);
...@@ -894,7 +895,7 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev, ...@@ -894,7 +895,7 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev,
break; break;
if (minor == EVDEV_MINORS) { if (minor == EVDEV_MINORS) {
printk(KERN_ERR "evdev: no more free evdev devices\n"); pr_err("no more free evdev devices\n");
return -ENFILE; return -ENFILE;
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
/* #define DEBUG */ /* #define DEBUG */
#define debug(format, arg...) pr_debug("ff-core: " format "\n", ## arg) #define pr_fmt(fmt) KBUILD_BASENAME ": " fmt
#include <linux/input.h> #include <linux/input.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -116,7 +116,7 @@ int input_ff_upload(struct input_dev *dev, struct ff_effect *effect, ...@@ -116,7 +116,7 @@ int input_ff_upload(struct input_dev *dev, struct ff_effect *effect,
if (effect->type < FF_EFFECT_MIN || effect->type > FF_EFFECT_MAX || if (effect->type < FF_EFFECT_MIN || effect->type > FF_EFFECT_MAX ||
!test_bit(effect->type, dev->ffbit)) { !test_bit(effect->type, dev->ffbit)) {
debug("invalid or not supported effect type in upload"); pr_debug("invalid or not supported effect type in upload\n");
return -EINVAL; return -EINVAL;
} }
...@@ -124,7 +124,7 @@ int input_ff_upload(struct input_dev *dev, struct ff_effect *effect, ...@@ -124,7 +124,7 @@ int input_ff_upload(struct input_dev *dev, struct ff_effect *effect,
(effect->u.periodic.waveform < FF_WAVEFORM_MIN || (effect->u.periodic.waveform < FF_WAVEFORM_MIN ||
effect->u.periodic.waveform > FF_WAVEFORM_MAX || effect->u.periodic.waveform > FF_WAVEFORM_MAX ||
!test_bit(effect->u.periodic.waveform, dev->ffbit))) { !test_bit(effect->u.periodic.waveform, dev->ffbit))) {
debug("invalid or not supported wave form in upload"); pr_debug("invalid or not supported wave form in upload\n");
return -EINVAL; return -EINVAL;
} }
...@@ -246,7 +246,7 @@ static int flush_effects(struct input_dev *dev, struct file *file) ...@@ -246,7 +246,7 @@ static int flush_effects(struct input_dev *dev, struct file *file)
struct ff_device *ff = dev->ff; struct ff_device *ff = dev->ff;
int i; int i;
debug("flushing now"); pr_debug("flushing now\n");
mutex_lock(&ff->mutex); mutex_lock(&ff->mutex);
...@@ -315,8 +315,7 @@ int input_ff_create(struct input_dev *dev, int max_effects) ...@@ -315,8 +315,7 @@ int input_ff_create(struct input_dev *dev, int max_effects)
int i; int i;
if (!max_effects) { if (!max_effects) {
printk(KERN_ERR pr_err("cannot allocate device without any effects\n");
"ff-core: cannot allocate device without any effects\n");
return -EINVAL; return -EINVAL;
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
/* #define DEBUG */ /* #define DEBUG */
#define debug(format, arg...) pr_debug("ff-memless: " format "\n", ## arg) #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/input.h> #include <linux/input.h>
...@@ -129,7 +129,7 @@ static void ml_schedule_timer(struct ml_device *ml) ...@@ -129,7 +129,7 @@ static void ml_schedule_timer(struct ml_device *ml)
int events = 0; int events = 0;
int i; int i;
debug("calculating next timer"); pr_debug("calculating next timer\n");
for (i = 0; i < FF_MEMLESS_EFFECTS; i++) { for (i = 0; i < FF_MEMLESS_EFFECTS; i++) {
...@@ -149,10 +149,10 @@ static void ml_schedule_timer(struct ml_device *ml) ...@@ -149,10 +149,10 @@ static void ml_schedule_timer(struct ml_device *ml)
} }
if (!events) { if (!events) {
debug("no actions"); pr_debug("no actions\n");
del_timer(&ml->timer); del_timer(&ml->timer);
} else { } else {
debug("timer set"); pr_debug("timer set\n");
mod_timer(&ml->timer, earliest); mod_timer(&ml->timer, earliest);
} }
} }
...@@ -173,8 +173,8 @@ static int apply_envelope(struct ml_effect_state *state, int value, ...@@ -173,8 +173,8 @@ static int apply_envelope(struct ml_effect_state *state, int value,
if (envelope->attack_length && if (envelope->attack_length &&
time_before(now, time_before(now,
state->play_at + msecs_to_jiffies(envelope->attack_length))) { state->play_at + msecs_to_jiffies(envelope->attack_length))) {
debug("value = 0x%x, attack_level = 0x%x", value, pr_debug("value = 0x%x, attack_level = 0x%x\n",
envelope->attack_level); value, envelope->attack_level);
time_from_level = jiffies_to_msecs(now - state->play_at); time_from_level = jiffies_to_msecs(now - state->play_at);
time_of_envelope = envelope->attack_length; time_of_envelope = envelope->attack_length;
envelope_level = min_t(__s16, envelope->attack_level, 0x7fff); envelope_level = min_t(__s16, envelope->attack_level, 0x7fff);
...@@ -191,13 +191,13 @@ static int apply_envelope(struct ml_effect_state *state, int value, ...@@ -191,13 +191,13 @@ static int apply_envelope(struct ml_effect_state *state, int value,
difference = abs(value) - envelope_level; difference = abs(value) - envelope_level;
debug("difference = %d", difference); pr_debug("difference = %d\n", difference);
debug("time_from_level = 0x%x", time_from_level); pr_debug("time_from_level = 0x%x\n", time_from_level);
debug("time_of_envelope = 0x%x", time_of_envelope); pr_debug("time_of_envelope = 0x%x\n", time_of_envelope);
difference = difference * time_from_level / time_of_envelope; difference = difference * time_from_level / time_of_envelope;
debug("difference = %d", difference); pr_debug("difference = %d\n", difference);
return value < 0 ? return value < 0 ?
-(difference + envelope_level) : (difference + envelope_level); -(difference + envelope_level) : (difference + envelope_level);
...@@ -215,8 +215,7 @@ static int get_compatible_type(struct ff_device *ff, int effect_type) ...@@ -215,8 +215,7 @@ static int get_compatible_type(struct ff_device *ff, int effect_type)
if (effect_type == FF_PERIODIC && test_bit(FF_RUMBLE, ff->ffbit)) if (effect_type == FF_PERIODIC && test_bit(FF_RUMBLE, ff->ffbit))
return FF_RUMBLE; return FF_RUMBLE;
printk(KERN_ERR pr_err("invalid type in get_compatible_type()\n");
"ff-memless: invalid type in get_compatible_type()\n");
return 0; return 0;
} }
...@@ -312,7 +311,7 @@ static void ml_combine_effects(struct ff_effect *effect, ...@@ -312,7 +311,7 @@ static void ml_combine_effects(struct ff_effect *effect,
break; break;
default: default:
printk(KERN_ERR "ff-memless: invalid type in ml_combine_effects()\n"); pr_err("invalid type in ml_combine_effects()\n");
break; break;
} }
...@@ -406,7 +405,7 @@ static void ml_effect_timer(unsigned long timer_data) ...@@ -406,7 +405,7 @@ static void ml_effect_timer(unsigned long timer_data)
struct ml_device *ml = dev->ff->private; struct ml_device *ml = dev->ff->private;
unsigned long flags; unsigned long flags;
debug("timer: updating effects"); pr_debug("timer: updating effects\n");
spin_lock_irqsave(&dev->event_lock, flags); spin_lock_irqsave(&dev->event_lock, flags);
ml_play_effects(ml); ml_play_effects(ml);
...@@ -438,7 +437,7 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value) ...@@ -438,7 +437,7 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value)
struct ml_effect_state *state = &ml->states[effect_id]; struct ml_effect_state *state = &ml->states[effect_id];
if (value > 0) { if (value > 0) {
debug("initiated play"); pr_debug("initiated play\n");
__set_bit(FF_EFFECT_STARTED, &state->flags); __set_bit(FF_EFFECT_STARTED, &state->flags);
state->count = value; state->count = value;
...@@ -449,7 +448,7 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value) ...@@ -449,7 +448,7 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value)
state->adj_at = state->play_at; state->adj_at = state->play_at;
} else { } else {
debug("initiated stop"); pr_debug("initiated stop\n");
if (test_bit(FF_EFFECT_PLAYING, &state->flags)) if (test_bit(FF_EFFECT_PLAYING, &state->flags))
__set_bit(FF_EFFECT_ABORTING, &state->flags); __set_bit(FF_EFFECT_ABORTING, &state->flags);
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
* the Free Software Foundation. * the Free Software Foundation.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/mutex.h> #include <linux/mutex.h>
...@@ -33,8 +35,7 @@ static int input_polldev_start_workqueue(void) ...@@ -33,8 +35,7 @@ static int input_polldev_start_workqueue(void)
if (!polldev_users) { if (!polldev_users) {
polldev_wq = create_singlethread_workqueue("ipolldevd"); polldev_wq = create_singlethread_workqueue("ipolldevd");
if (!polldev_wq) { if (!polldev_wq) {
printk(KERN_ERR "input-polldev: failed to create " pr_err("failed to create ipolldevd workqueue\n");
"ipolldevd workqueue\n");
retval = -ENOMEM; retval = -ENOMEM;
goto out; goto out;
} }
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
* the Free Software Foundation. * the Free Software Foundation.
*/ */
#define pr_fmt(fmt) KBUILD_BASENAME ": " fmt
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/input.h> #include <linux/input.h>
...@@ -959,10 +961,8 @@ static int input_attach_handler(struct input_dev *dev, struct input_handler *han ...@@ -959,10 +961,8 @@ static int input_attach_handler(struct input_dev *dev, struct input_handler *han
error = handler->connect(handler, dev, id); error = handler->connect(handler, dev, id);
if (error && error != -ENODEV) if (error && error != -ENODEV)
printk(KERN_ERR pr_err("failed to attach handler %s to device %s, error: %d\n",
"input: failed to attach handler %s to device %s, " handler->name, kobject_name(&dev->dev.kobj), error);
"error: %d\n",
handler->name, kobject_name(&dev->dev.kobj), error);
return error; return error;
} }
...@@ -1820,9 +1820,8 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int ...@@ -1820,9 +1820,8 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int
break; break;
default: default:
printk(KERN_ERR pr_err("input_set_capability: unknown type %u (code %u)\n",
"input_set_capability: unknown type %u (code %u)\n", type, code);
type, code);
dump_stack(); dump_stack();
return; return;
} }
...@@ -1904,8 +1903,9 @@ int input_register_device(struct input_dev *dev) ...@@ -1904,8 +1903,9 @@ int input_register_device(struct input_dev *dev)
return error; return error;
path = kobject_get_path(&dev->dev.kobj, GFP_KERNEL); path = kobject_get_path(&dev->dev.kobj, GFP_KERNEL);
printk(KERN_INFO "input: %s as %s\n", pr_info("%s as %s\n",
dev->name ? dev->name : "Unspecified device", path ? path : "N/A"); dev->name ? dev->name : "Unspecified device",
path ? path : "N/A");
kfree(path); kfree(path);
error = mutex_lock_interruptible(&input_mutex); error = mutex_lock_interruptible(&input_mutex);
...@@ -2187,7 +2187,7 @@ static int __init input_init(void) ...@@ -2187,7 +2187,7 @@ static int __init input_init(void)
err = class_register(&input_class); err = class_register(&input_class);
if (err) { if (err) {
printk(KERN_ERR "input: unable to register input_dev class\n"); pr_err("unable to register input_dev class\n");
return err; return err;
} }
...@@ -2197,7 +2197,7 @@ static int __init input_init(void) ...@@ -2197,7 +2197,7 @@ static int __init input_init(void)
err = register_chrdev(INPUT_MAJOR, "input", &input_fops); err = register_chrdev(INPUT_MAJOR, "input", &input_fops);
if (err) { if (err) {
printk(KERN_ERR "input: unable to register char major %d", INPUT_MAJOR); pr_err("unable to register char major %d", INPUT_MAJOR);
goto fail2; goto fail2;
} }
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
* (at your option) any later version. * (at your option) any later version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <asm/io.h> #include <asm/io.h>
#include <asm/system.h> #include <asm/system.h>
#include <linux/delay.h> #include <linux/delay.h>
...@@ -806,7 +808,7 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev, ...@@ -806,7 +808,7 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev,
break; break;
if (minor == JOYDEV_MINORS) { if (minor == JOYDEV_MINORS) {
printk(KERN_ERR "joydev: no more free joydev devices\n"); pr_err("no more free joydev devices\n");
return -ENFILE; return -ENFILE;
} }
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* the Free Software Foundation. * the Free Software Foundation.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#define MOUSEDEV_MINOR_BASE 32 #define MOUSEDEV_MINOR_BASE 32
#define MOUSEDEV_MINORS 32 #define MOUSEDEV_MINORS 32
#define MOUSEDEV_MIX 31 #define MOUSEDEV_MIX 31
...@@ -977,7 +979,7 @@ static int mousedev_connect(struct input_handler *handler, ...@@ -977,7 +979,7 @@ static int mousedev_connect(struct input_handler *handler,
break; break;
if (minor == MOUSEDEV_MINORS) { if (minor == MOUSEDEV_MINORS) {
printk(KERN_ERR "mousedev: no more free mousedev devices\n"); pr_err("no more free mousedev devices\n");
return -ENFILE; return -ENFILE;
} }
...@@ -1087,13 +1089,13 @@ static int __init mousedev_init(void) ...@@ -1087,13 +1089,13 @@ static int __init mousedev_init(void)
#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
error = misc_register(&psaux_mouse); error = misc_register(&psaux_mouse);
if (error) if (error)
printk(KERN_WARNING "mice: could not register psaux device, " pr_warning("could not register psaux device, error: %d\n",
"error: %d\n", error); error);
else else
psaux_registered = 1; psaux_registered = 1;
#endif #endif
printk(KERN_INFO "mice: PS/2 mouse device common for all mice\n"); pr_info("PS/2 mouse device common for all mice\n");
return 0; return 0;
} }
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
* Switch to grant tables together with xen-fbfront.c. * Switch to grant tables together with xen-fbfront.c.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -84,9 +86,8 @@ static irqreturn_t input_handler(int rq, void *dev_id) ...@@ -84,9 +86,8 @@ static irqreturn_t input_handler(int rq, void *dev_id)
input_report_key(dev, event->key.keycode, input_report_key(dev, event->key.keycode,
event->key.pressed); event->key.pressed);
else else
printk(KERN_WARNING pr_warning("unhandled keycode 0x%x\n",
"xenkbd: unhandled keycode 0x%x\n", event->key.keycode);
event->key.keycode);
break; break;
case XENKBD_TYPE_POS: case XENKBD_TYPE_POS:
input_report_abs(dev, ABS_X, event->pos.abs_x); input_report_abs(dev, ABS_X, event->pos.abs_x);
...@@ -292,8 +293,7 @@ static void xenkbd_backend_changed(struct xenbus_device *dev, ...@@ -292,8 +293,7 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
ret = xenbus_printf(XBT_NIL, info->xbdev->nodename, ret = xenbus_printf(XBT_NIL, info->xbdev->nodename,
"request-abs-pointer", "1"); "request-abs-pointer", "1");
if (ret) if (ret)
printk(KERN_WARNING pr_warning("can't request abs-pointer\n");
"xenkbd: can't request abs-pointer");
} }
xenbus_switch_state(dev, XenbusStateConnected); xenbus_switch_state(dev, XenbusStateConnected);
break; break;
......
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