diff options
author | Dan Carpenter <error27@gmail.com> | 2010-07-01 00:50:04 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-08-02 14:03:53 -0400 |
commit | cd3172d7dabdac4545d8246da62b570b9acf8058 (patch) | |
tree | 81ee67e535db33de6d90d06d302759edef84ccfc /drivers/media/dvb | |
parent | 2b3c543a839cafeb3edd7e1a2202d86318801fd9 (diff) |
V4L/DVB: dvb-usb-init.c: white space changes in dvb-usb-init
I started fixing one or two lines, but after a while I got into a groove
and started changing everything. I left the lines longer than 80
characters because that seemed to be the style in this file.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r-- | drivers/media/dvb/dvb-usb/dvb-usb-init.c | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/drivers/media/dvb/dvb-usb/dvb-usb-init.c index 5d91f70d2d2d..2e3ea0fa28e0 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-init.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-init.c | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | /* debug */ | 16 | /* debug */ |
17 | int dvb_usb_debug; | 17 | int dvb_usb_debug; |
18 | module_param_named(debug,dvb_usb_debug, int, 0644); | 18 | module_param_named(debug, dvb_usb_debug, int, 0644); |
19 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,pll=4,ts=8,err=16,rc=32,fw=64,mem=128,uxfer=256 (or-able))." DVB_USB_DEBUG_STATUS); | 19 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,pll=4,ts=8,err=16,rc=32,fw=64,mem=128,uxfer=256 (or-able))." DVB_USB_DEBUG_STATUS); |
20 | 20 | ||
21 | int dvb_usb_disable_rc_polling; | 21 | int dvb_usb_disable_rc_polling; |
@@ -29,7 +29,7 @@ MODULE_PARM_DESC(force_pid_filter_usage, "force all dvb-usb-devices to use a PID | |||
29 | static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) | 29 | static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) |
30 | { | 30 | { |
31 | struct dvb_usb_adapter *adap; | 31 | struct dvb_usb_adapter *adap; |
32 | int ret,n; | 32 | int ret, n; |
33 | 33 | ||
34 | for (n = 0; n < d->props.num_adapters; n++) { | 34 | for (n = 0; n < d->props.num_adapters; n++) { |
35 | adap = &d->adapter[n]; | 35 | adap = &d->adapter[n]; |
@@ -38,7 +38,7 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) | |||
38 | 38 | ||
39 | memcpy(&adap->props, &d->props.adapter[n], sizeof(struct dvb_usb_adapter_properties)); | 39 | memcpy(&adap->props, &d->props.adapter[n], sizeof(struct dvb_usb_adapter_properties)); |
40 | 40 | ||
41 | /* speed - when running at FULL speed we need a HW PID filter */ | 41 | /* speed - when running at FULL speed we need a HW PID filter */ |
42 | if (d->udev->speed == USB_SPEED_FULL && !(adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER)) { | 42 | if (d->udev->speed == USB_SPEED_FULL && !(adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER)) { |
43 | err("This USB2.0 device cannot be run on a USB1.1 port. (it lacks a hardware PID filter)"); | 43 | err("This USB2.0 device cannot be run on a USB1.1 port. (it lacks a hardware PID filter)"); |
44 | return -ENODEV; | 44 | return -ENODEV; |
@@ -46,7 +46,7 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) | |||
46 | 46 | ||
47 | if ((d->udev->speed == USB_SPEED_FULL && adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER) || | 47 | if ((d->udev->speed == USB_SPEED_FULL && adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER) || |
48 | (adap->props.caps & DVB_USB_ADAP_NEED_PID_FILTERING)) { | 48 | (adap->props.caps & DVB_USB_ADAP_NEED_PID_FILTERING)) { |
49 | info("will use the device's hardware PID filter (table count: %d).",adap->props.pid_filter_count); | 49 | info("will use the device's hardware PID filter (table count: %d).", adap->props.pid_filter_count); |
50 | adap->pid_filtering = 1; | 50 | adap->pid_filtering = 1; |
51 | adap->max_feed_count = adap->props.pid_filter_count; | 51 | adap->max_feed_count = adap->props.pid_filter_count; |
52 | } else { | 52 | } else { |
@@ -64,9 +64,9 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) | |||
64 | } | 64 | } |
65 | 65 | ||
66 | if (adap->props.size_of_priv > 0) { | 66 | if (adap->props.size_of_priv > 0) { |
67 | adap->priv = kzalloc(adap->props.size_of_priv,GFP_KERNEL); | 67 | adap->priv = kzalloc(adap->props.size_of_priv, GFP_KERNEL); |
68 | if (adap->priv == NULL) { | 68 | if (adap->priv == NULL) { |
69 | err("no memory for priv for adapter %d.",n); | 69 | err("no memory for priv for adapter %d.", n); |
70 | return -ENOMEM; | 70 | return -ENOMEM; |
71 | } | 71 | } |
72 | } | 72 | } |
@@ -86,8 +86,8 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) | |||
86 | * sometimes a timeout occures, this helps | 86 | * sometimes a timeout occures, this helps |
87 | */ | 87 | */ |
88 | if (d->props.generic_bulk_ctrl_endpoint != 0) { | 88 | if (d->props.generic_bulk_ctrl_endpoint != 0) { |
89 | usb_clear_halt(d->udev,usb_sndbulkpipe(d->udev,d->props.generic_bulk_ctrl_endpoint)); | 89 | usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); |
90 | usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.generic_bulk_ctrl_endpoint)); | 90 | usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); |
91 | } | 91 | } |
92 | 92 | ||
93 | return 0; | 93 | return 0; |
@@ -96,6 +96,7 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) | |||
96 | static int dvb_usb_adapter_exit(struct dvb_usb_device *d) | 96 | static int dvb_usb_adapter_exit(struct dvb_usb_device *d) |
97 | { | 97 | { |
98 | int n; | 98 | int n; |
99 | |||
99 | for (n = 0; n < d->num_adapters_initialized; n++) { | 100 | for (n = 0; n < d->num_adapters_initialized; n++) { |
100 | dvb_usb_adapter_frontend_exit(&d->adapter[n]); | 101 | dvb_usb_adapter_frontend_exit(&d->adapter[n]); |
101 | dvb_usb_adapter_dvb_exit(&d->adapter[n]); | 102 | dvb_usb_adapter_dvb_exit(&d->adapter[n]); |
@@ -111,11 +112,11 @@ static int dvb_usb_adapter_exit(struct dvb_usb_device *d) | |||
111 | /* general initialization functions */ | 112 | /* general initialization functions */ |
112 | static int dvb_usb_exit(struct dvb_usb_device *d) | 113 | static int dvb_usb_exit(struct dvb_usb_device *d) |
113 | { | 114 | { |
114 | deb_info("state before exiting everything: %x\n",d->state); | 115 | deb_info("state before exiting everything: %x\n", d->state); |
115 | dvb_usb_remote_exit(d); | 116 | dvb_usb_remote_exit(d); |
116 | dvb_usb_adapter_exit(d); | 117 | dvb_usb_adapter_exit(d); |
117 | dvb_usb_i2c_exit(d); | 118 | dvb_usb_i2c_exit(d); |
118 | deb_info("state should be zero now: %x\n",d->state); | 119 | deb_info("state should be zero now: %x\n", d->state); |
119 | d->state = DVB_USB_STATE_INIT; | 120 | d->state = DVB_USB_STATE_INIT; |
120 | kfree(d->priv); | 121 | kfree(d->priv); |
121 | kfree(d); | 122 | kfree(d); |
@@ -132,14 +133,14 @@ static int dvb_usb_init(struct dvb_usb_device *d, short *adapter_nums) | |||
132 | d->state = DVB_USB_STATE_INIT; | 133 | d->state = DVB_USB_STATE_INIT; |
133 | 134 | ||
134 | if (d->props.size_of_priv > 0) { | 135 | if (d->props.size_of_priv > 0) { |
135 | d->priv = kzalloc(d->props.size_of_priv,GFP_KERNEL); | 136 | d->priv = kzalloc(d->props.size_of_priv, GFP_KERNEL); |
136 | if (d->priv == NULL) { | 137 | if (d->priv == NULL) { |
137 | err("no memory for priv in 'struct dvb_usb_device'"); | 138 | err("no memory for priv in 'struct dvb_usb_device'"); |
138 | return -ENOMEM; | 139 | return -ENOMEM; |
139 | } | 140 | } |
140 | } | 141 | } |
141 | 142 | ||
142 | /* check the capabilities and set appropriate variables */ | 143 | /* check the capabilities and set appropriate variables */ |
143 | dvb_usb_device_power_ctrl(d, 1); | 144 | dvb_usb_device_power_ctrl(d, 1); |
144 | 145 | ||
145 | if ((ret = dvb_usb_i2c_init(d)) || | 146 | if ((ret = dvb_usb_i2c_init(d)) || |
@@ -157,16 +158,17 @@ static int dvb_usb_init(struct dvb_usb_device *d, short *adapter_nums) | |||
157 | } | 158 | } |
158 | 159 | ||
159 | /* determine the name and the state of the just found USB device */ | 160 | /* determine the name and the state of the just found USB device */ |
160 | static struct dvb_usb_device_description * dvb_usb_find_device(struct usb_device *udev,struct dvb_usb_device_properties *props, int *cold) | 161 | static struct dvb_usb_device_description *dvb_usb_find_device(struct usb_device *udev, struct dvb_usb_device_properties *props, int *cold) |
161 | { | 162 | { |
162 | int i,j; | 163 | int i, j; |
163 | struct dvb_usb_device_description *desc = NULL; | 164 | struct dvb_usb_device_description *desc = NULL; |
165 | |||
164 | *cold = -1; | 166 | *cold = -1; |
165 | 167 | ||
166 | for (i = 0; i < props->num_device_descs; i++) { | 168 | for (i = 0; i < props->num_device_descs; i++) { |
167 | 169 | ||
168 | for (j = 0; j < DVB_USB_ID_MAX_NUM && props->devices[i].cold_ids[j] != NULL; j++) { | 170 | for (j = 0; j < DVB_USB_ID_MAX_NUM && props->devices[i].cold_ids[j] != NULL; j++) { |
169 | deb_info("check for cold %x %x\n",props->devices[i].cold_ids[j]->idVendor, props->devices[i].cold_ids[j]->idProduct); | 171 | deb_info("check for cold %x %x\n", props->devices[i].cold_ids[j]->idVendor, props->devices[i].cold_ids[j]->idProduct); |
170 | if (props->devices[i].cold_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) && | 172 | if (props->devices[i].cold_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) && |
171 | props->devices[i].cold_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) { | 173 | props->devices[i].cold_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) { |
172 | *cold = 1; | 174 | *cold = 1; |
@@ -179,7 +181,7 @@ static struct dvb_usb_device_description * dvb_usb_find_device(struct usb_device | |||
179 | break; | 181 | break; |
180 | 182 | ||
181 | for (j = 0; j < DVB_USB_ID_MAX_NUM && props->devices[i].warm_ids[j] != NULL; j++) { | 183 | for (j = 0; j < DVB_USB_ID_MAX_NUM && props->devices[i].warm_ids[j] != NULL; j++) { |
182 | deb_info("check for warm %x %x\n",props->devices[i].warm_ids[j]->idVendor, props->devices[i].warm_ids[j]->idProduct); | 184 | deb_info("check for warm %x %x\n", props->devices[i].warm_ids[j]->idVendor, props->devices[i].warm_ids[j]->idProduct); |
183 | if (props->devices[i].warm_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) && | 185 | if (props->devices[i].warm_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) && |
184 | props->devices[i].warm_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) { | 186 | props->devices[i].warm_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) { |
185 | *cold = 0; | 187 | *cold = 0; |
@@ -190,7 +192,7 @@ static struct dvb_usb_device_description * dvb_usb_find_device(struct usb_device | |||
190 | } | 192 | } |
191 | 193 | ||
192 | if (desc != NULL && props->identify_state != NULL) | 194 | if (desc != NULL && props->identify_state != NULL) |
193 | props->identify_state(udev,props,&desc,cold); | 195 | props->identify_state(udev, props, &desc, cold); |
194 | 196 | ||
195 | return desc; | 197 | return desc; |
196 | } | 198 | } |
@@ -202,7 +204,7 @@ int dvb_usb_device_power_ctrl(struct dvb_usb_device *d, int onoff) | |||
202 | else | 204 | else |
203 | d->powered--; | 205 | d->powered--; |
204 | 206 | ||
205 | if (d->powered == 0 || (onoff && d->powered == 1)) { // when switching from 1 to 0 or from 0 to 1 | 207 | if (d->powered == 0 || (onoff && d->powered == 1)) { /* when switching from 1 to 0 or from 0 to 1 */ |
206 | deb_info("power control: %d\n", onoff); | 208 | deb_info("power control: %d\n", onoff); |
207 | if (d->props.power_ctrl) | 209 | if (d->props.power_ctrl) |
208 | return d->props.power_ctrl(d, onoff); | 210 | return d->props.power_ctrl(d, onoff); |
@@ -222,32 +224,32 @@ int dvb_usb_device_init(struct usb_interface *intf, | |||
222 | struct dvb_usb_device *d = NULL; | 224 | struct dvb_usb_device *d = NULL; |
223 | struct dvb_usb_device_description *desc = NULL; | 225 | struct dvb_usb_device_description *desc = NULL; |
224 | 226 | ||
225 | int ret = -ENOMEM,cold=0; | 227 | int ret = -ENOMEM, cold = 0; |
226 | 228 | ||
227 | if (du != NULL) | 229 | if (du != NULL) |
228 | *du = NULL; | 230 | *du = NULL; |
229 | 231 | ||
230 | if ((desc = dvb_usb_find_device(udev,props,&cold)) == NULL) { | 232 | if ((desc = dvb_usb_find_device(udev, props, &cold)) == NULL) { |
231 | deb_err("something went very wrong, device was not found in current device list - let's see what comes next.\n"); | 233 | deb_err("something went very wrong, device was not found in current device list - let's see what comes next.\n"); |
232 | return -ENODEV; | 234 | return -ENODEV; |
233 | } | 235 | } |
234 | 236 | ||
235 | if (cold) { | 237 | if (cold) { |
236 | info("found a '%s' in cold state, will try to load a firmware",desc->name); | 238 | info("found a '%s' in cold state, will try to load a firmware", desc->name); |
237 | ret = dvb_usb_download_firmware(udev,props); | 239 | ret = dvb_usb_download_firmware(udev, props); |
238 | if (!props->no_reconnect || ret != 0) | 240 | if (!props->no_reconnect || ret != 0) |
239 | return ret; | 241 | return ret; |
240 | } | 242 | } |
241 | 243 | ||
242 | info("found a '%s' in warm state.",desc->name); | 244 | info("found a '%s' in warm state.", desc->name); |
243 | d = kzalloc(sizeof(struct dvb_usb_device),GFP_KERNEL); | 245 | d = kzalloc(sizeof(struct dvb_usb_device), GFP_KERNEL); |
244 | if (d == NULL) { | 246 | if (d == NULL) { |
245 | err("no memory for 'struct dvb_usb_device'"); | 247 | err("no memory for 'struct dvb_usb_device'"); |
246 | return -ENOMEM; | 248 | return -ENOMEM; |
247 | } | 249 | } |
248 | 250 | ||
249 | d->udev = udev; | 251 | d->udev = udev; |
250 | memcpy(&d->props,props,sizeof(struct dvb_usb_device_properties)); | 252 | memcpy(&d->props, props, sizeof(struct dvb_usb_device_properties)); |
251 | d->desc = desc; | 253 | d->desc = desc; |
252 | d->owner = owner; | 254 | d->owner = owner; |
253 | 255 | ||
@@ -259,9 +261,9 @@ int dvb_usb_device_init(struct usb_interface *intf, | |||
259 | ret = dvb_usb_init(d, adapter_nums); | 261 | ret = dvb_usb_init(d, adapter_nums); |
260 | 262 | ||
261 | if (ret == 0) | 263 | if (ret == 0) |
262 | info("%s successfully initialized and connected.",desc->name); | 264 | info("%s successfully initialized and connected.", desc->name); |
263 | else | 265 | else |
264 | info("%s error while loading driver (%d)",desc->name,ret); | 266 | info("%s error while loading driver (%d)", desc->name, ret); |
265 | return ret; | 267 | return ret; |
266 | } | 268 | } |
267 | EXPORT_SYMBOL(dvb_usb_device_init); | 269 | EXPORT_SYMBOL(dvb_usb_device_init); |
@@ -271,12 +273,12 @@ void dvb_usb_device_exit(struct usb_interface *intf) | |||
271 | struct dvb_usb_device *d = usb_get_intfdata(intf); | 273 | struct dvb_usb_device *d = usb_get_intfdata(intf); |
272 | const char *name = "generic DVB-USB module"; | 274 | const char *name = "generic DVB-USB module"; |
273 | 275 | ||
274 | usb_set_intfdata(intf,NULL); | 276 | usb_set_intfdata(intf, NULL); |
275 | if (d != NULL && d->desc != NULL) { | 277 | if (d != NULL && d->desc != NULL) { |
276 | name = d->desc->name; | 278 | name = d->desc->name; |
277 | dvb_usb_exit(d); | 279 | dvb_usb_exit(d); |
278 | } | 280 | } |
279 | info("%s successfully deinitialized and disconnected.",name); | 281 | info("%s successfully deinitialized and disconnected.", name); |
280 | 282 | ||
281 | } | 283 | } |
282 | EXPORT_SYMBOL(dvb_usb_device_exit); | 284 | EXPORT_SYMBOL(dvb_usb_device_exit); |