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 <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Greg Kroah-Hartman 2008-08-14 09:37:34 -07:00
parent 15d5a9acb1
commit 1817b1692a
6 changed files with 52 additions and 35 deletions

View File

@ -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,

View File

@ -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;
}

View File

@ -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

View File

@ -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.

View File

@ -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;
}

View File

@ -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;