Staging: line6: fix checkpatch errors in pod.c

2 errors left, but they are minor.
Lots of warnings also fixed up.

Cc: Markus Grabner <grabner@icg.tugraz.at>
Cc: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Greg Kroah-Hartman 2009-02-27 22:41:29 -08:00
parent 010f378e8c
commit 0fdef36aca
1 changed files with 115 additions and 91 deletions

View File

@ -156,8 +156,7 @@ static void pod_startup_timeout(unsigned long arg)
if (pod->dumpreq.ok) {
if (!pod->versionreq_ok)
request = REQUEST_VERSION;
}
else {
} else {
if (pod->versionreq_ok)
request = REQUEST_DUMP;
else if (pod->startup_count++ & 1)
@ -194,8 +193,11 @@ static void pod_dump(struct usb_line6_pod *pod, const unsigned char *data)
{
int size = 1 + sizeof(pod->prog_data);
char *sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_DUMP, size);
if(!sysex) return;
sysex[SYSEX_DATA_OFS] = 5; /* Don't know what this is good for, but PODxt Pro transmits it, so we also do... */
if (!sysex)
return;
/* Don't know what this is good for, but PODxt Pro transmits it, so we
* also do... */
sysex[SYSEX_DATA_OFS] = 5;
memcpy(sysex + SYSEX_DATA_OFS + 1, data, sizeof(pod->prog_data));
line6_send_sysex_message(&pod->line6, sysex, size);
memcpy(&pod->prog_data, data, sizeof(pod->prog_data));
@ -247,7 +249,9 @@ void pod_process_message(struct usb_line6_pod *pod)
/* intentionally no break here! */
case LINE6_PARAM_CHANGE | LINE6_CHANNEL_HOST:
if((buf[1] == POD_amp_model_setup) || (buf[1] == POD_effect_setup)) /* these also affect other settings */
if ((buf[1] == POD_amp_model_setup) ||
(buf[1] == POD_effect_setup))
/* these also affect other settings */
line6_dump_request_async(&pod->dumpreq, &pod->line6, 0);
break;
@ -282,8 +286,7 @@ void pod_process_message(struct usb_line6_pod *pod)
}
line6_dump_finished(&pod->dumpreq);
}
else
} else
DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "wrong size of channel dump message (%d instead of %d)\n",
pod->line6.message_length, (int)sizeof(pod->prog_data) + 7));
@ -336,8 +339,7 @@ void pod_process_message(struct usb_line6_pod *pod)
default:
DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "unknown sysex message %02X\n", buf[5]));
}
}
else if(memcmp(buf, pod_version_header, sizeof(pod_version_header)) == 0) {
} else if (memcmp(buf, pod_version_header, sizeof(pod_version_header)) == 0) {
if (pod->versionreq_ok == 0) {
pod->firmware_version = buf[13] * 100 + buf[14] * 10 + buf[15];
pod->device_id = ((int)buf[8] << 16) | ((int)buf[9] << 8) | (int)buf[10];
@ -347,11 +349,9 @@ void pod_process_message(struct usb_line6_pod *pod)
handler to create the special files: */
INIT_WORK(&pod->create_files_work, pod_create_files_work);
queue_work(line6_workqueue, &pod->create_files_work);
}
else
} else
DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "multiple firmware version message\n"));
}
else
} else
DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "unknown sysex header\n"));
break;
@ -386,8 +386,7 @@ void pod_midi_postprocess(struct usb_line6_pod *pod, unsigned char *data, int le
if (data[i] == (LINE6_PROGRAM_CHANGE | LINE6_CHANNEL_HOST)) {
line6_invalidate_current(&pod->dumpreq);
break;
}
else if((data[i] == (LINE6_PARAM_CHANGE | LINE6_CHANNEL_HOST)) && (i < length - 1))
} else if ((data[i] == (LINE6_PARAM_CHANGE | LINE6_CHANNEL_HOST)) && (i < length - 1))
if ((data[i + 1] == POD_amp_model_setup) || (data[i + 1] == POD_effect_setup)) {
line6_invalidate_current(&pod->dumpreq);
break;
@ -442,7 +441,8 @@ static ssize_t pod_send_store_command(struct device *dev, const char *buf, size_
int size = 3 + sizeof(pod->prog_data_buf);
char *sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_STORE, size);
if(!sysex) return 0;
if (!sysex)
return 0;
sysex[SYSEX_DATA_OFS] = 5; /* see pod_dump() */
pod_resolve(buf, block0, block1, sysex + SYSEX_DATA_OFS + 1);
@ -461,10 +461,11 @@ static ssize_t pod_send_retrieve_command(struct device *dev, const char *buf, si
{
struct usb_interface *interface = to_usb_interface(dev);
struct usb_line6_pod *pod = usb_get_intfdata(interface);
int size = 4;
char *sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_DUMPMEM, size);
if(!sysex) return 0;
if (!sysex)
return 0;
pod_resolve(buf, block0, block1, sysex + SYSEX_DATA_OFS);
sysex[SYSEX_DATA_OFS + 2] = 0;
@ -490,12 +491,15 @@ static ssize_t get_name_generic(struct usb_line6_pod *pod, const char *str, char
char *last_non_space = buf;
int retval = line6_wait_dump(&pod->dumpreq, 0);
if(retval < 0) return retval;
if (retval < 0)
return retval;
for (p1 = str, p2 = buf; *p1; ++p1, ++p2) {
*p2 = *p1;
if(*p2 != ' ') last_non_space = p2;
if(++length == POD_NAME_LENGTH) break;
if (*p2 != ' ')
last_non_space = p2;
if (++length == POD_NAME_LENGTH)
break;
}
*(last_non_space + 1) = '\n';
@ -558,7 +562,8 @@ static ssize_t pod_get_dump(struct device *dev, struct device_attribute *attr,
struct usb_interface *interface = to_usb_interface(dev);
struct usb_line6_pod *pod = usb_get_intfdata(interface);
int retval = line6_wait_dump(&pod->dumpreq, 0);
if(retval < 0) return retval;
if (retval < 0)
return retval;
memcpy(buf, &pod->prog_data, sizeof(pod->prog_data));
return sizeof(pod->prog_data);
}
@ -601,7 +606,8 @@ static ssize_t pod_get_system_param(struct usb_line6_pod *pod, char *buf, int co
/* send value request to tuner: */
param->value = POD_system_invalid;
sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_SYSTEMREQ, size);
if(!sysex) return 0;
if (!sysex)
return 0;
sysex[SYSEX_DATA_OFS] = code;
line6_send_sysex_message(&pod->line6, sysex, size);
kfree(sysex);
@ -614,8 +620,7 @@ static ssize_t pod_get_system_param(struct usb_line6_pod *pod, char *buf, int co
if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
else
} else
schedule();
}
@ -633,7 +638,9 @@ static ssize_t pod_get_system_param(struct usb_line6_pod *pod, char *buf, int co
Send system parameter.
@param tuner non-zero, if code refers to a tuner parameter
*/
static ssize_t pod_set_system_param(struct usb_line6_pod *pod, const char *buf, int count, int code, unsigned short mask, int tuner)
static ssize_t pod_set_system_param(struct usb_line6_pod *pod, const char *buf,
int count, int code, unsigned short mask,
int tuner)
{
char *sysex;
static const int size = 5;
@ -644,7 +651,8 @@ static ssize_t pod_set_system_param(struct usb_line6_pod *pod, const char *buf,
/* send value to tuner: */
sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_SYSTEM, size);
if(!sysex) return 0;
if (!sysex)
return 0;
value = simple_strtoul(buf, NULL, 10) & mask;
sysex[SYSEX_DATA_OFS] = code;
sysex[SYSEX_DATA_OFS + 1] = (value >> 12) & 0x0f;
@ -665,7 +673,8 @@ static ssize_t pod_get_dump_buf(struct device *dev,
struct usb_interface *interface = to_usb_interface(dev);
struct usb_line6_pod *pod = usb_get_intfdata(interface);
int retval = line6_wait_dump(&pod->dumpreq, 0);
if(retval < 0) return retval;
if (retval < 0)
return retval;
memcpy(buf, &pod->prog_data_buf, sizeof(pod->prog_data_buf));
return sizeof(pod->prog_data_buf);
}
@ -702,7 +711,8 @@ static ssize_t pod_set_finish(struct device *dev,
struct usb_line6_pod *pod = usb_get_intfdata(interface);
int size = 0;
char *sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_FINISH, size);
if(!sysex) return 0;
if (!sysex)
return 0;
line6_send_sysex_message(&pod->line6, sysex, size);
kfree(sysex);
return count;
@ -827,7 +837,8 @@ static ssize_t pod_get_firmware_version(struct device *dev,
{
struct usb_interface *interface = to_usb_interface(dev);
struct usb_line6_pod *pod = usb_get_intfdata(interface);
return sprintf(buf, "%d.%02d\n", pod->firmware_version / 100, pod->firmware_version % 100);
return sprintf(buf, "%d.%02d\n", pod->firmware_version / 100,
pod->firmware_version % 100);
}
/*
@ -859,8 +870,7 @@ static ssize_t pod_wait_for_clip(struct device *dev,
if (signal_pending(current)) {
err = -ERESTARTSYS;
break;
}
else
} else
schedule();
}
@ -875,18 +885,20 @@ static ssize_t pod_get_ ## code(struct device *dev, \
{ \
struct usb_interface *interface = to_usb_interface(dev); \
struct usb_line6_pod *pod = usb_get_intfdata(interface); \
return pod_get_system_param(pod, buf, POD_ ## code, &pod->code, tuner, sign); \
return pod_get_system_param(pod, buf, POD_ ## code, &pod->code, \
tuner, sign); \
}
#define POD_GET_SET_SYSTEM_PARAM(code, mask, tuner, sign) \
POD_GET_SYSTEM_PARAM(code, tuner, sign) \
static ssize_t pod_set_ ## code(struct device *dev, \
struct device_attribute *attr, const char *buf, \
size_t count) \
struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
struct usb_interface *interface = to_usb_interface(dev); \
struct usb_line6_pod *pod = usb_get_intfdata(interface); \
return pod_set_system_param(pod, buf, count, POD_ ## code, mask, tuner); \
return pod_set_system_param(pod, buf, count, POD_ ## code, mask, \
tuner); \
}
POD_GET_SET_SYSTEM_PARAM(monitor_level, 0xffff, 0, 0);
@ -937,15 +949,17 @@ static void pod_destruct(struct usb_interface *interface)
struct usb_line6_pod *pod = usb_get_intfdata(interface);
struct usb_line6 *line6;
if(pod == NULL) return;
if (pod == NULL)
return;
line6 = &pod->line6;
if(line6 == NULL) return;
if (line6 == NULL)
return;
line6_cleanup_audio(line6);
/* free dump request data: */
line6_dumpreq_destruct(&pod->dumpreq);
if(pod->buffer_versionreq) kfree(pod->buffer_versionreq);
kfree(pod->buffer_versionreq);
}
/*
@ -995,7 +1009,8 @@ int pod_init(struct usb_interface *interface, struct usb_line6_pod *pod)
int err;
struct usb_line6 *line6 = &pod->line6;
if((interface == NULL) || (pod == NULL)) return -ENODEV;
if ((interface == NULL) || (pod == NULL))
return -ENODEV;
pod->channel_num = 255;
@ -1011,15 +1026,16 @@ int pod_init(struct usb_interface *interface, struct usb_line6_pod *pod)
memset(pod->param_dirty, 0xff, sizeof(pod->param_dirty));
/* initialize USB buffers: */
err = line6_dumpreq_init(&pod->dumpreq, pod_request_channel, sizeof(pod_request_channel));
err = line6_dumpreq_init(&pod->dumpreq, pod_request_channel,
sizeof(pod_request_channel));
if (err < 0) {
dev_err(&interface->dev, "Out of memory\n");
pod_destruct(interface);
return -ENOMEM;
}
pod->buffer_versionreq = kmalloc(sizeof(pod_request_version), GFP_KERNEL);
pod->buffer_versionreq = kmalloc(sizeof(pod_request_version),
GFP_KERNEL);
if (pod->buffer_versionreq == NULL) {
dev_err(&interface->dev, "Out of memory\n");
@ -1027,41 +1043,48 @@ int pod_init(struct usb_interface *interface, struct usb_line6_pod *pod)
return -ENOMEM;
}
memcpy(pod->buffer_versionreq, pod_request_version, sizeof(pod_request_version));
memcpy(pod->buffer_versionreq, pod_request_version,
sizeof(pod_request_version));
/* create sysfs entries: */
if((err = pod_create_files2(&interface->dev)) < 0) {
err = pod_create_files2(&interface->dev);
if (err < 0) {
pod_destruct(interface);
return err;
}
/* initialize audio system: */
if((err = line6_init_audio(line6)) < 0) {
err = line6_init_audio(line6);
if (err < 0) {
pod_destruct(interface);
return err;
}
/* initialize MIDI subsystem: */
if((err = line6_init_midi(line6)) < 0) {
err = line6_init_midi(line6);
if (err < 0) {
pod_destruct(interface);
return err;
}
/* initialize PCM subsystem: */
if((err = line6_init_pcm(line6, &pod_pcm_properties)) < 0) {
err = line6_init_pcm(line6, &pod_pcm_properties);
if (err < 0) {
pod_destruct(interface);
return err;
}
/* register audio system: */
if((err = line6_register_audio(line6)) < 0) {
err = line6_register_audio(line6);
if (err < 0) {
pod_destruct(interface);
return err;
}
if (pod->line6.properties->capabilities & LINE6_BIT_CONTROL) {
/* query some data: */
line6_startup_delayed(&pod->dumpreq, POD_STARTUP_DELAY, pod_startup_timeout, pod);
line6_startup_delayed(&pod->dumpreq, POD_STARTUP_DELAY,
pod_startup_timeout, pod);
line6_read_serial_number(&pod->line6, &pod->serial_number);
}
@ -1075,7 +1098,8 @@ void pod_disconnect(struct usb_interface *interface)
{
struct usb_line6_pod *pod;
if(interface == NULL) return;
if (interface == NULL)
return;
pod = usb_get_intfdata(interface);
if (pod != NULL) {