From 1817b1692a2eab022e805d32e910f4556c89dce8 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 14 Aug 2008 09:37:34 -0700 Subject: [PATCH] USB: remove warn() macro from usb input drivers USB should not be having it's own printk macros, so remove warn() and use the system-wide standard of dev_warn() wherever possible. In the few places that will not work out, use a basic printk(). Cc: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/joystick/iforce/iforce-ff.c | 36 ++++++++++++------- drivers/input/joystick/iforce/iforce-main.c | 14 ++++---- .../input/joystick/iforce/iforce-packets.c | 8 +++-- drivers/input/joystick/iforce/iforce-usb.c | 2 +- drivers/input/misc/ati_remote.c | 14 ++++---- drivers/input/tablet/aiptek.c | 13 ++++--- 6 files changed, 52 insertions(+), 35 deletions(-) diff --git a/drivers/input/joystick/iforce/iforce-ff.c b/drivers/input/joystick/iforce/iforce-ff.c index 7839b7b6fa96..0de9a0943a9e 100644 --- a/drivers/input/joystick/iforce/iforce-ff.c +++ b/drivers/input/joystick/iforce/iforce-ff.c @@ -197,13 +197,16 @@ static unsigned char find_button(struct iforce *iforce, signed short button) * Analyse the changes in an effect, and tell if we need to send an condition * parameter packet */ -static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new) +static int need_condition_modifier(struct iforce *iforce, + struct ff_effect *old, + struct ff_effect *new) { int ret = 0; int i; if (new->type != FF_SPRING && new->type != FF_FRICTION) { - warn("bad effect type in need_condition_modifier"); + dev_warn(&iforce->dev->dev, "bad effect type in %s\n", + __func__); return 0; } @@ -222,10 +225,13 @@ static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new) * Analyse the changes in an effect, and tell if we need to send a magnitude * parameter packet */ -static int need_magnitude_modifier(struct ff_effect *old, struct ff_effect *effect) +static int need_magnitude_modifier(struct iforce *iforce, + struct ff_effect *old, + struct ff_effect *effect) { if (effect->type != FF_CONSTANT) { - warn("bad effect type in need_envelope_modifier"); + dev_warn(&iforce->dev->dev, "bad effect type in %s\n", + __func__); return 0; } @@ -236,7 +242,8 @@ static int need_magnitude_modifier(struct ff_effect *old, struct ff_effect *effe * Analyse the changes in an effect, and tell if we need to send an envelope * parameter packet */ -static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effect) +static int need_envelope_modifier(struct iforce *iforce, struct ff_effect *old, + struct ff_effect *effect) { switch (effect->type) { case FF_CONSTANT: @@ -256,7 +263,8 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec break; default: - warn("bad effect type in need_envelope_modifier"); + dev_warn(&iforce->dev->dev, "bad effect type in %s\n", + __func__); } return 0; @@ -266,10 +274,12 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec * Analyse the changes in an effect, and tell if we need to send a periodic * parameter effect */ -static int need_period_modifier(struct ff_effect *old, struct ff_effect *new) +static int need_period_modifier(struct iforce *iforce, struct ff_effect *old, + struct ff_effect *new) { if (new->type != FF_PERIODIC) { - warn("bad effect type in need_period_modifier"); + dev_warn(&iforce->dev->dev, "bad effect type in %s\n", + __func__); return 0; } return (old->u.periodic.period != new->u.periodic.period @@ -355,7 +365,7 @@ int iforce_upload_periodic(struct iforce *iforce, struct ff_effect *effect, stru int param2_err = 1; int core_err = 0; - if (!old || need_period_modifier(old, effect)) { + if (!old || need_period_modifier(iforce, old, effect)) { param1_err = make_period_modifier(iforce, mod1_chunk, old != NULL, effect->u.periodic.magnitude, effect->u.periodic.offset, @@ -365,7 +375,7 @@ int iforce_upload_periodic(struct iforce *iforce, struct ff_effect *effect, stru set_bit(FF_MOD1_IS_USED, core_effect->flags); } - if (!old || need_envelope_modifier(old, effect)) { + if (!old || need_envelope_modifier(iforce, old, effect)) { param2_err = make_envelope_modifier(iforce, mod2_chunk, old !=NULL, effect->u.periodic.envelope.attack_length, @@ -425,7 +435,7 @@ int iforce_upload_constant(struct iforce *iforce, struct ff_effect *effect, stru int param2_err = 1; int core_err = 0; - if (!old || need_magnitude_modifier(old, effect)) { + if (!old || need_magnitude_modifier(iforce, old, effect)) { param1_err = make_magnitude_modifier(iforce, mod1_chunk, old != NULL, effect->u.constant.level); @@ -434,7 +444,7 @@ int iforce_upload_constant(struct iforce *iforce, struct ff_effect *effect, stru set_bit(FF_MOD1_IS_USED, core_effect->flags); } - if (!old || need_envelope_modifier(old, effect)) { + if (!old || need_envelope_modifier(iforce, old, effect)) { param2_err = make_envelope_modifier(iforce, mod2_chunk, old != NULL, effect->u.constant.envelope.attack_length, @@ -487,7 +497,7 @@ int iforce_upload_condition(struct iforce *iforce, struct ff_effect *effect, str default: return -1; } - if (!old || need_condition_modifier(old, effect)) { + if (!old || need_condition_modifier(iforce, old, effect)) { param_err = make_condition_modifier(iforce, mod1_chunk, old != NULL, effect->u.condition[0].right_saturation, diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c index 61ee6e38739d..baabf8302645 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c @@ -218,7 +218,9 @@ static void iforce_release(struct input_dev *dev) /* Check: no effects should be present in memory */ for (i = 0; i < dev->ff->max_effects; i++) { if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags)) { - warn("iforce_release: Device still owns effects"); + dev_warn(&dev->dev, + "%s: Device still owns effects\n", + __func__); break; } } @@ -335,26 +337,26 @@ int iforce_init_device(struct iforce *iforce) if (!iforce_get_id_packet(iforce, "M")) input_dev->id.vendor = (iforce->edata[2] << 8) | iforce->edata[1]; else - warn("Device does not respond to id packet M"); + dev_warn(&iforce->dev->dev, "Device does not respond to id packet M\n"); if (!iforce_get_id_packet(iforce, "P")) input_dev->id.product = (iforce->edata[2] << 8) | iforce->edata[1]; else - warn("Device does not respond to id packet P"); + dev_warn(&iforce->dev->dev, "Device does not respond to id packet P\n"); if (!iforce_get_id_packet(iforce, "B")) iforce->device_memory.end = (iforce->edata[2] << 8) | iforce->edata[1]; else - warn("Device does not respond to id packet B"); + dev_warn(&iforce->dev->dev, "Device does not respond to id packet B\n"); if (!iforce_get_id_packet(iforce, "N")) ff_effects = iforce->edata[1]; else - warn("Device does not respond to id packet N"); + dev_warn(&iforce->dev->dev, "Device does not respond to id packet N\n"); /* Check if the device can store more effects than the driver can really handle */ if (ff_effects > IFORCE_EFFECTS_MAX) { - warn("Limiting number of effects to %d (device reports %d)", + dev_warn(&iforce->dev->dev, "Limiting number of effects to %d (device reports %d)\n", IFORCE_EFFECTS_MAX, ff_effects); ff_effects = IFORCE_EFFECTS_MAX; } diff --git a/drivers/input/joystick/iforce/iforce-packets.c b/drivers/input/joystick/iforce/iforce-packets.c index 015b50aa76fc..a17b50016009 100644 --- a/drivers/input/joystick/iforce/iforce-packets.c +++ b/drivers/input/joystick/iforce/iforce-packets.c @@ -65,7 +65,8 @@ int iforce_send_packet(struct iforce *iforce, u16 cmd, unsigned char* data) if (CIRC_SPACE(head, tail, XMIT_SIZE) < n+2) { - warn("not enough space in xmit buffer to send new packet"); + dev_warn(&iforce->dev->dev, + "not enough space in xmit buffer to send new packet\n"); spin_unlock_irqrestore(&iforce->xmit_lock, flags); return -1; } @@ -148,7 +149,7 @@ static int mark_core_as_ready(struct iforce *iforce, unsigned short addr) return 0; } } - warn("unused effect %04x updated !!!", addr); + dev_warn(&iforce->dev->dev, "unused effect %04x updated !!!\n", addr); return -1; } @@ -159,7 +160,8 @@ void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data) static int being_used = 0; if (being_used) - warn("re-entrant call to iforce_process %d", being_used); + dev_warn(&iforce->dev->dev, + "re-entrant call to iforce_process %d\n", being_used); being_used++; #ifdef CONFIG_JOYSTICK_IFORCE_232 diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c index 851cc4087c2f..f83185aeb511 100644 --- a/drivers/input/joystick/iforce/iforce-usb.c +++ b/drivers/input/joystick/iforce/iforce-usb.c @@ -64,7 +64,7 @@ void iforce_usb_xmit(struct iforce *iforce) if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) { clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); - warn("usb_submit_urb failed %d\n", n); + dev_warn(&iforce->dev->dev, "usb_submit_urb failed %d\n", n); } /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended. diff --git a/drivers/input/misc/ati_remote.c b/drivers/input/misc/ati_remote.c index debfc1af9d95..428ecd3294a3 100644 --- a/drivers/input/misc/ati_remote.c +++ b/drivers/input/misc/ati_remote.c @@ -285,7 +285,6 @@ static const struct { }; /* Local function prototypes */ -static void ati_remote_dump (unsigned char *data, unsigned int actual_length); static int ati_remote_open (struct input_dev *inputdev); static void ati_remote_close (struct input_dev *inputdev); static int ati_remote_sendpacket (struct ati_remote *ati_remote, u16 cmd, unsigned char *data); @@ -307,15 +306,16 @@ static struct usb_driver ati_remote_driver = { /* * ati_remote_dump_input */ -static void ati_remote_dump(unsigned char *data, unsigned int len) +static void ati_remote_dump(struct device *dev, unsigned char *data, + unsigned int len) { if ((len == 1) && (data[0] != (unsigned char)0xff) && (data[0] != 0x00)) - warn("Weird byte 0x%02x", data[0]); + dev_warn(dev, "Weird byte 0x%02x\n", data[0]); else if (len == 4) - warn("Weird key %02x %02x %02x %02x", + dev_warn(dev, "Weird key %02x %02x %02x %02x\n", data[0], data[1], data[2], data[3]); else - warn("Weird data, len=%d %02x %02x %02x %02x %02x %02x ...", + dev_warn(dev, "Weird data, len=%d %02x %02x %02x %02x %02x %02x ...\n", len, data[0], data[1], data[2], data[3], data[4], data[5]); } @@ -470,7 +470,7 @@ static void ati_remote_input_report(struct urb *urb) /* Deal with strange looking inputs */ if ( (urb->actual_length != 4) || (data[0] != 0x14) || ((data[3] & 0x0f) != 0x00) ) { - ati_remote_dump(data, urb->actual_length); + ati_remote_dump(&urb->dev->dev, data, urb->actual_length); return; } @@ -814,7 +814,7 @@ static void ati_remote_disconnect(struct usb_interface *interface) ati_remote = usb_get_intfdata(interface); usb_set_intfdata(interface, NULL); if (!ati_remote) { - warn("%s - null device?\n", __func__); + dev_warn(&interface->dev, "%s - null device?\n", __func__); return; } diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c index e53c838f1866..1aa82e8af614 100644 --- a/drivers/input/tablet/aiptek.c +++ b/drivers/input/tablet/aiptek.c @@ -1706,20 +1706,21 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) aiptek = kzalloc(sizeof(struct aiptek), GFP_KERNEL); inputdev = input_allocate_device(); if (!aiptek || !inputdev) { - warn("aiptek: cannot allocate memory or input device"); + dev_warn(&intf->dev, + "cannot allocate memory or input device\n"); goto fail1; } aiptek->data = usb_buffer_alloc(usbdev, AIPTEK_PACKET_LENGTH, GFP_ATOMIC, &aiptek->data_dma); if (!aiptek->data) { - warn("aiptek: cannot allocate usb buffer"); + dev_warn(&intf->dev, "cannot allocate usb buffer\n"); goto fail1; } aiptek->urb = usb_alloc_urb(0, GFP_KERNEL); if (!aiptek->urb) { - warn("aiptek: cannot allocate urb"); + dev_warn(&intf->dev, "cannot allocate urb\n"); goto fail2; } @@ -1864,7 +1865,8 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) */ err = sysfs_create_group(&intf->dev.kobj, &aiptek_attribute_group); if (err) { - warn("aiptek: cannot create sysfs group err: %d", err); + dev_warn(&intf->dev, "cannot create sysfs group err: %d\n", + err); goto fail3; } @@ -1872,7 +1874,8 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) */ err = input_register_device(aiptek->inputdev); if (err) { - warn("aiptek: input_register_device returned err: %d", err); + dev_warn(&intf->dev, + "input_register_device returned err: %d\n", err); goto fail4; } return 0; -- 2.20.1