Commit 6353773b authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: line6: fix checkpatch errors in toneport.c

Lots of warnings also fixed up.

Cc: Markus Grabner <grabner@icg.tugraz.at>
Cc: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 68dc3dde
...@@ -75,34 +75,43 @@ static struct line6_pcm_properties toneport_pcm_properties = { ...@@ -75,34 +75,43 @@ static struct line6_pcm_properties toneport_pcm_properties = {
/* /*
For the led on Guitarport. For the led on Guitarport.
Brightness goes from 0x00 to 0x26. Set a value above this to have led blink. Brightness goes from 0x00 to 0x26. Set a value above this to have led
blink.
(void cmd_0x02(byte red, byte green) (void cmd_0x02(byte red, byte green)
*/ */
static int led_red = 0x00; static int led_red = 0x00;
static int led_green = 0x26; static int led_green = 0x26;
static void toneport_update_led(struct device *dev) { static void toneport_update_led(struct device *dev)
struct usb_interface *interface; {
struct usb_line6_toneport *tp; struct usb_interface *interface = to_usb_interface(dev);
struct usb_line6* line6; struct usb_line6_toneport *tp = usb_get_intfdata(interface);
struct usb_line6 *line6;
if ((interface = to_usb_interface(dev)) && if (!tp)
(tp = usb_get_intfdata(interface)) && return;
(line6 = &tp->line6))
toneport_send_cmd(line6->usbdev, (led_red<<8)|0x0002, led_green); // for setting the LED on Guitarport line6 = &tp->line6;
if (line6)
toneport_send_cmd(line6->usbdev, (led_red << 8) | 0x0002,
led_green);
} }
static ssize_t toneport_set_led_red(struct device *dev, static ssize_t toneport_set_led_red(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) { const char *buf, size_t count)
char* c; {
char *c;
led_red = simple_strtol(buf, &c, 10); led_red = simple_strtol(buf, &c, 10);
toneport_update_led(dev); toneport_update_led(dev);
return count; return count;
} }
static ssize_t toneport_set_led_green(struct device *dev, static ssize_t toneport_set_led_green(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) { const char *buf, size_t count)
char* c; {
char *c;
led_green = simple_strtol(buf, &c, 10); led_green = simple_strtol(buf, &c, 10);
toneport_update_led(dev); toneport_update_led(dev);
return count; return count;
...@@ -115,11 +124,12 @@ static DEVICE_ATTR(led_green, S_IWUGO | S_IRUGO, line6_nop_read, toneport_set_le ...@@ -115,11 +124,12 @@ static DEVICE_ATTR(led_green, S_IWUGO | S_IRUGO, line6_nop_read, toneport_set_le
static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2) static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2)
{ {
int ret; int ret;
ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev,0), 0x67,
ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
cmd1, cmd2, NULL, 0, LINE6_TIMEOUT * HZ); cmd1, cmd2, NULL, 0, LINE6_TIMEOUT * HZ);
if(ret < 0) { if (ret < 0) {
err("send failed (error %d)\n", ret); err("send failed (error %d)\n", ret);
return ret; return ret;
} }
...@@ -135,38 +145,44 @@ static void toneport_destruct(struct usb_interface *interface) ...@@ -135,38 +145,44 @@ static void toneport_destruct(struct usb_interface *interface)
struct usb_line6_toneport *toneport = usb_get_intfdata(interface); struct usb_line6_toneport *toneport = usb_get_intfdata(interface);
struct usb_line6 *line6; struct usb_line6 *line6;
if(toneport == NULL) return; if (toneport == NULL)
return;
line6 = &toneport->line6; line6 = &toneport->line6;
if(line6 == NULL) return; if (line6 == NULL)
return;
line6_cleanup_audio(line6); line6_cleanup_audio(line6);
} }
/* /*
Init Toneport device. Init Toneport device.
*/ */
int toneport_init(struct usb_interface *interface, struct usb_line6_toneport *toneport) int toneport_init(struct usb_interface *interface,
struct usb_line6_toneport *toneport)
{ {
int err, ticks; int err, ticks;
struct usb_line6 *line6 = &toneport->line6; struct usb_line6 *line6 = &toneport->line6;
struct usb_device *usbdev; struct usb_device *usbdev;
if((interface == NULL) || (toneport == NULL)) if ((interface == NULL) || (toneport == NULL))
return -ENODEV; return -ENODEV;
/* initialize audio system: */ /* initialize audio system: */
if((err = line6_init_audio(line6)) < 0) { err = line6_init_audio(line6);
if (err < 0) {
toneport_destruct(interface); toneport_destruct(interface);
return err; return err;
} }
/* initialize PCM subsystem: */ /* initialize PCM subsystem: */
if((err = line6_init_pcm(line6, &toneport_pcm_properties)) < 0) { err = line6_init_pcm(line6, &toneport_pcm_properties);
if (err < 0) {
toneport_destruct(interface); toneport_destruct(interface);
return err; return err;
} }
/* register audio system: */ /* register audio system: */
if((err = line6_register_audio(line6)) < 0) { err = line6_register_audio(line6);
if (err < 0) {
toneport_destruct(interface); toneport_destruct(interface);
return err; return err;
} }
...@@ -182,11 +198,12 @@ int toneport_init(struct usb_interface *interface, struct usb_line6_toneport *to ...@@ -182,11 +198,12 @@ int toneport_init(struct usb_interface *interface, struct usb_line6_toneport *to
/* /*
seems to work without the first two... seems to work without the first two...
*/ */
//toneport_send_cmd(usbdev, 0x0201, 0x0002); // .. /* toneport_send_cmd(usbdev, 0x0201, 0x0002); */
//toneport_send_cmd(usbdev, 0x0801, 0x0000); // .. /* toneport_send_cmd(usbdev, 0x0801, 0x0000); */
toneport_send_cmd(usbdev, 0x0301, 0x0000); // only one that works for me; on GP, TP might be different? /* only one that works for me; on GP, TP might be different? */
toneport_send_cmd(usbdev, 0x0301, 0x0000);
if (usbdev->descriptor.idProduct!=LINE6_DEVID_GUITARPORT) { if (usbdev->descriptor.idProduct != LINE6_DEVID_GUITARPORT) {
CHECK_RETURN(device_create_file(&interface->dev, &dev_attr_led_red)); CHECK_RETURN(device_create_file(&interface->dev, &dev_attr_led_red));
CHECK_RETURN(device_create_file(&interface->dev, &dev_attr_led_green)); CHECK_RETURN(device_create_file(&interface->dev, &dev_attr_led_green));
toneport_update_led(&usbdev->dev); toneport_update_led(&usbdev->dev);
...@@ -202,7 +219,8 @@ void toneport_disconnect(struct usb_interface *interface) ...@@ -202,7 +219,8 @@ void toneport_disconnect(struct usb_interface *interface)
{ {
struct usb_line6_toneport *toneport; struct usb_line6_toneport *toneport;
if(interface == NULL) return; if (interface == NULL)
return;
toneport = usb_get_intfdata(interface); toneport = usb_get_intfdata(interface);
if (toneport->line6.usbdev->descriptor.idProduct != LINE6_DEVID_GUITARPORT) { if (toneport->line6.usbdev->descriptor.idProduct != LINE6_DEVID_GUITARPORT) {
...@@ -210,10 +228,10 @@ void toneport_disconnect(struct usb_interface *interface) ...@@ -210,10 +228,10 @@ void toneport_disconnect(struct usb_interface *interface)
device_remove_file(&interface->dev, &dev_attr_led_green); device_remove_file(&interface->dev, &dev_attr_led_green);
} }
if(toneport != NULL) { if (toneport != NULL) {
struct snd_line6_pcm *line6pcm = toneport->line6.line6pcm; struct snd_line6_pcm *line6pcm = toneport->line6.line6pcm;
if(line6pcm != NULL) { if (line6pcm != NULL) {
unlink_wait_clear_audio_out_urbs(line6pcm); unlink_wait_clear_audio_out_urbs(line6pcm);
unlink_wait_clear_audio_in_urbs(line6pcm); unlink_wait_clear_audio_in_urbs(line6pcm);
} }
......
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