diff options
| author | Greg Kroah-Hartman <gregkh@suse.de> | 2009-02-28 01:43:45 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-04-03 17:54:26 -0400 |
| commit | 6353773b5230514d4f1d3dc98a84a72e3a954e87 (patch) | |
| tree | 26492628c6645fb5176a4563d7dc30521e5c549b | |
| parent | 68dc3dde0213c0560b6117998088f3e992934d37 (diff) | |
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: Greg Kroah-Hartman <gregkh@suse.de>
| -rw-r--r-- | drivers/staging/line6/toneport.c | 80 |
1 files changed, 49 insertions, 31 deletions
diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c index d894f4851ef2..eaa1229002aa 100644 --- a/drivers/staging/line6/toneport.c +++ b/drivers/staging/line6/toneport.c | |||
| @@ -75,34 +75,43 @@ static struct line6_pcm_properties toneport_pcm_properties = { | |||
| 75 | 75 | ||
| 76 | /* | 76 | /* |
| 77 | For the led on Guitarport. | 77 | For the led on Guitarport. |
| 78 | Brightness goes from 0x00 to 0x26. Set a value above this to have led blink. | 78 | Brightness goes from 0x00 to 0x26. Set a value above this to have led |
| 79 | blink. | ||
| 79 | (void cmd_0x02(byte red, byte green) | 80 | (void cmd_0x02(byte red, byte green) |
| 80 | */ | 81 | */ |
| 81 | static int led_red = 0x00; | 82 | static int led_red = 0x00; |
| 82 | static int led_green = 0x26; | 83 | static int led_green = 0x26; |
| 83 | 84 | ||
| 84 | static void toneport_update_led(struct device *dev) { | 85 | static void toneport_update_led(struct device *dev) |
| 85 | struct usb_interface *interface; | 86 | { |
| 86 | struct usb_line6_toneport *tp; | 87 | struct usb_interface *interface = to_usb_interface(dev); |
| 87 | struct usb_line6* line6; | 88 | struct usb_line6_toneport *tp = usb_get_intfdata(interface); |
| 89 | struct usb_line6 *line6; | ||
| 88 | 90 | ||
| 89 | if ((interface = to_usb_interface(dev)) && | 91 | if (!tp) |
| 90 | (tp = usb_get_intfdata(interface)) && | 92 | return; |
| 91 | (line6 = &tp->line6)) | 93 | |
| 92 | toneport_send_cmd(line6->usbdev, (led_red<<8)|0x0002, led_green); // for setting the LED on Guitarport | 94 | line6 = &tp->line6; |
| 95 | if (line6) | ||
| 96 | toneport_send_cmd(line6->usbdev, (led_red << 8) | 0x0002, | ||
| 97 | led_green); | ||
| 93 | } | 98 | } |
| 99 | |||
| 94 | static ssize_t toneport_set_led_red(struct device *dev, | 100 | static ssize_t toneport_set_led_red(struct device *dev, |
| 95 | struct device_attribute *attr, | 101 | struct device_attribute *attr, |
| 96 | const char *buf, size_t count) { | 102 | const char *buf, size_t count) |
| 97 | char* c; | 103 | { |
| 104 | char *c; | ||
| 98 | led_red = simple_strtol(buf, &c, 10); | 105 | led_red = simple_strtol(buf, &c, 10); |
| 99 | toneport_update_led(dev); | 106 | toneport_update_led(dev); |
| 100 | return count; | 107 | return count; |
| 101 | } | 108 | } |
| 109 | |||
| 102 | static ssize_t toneport_set_led_green(struct device *dev, | 110 | static ssize_t toneport_set_led_green(struct device *dev, |
| 103 | struct device_attribute *attr, | 111 | struct device_attribute *attr, |
| 104 | const char *buf, size_t count) { | 112 | const char *buf, size_t count) |
| 105 | char* c; | 113 | { |
| 114 | char *c; | ||
| 106 | led_green = simple_strtol(buf, &c, 10); | 115 | led_green = simple_strtol(buf, &c, 10); |
| 107 | toneport_update_led(dev); | 116 | toneport_update_led(dev); |
| 108 | return count; | 117 | return count; |
| @@ -115,11 +124,12 @@ static DEVICE_ATTR(led_green, S_IWUGO | S_IRUGO, line6_nop_read, toneport_set_le | |||
| 115 | static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2) | 124 | static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2) |
| 116 | { | 125 | { |
| 117 | int ret; | 126 | int ret; |
| 118 | ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev,0), 0x67, | ||
| 119 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | ||
| 120 | cmd1, cmd2, NULL, 0, LINE6_TIMEOUT * HZ); | ||
| 121 | 127 | ||
| 122 | if(ret < 0) { | 128 | ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67, |
| 129 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | ||
| 130 | cmd1, cmd2, NULL, 0, LINE6_TIMEOUT * HZ); | ||
| 131 | |||
| 132 | if (ret < 0) { | ||
| 123 | err("send failed (error %d)\n", ret); | 133 | err("send failed (error %d)\n", ret); |
| 124 | return ret; | 134 | return ret; |
| 125 | } | 135 | } |
| @@ -135,38 +145,44 @@ static void toneport_destruct(struct usb_interface *interface) | |||
| 135 | struct usb_line6_toneport *toneport = usb_get_intfdata(interface); | 145 | struct usb_line6_toneport *toneport = usb_get_intfdata(interface); |
| 136 | struct usb_line6 *line6; | 146 | struct usb_line6 *line6; |
| 137 | 147 | ||
| 138 | if(toneport == NULL) return; | 148 | if (toneport == NULL) |
| 149 | return; | ||
| 139 | line6 = &toneport->line6; | 150 | line6 = &toneport->line6; |
| 140 | if(line6 == NULL) return; | 151 | if (line6 == NULL) |
| 152 | return; | ||
| 141 | line6_cleanup_audio(line6); | 153 | line6_cleanup_audio(line6); |
| 142 | } | 154 | } |
| 143 | 155 | ||
| 144 | /* | 156 | /* |
| 145 | Init Toneport device. | 157 | Init Toneport device. |
| 146 | */ | 158 | */ |
| 147 | int toneport_init(struct usb_interface *interface, struct usb_line6_toneport *toneport) | 159 | int toneport_init(struct usb_interface *interface, |
| 160 | struct usb_line6_toneport *toneport) | ||
| 148 | { | 161 | { |
| 149 | int err, ticks; | 162 | int err, ticks; |
| 150 | struct usb_line6 *line6 = &toneport->line6; | 163 | struct usb_line6 *line6 = &toneport->line6; |
| 151 | struct usb_device *usbdev; | 164 | struct usb_device *usbdev; |
| 152 | 165 | ||
| 153 | if((interface == NULL) || (toneport == NULL)) | 166 | if ((interface == NULL) || (toneport == NULL)) |
| 154 | return -ENODEV; | 167 | return -ENODEV; |
| 155 | 168 | ||
| 156 | /* initialize audio system: */ | 169 | /* initialize audio system: */ |
| 157 | if((err = line6_init_audio(line6)) < 0) { | 170 | err = line6_init_audio(line6); |
| 171 | if (err < 0) { | ||
| 158 | toneport_destruct(interface); | 172 | toneport_destruct(interface); |
| 159 | return err; | 173 | return err; |
| 160 | } | 174 | } |
| 161 | 175 | ||
| 162 | /* initialize PCM subsystem: */ | 176 | /* initialize PCM subsystem: */ |
| 163 | if((err = line6_init_pcm(line6, &toneport_pcm_properties)) < 0) { | 177 | err = line6_init_pcm(line6, &toneport_pcm_properties); |
| 178 | if (err < 0) { | ||
| 164 | toneport_destruct(interface); | 179 | toneport_destruct(interface); |
| 165 | return err; | 180 | return err; |
| 166 | } | 181 | } |
| 167 | 182 | ||
| 168 | /* register audio system: */ | 183 | /* register audio system: */ |
| 169 | if((err = line6_register_audio(line6)) < 0) { | 184 | err = line6_register_audio(line6); |
| 185 | if (err < 0) { | ||
| 170 | toneport_destruct(interface); | 186 | toneport_destruct(interface); |
| 171 | return err; | 187 | return err; |
| 172 | } | 188 | } |
| @@ -182,11 +198,12 @@ int toneport_init(struct usb_interface *interface, struct usb_line6_toneport *to | |||
| 182 | /* | 198 | /* |
| 183 | seems to work without the first two... | 199 | seems to work without the first two... |
| 184 | */ | 200 | */ |
| 185 | //toneport_send_cmd(usbdev, 0x0201, 0x0002); // .. | 201 | /* toneport_send_cmd(usbdev, 0x0201, 0x0002); */ |
| 186 | //toneport_send_cmd(usbdev, 0x0801, 0x0000); // .. | 202 | /* toneport_send_cmd(usbdev, 0x0801, 0x0000); */ |
| 187 | toneport_send_cmd(usbdev, 0x0301, 0x0000); // only one that works for me; on GP, TP might be different? | 203 | /* only one that works for me; on GP, TP might be different? */ |
| 204 | toneport_send_cmd(usbdev, 0x0301, 0x0000); | ||
| 188 | 205 | ||
| 189 | if (usbdev->descriptor.idProduct!=LINE6_DEVID_GUITARPORT) { | 206 | if (usbdev->descriptor.idProduct != LINE6_DEVID_GUITARPORT) { |
| 190 | CHECK_RETURN(device_create_file(&interface->dev, &dev_attr_led_red)); | 207 | CHECK_RETURN(device_create_file(&interface->dev, &dev_attr_led_red)); |
| 191 | CHECK_RETURN(device_create_file(&interface->dev, &dev_attr_led_green)); | 208 | CHECK_RETURN(device_create_file(&interface->dev, &dev_attr_led_green)); |
| 192 | toneport_update_led(&usbdev->dev); | 209 | toneport_update_led(&usbdev->dev); |
| @@ -202,7 +219,8 @@ void toneport_disconnect(struct usb_interface *interface) | |||
| 202 | { | 219 | { |
| 203 | struct usb_line6_toneport *toneport; | 220 | struct usb_line6_toneport *toneport; |
| 204 | 221 | ||
| 205 | if(interface == NULL) return; | 222 | if (interface == NULL) |
| 223 | return; | ||
| 206 | toneport = usb_get_intfdata(interface); | 224 | toneport = usb_get_intfdata(interface); |
| 207 | 225 | ||
| 208 | if (toneport->line6.usbdev->descriptor.idProduct != LINE6_DEVID_GUITARPORT) { | 226 | if (toneport->line6.usbdev->descriptor.idProduct != LINE6_DEVID_GUITARPORT) { |
| @@ -210,10 +228,10 @@ void toneport_disconnect(struct usb_interface *interface) | |||
| 210 | device_remove_file(&interface->dev, &dev_attr_led_green); | 228 | device_remove_file(&interface->dev, &dev_attr_led_green); |
| 211 | } | 229 | } |
| 212 | 230 | ||
| 213 | if(toneport != NULL) { | 231 | if (toneport != NULL) { |
| 214 | struct snd_line6_pcm *line6pcm = toneport->line6.line6pcm; | 232 | struct snd_line6_pcm *line6pcm = toneport->line6.line6pcm; |
| 215 | 233 | ||
| 216 | if(line6pcm != NULL) { | 234 | if (line6pcm != NULL) { |
| 217 | unlink_wait_clear_audio_out_urbs(line6pcm); | 235 | unlink_wait_clear_audio_out_urbs(line6pcm); |
| 218 | unlink_wait_clear_audio_in_urbs(line6pcm); | 236 | unlink_wait_clear_audio_in_urbs(line6pcm); |
| 219 | } | 237 | } |
