aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-06-15 14:52:43 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:21:35 -0400
commitfa830e8a014a206103d06a7600ed8c661b427db3 (patch)
tree29606f18b0a88d6e9015b47a169db932b08283cf
parentf0333e3de0e06fb9a6662a6df7d3d1cc8e5dbeca (diff)
V4L/DVB (8282): sms1xxx: more codingstyle cleanups
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/dvb/siano/smscoreapi.c36
-rw-r--r--drivers/media/dvb/siano/smscoreapi.h4
-rw-r--r--drivers/media/dvb/siano/smsdvb.c36
-rw-r--r--drivers/media/dvb/siano/smsusb.c18
4 files changed, 45 insertions, 49 deletions
diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c
index 5e8869a747f9..e8267178c52c 100644
--- a/drivers/media/dvb/siano/smscoreapi.c
+++ b/drivers/media/dvb/siano/smscoreapi.c
@@ -386,7 +386,7 @@ int smscore_register_device(smsdevice_params_t *params,
386 /* prepare dma buffers */ 386 /* prepare dma buffers */
387 for (buffer = dev->common_buffer; 387 for (buffer = dev->common_buffer;
388 dev->num_buffers < params->num_buffers; 388 dev->num_buffers < params->num_buffers;
389 dev->num_buffers ++, buffer += params->buffer_size) { 389 dev->num_buffers++, buffer += params->buffer_size) {
390 smscore_buffer_t *cb = smscore_createbuffer(buffer, dev->common_buffer, dev->common_buffer_phys); 390 smscore_buffer_t *cb = smscore_createbuffer(buffer, dev->common_buffer, dev->common_buffer_phys);
391 if (!cb) { 391 if (!cb) {
392 smscore_unregister_device(dev); 392 smscore_unregister_device(dev);
@@ -499,8 +499,7 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer,
499 mem_address = *(u32 *) &payload[20]; 499 mem_address = *(u32 *) &payload[20];
500 } 500 }
501 501
502 while (size && rc >= 0) 502 while (size && rc >= 0) {
503 {
504 SmsDataDownload_ST *DataMsg = (SmsDataDownload_ST *) msg; 503 SmsDataDownload_ST *DataMsg = (SmsDataDownload_ST *) msg;
505 int payload_size = min((int) size, SMS_MAX_PAYLOAD_SIZE); 504 int payload_size = min((int) size, SMS_MAX_PAYLOAD_SIZE);
506 505
@@ -530,11 +529,11 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer,
530 sizeof(SmsMsgHdr_ST) + 529 sizeof(SmsMsgHdr_ST) +
531 sizeof(u32) * 5); 530 sizeof(u32) * 5);
532 531
533 TriggerMsg->msgData[0] = firmware->StartAddress; // Entry point 532 TriggerMsg->msgData[0] = firmware->StartAddress; /* Entry point */
534 TriggerMsg->msgData[1] = 5; // Priority 533 TriggerMsg->msgData[1] = 5; /* Priority */
535 TriggerMsg->msgData[2] = 0x200; // Stack size 534 TriggerMsg->msgData[2] = 0x200; /* Stack size */
536 TriggerMsg->msgData[3] = 0; // Parameter 535 TriggerMsg->msgData[3] = 0; /* Parameter */
537 TriggerMsg->msgData[4] = 4; // Task ID 536 TriggerMsg->msgData[4] = 4; /* Task ID */
538 537
539 if (coredev->device_flags & SMS_ROM_NO_RESPONSE) { 538 if (coredev->device_flags & SMS_ROM_NO_RESPONSE) {
540 rc = coredev->sendrequest_handler(coredev->context, TriggerMsg, TriggerMsg->xMsgHeader.msgLength); 539 rc = coredev->sendrequest_handler(coredev->context, TriggerMsg, TriggerMsg->xMsgHeader.msgLength);
@@ -642,7 +641,7 @@ void smscore_unregister_device(smscore_device_t *coredev)
642 while (1) { 641 while (1) {
643 while ((cb = smscore_getbuffer(coredev))) { 642 while ((cb = smscore_getbuffer(coredev))) {
644 kfree(cb); 643 kfree(cb);
645 num_buffers ++; 644 num_buffers++;
646 } 645 }
647 if (num_buffers == coredev->num_buffers) 646 if (num_buffers == coredev->num_buffers)
648 break; 647 break;
@@ -842,14 +841,14 @@ smscore_client_t *smscore_find_client(smscore_device_t *coredev, int data_type,
842 for (next = first->next; 841 for (next = first->next;
843 (next != first) && !client; 842 (next != first) && !client;
844 next = next->next) { 843 next = next->next) {
845 firstid = &((smscore_client_t*)next)->idlist; 844 firstid = &((smscore_client_t *)next)->idlist;
846 for (nextid = firstid->next; 845 for (nextid = firstid->next;
847 nextid != firstid; 846 nextid != firstid;
848 nextid = nextid->next) { 847 nextid = nextid->next) {
849 if ((((smscore_idlist_t*)nextid)->id == id) && 848 if ((((smscore_idlist_t *)nextid)->id == id) &&
850 (((smscore_idlist_t*)nextid)->data_type == data_type || 849 (((smscore_idlist_t *)nextid)->data_type == data_type ||
851 (((smscore_idlist_t*)nextid)->data_type == 0))) { 850 (((smscore_idlist_t *)nextid)->data_type == 0))) {
852 client = (smscore_client_t*) next; 851 client = (smscore_client_t *) next;
853 break; 852 break;
854 } 853 }
855 } 854 }
@@ -880,8 +879,7 @@ void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb)
880 if (!last_sample_time) 879 if (!last_sample_time)
881 last_sample_time = time_now; 880 last_sample_time = time_now;
882 881
883 if (time_now - last_sample_time > 10000) 882 if (time_now - last_sample_time > 10000) {
884 {
885 printk("\n%s data rate %d bytes/secs\n", __func__, 883 printk("\n%s data rate %d bytes/secs\n", __func__,
886 (int)((data_total * 1000) / 884 (int)((data_total * 1000) /
887 (time_now - last_sample_time))); 885 (time_now - last_sample_time)));
@@ -989,9 +987,9 @@ int smscore_validate_client(smscore_device_t *coredev,
989 return -EFAULT; 987 return -EFAULT;
990 } 988 }
991 registered_client = smscore_find_client(coredev, data_type, id); 989 registered_client = smscore_find_client(coredev, data_type, id);
992 if (registered_client == client) { 990 if (registered_client == client)
993 return 0; 991 return 0;
994 } 992
995 if (registered_client) { 993 if (registered_client) {
996 PERROR("The msg ID already registered to another client.\n"); 994 PERROR("The msg ID already registered to another client.\n");
997 return -EEXIST; 995 return -EEXIST;
@@ -1069,7 +1067,7 @@ void smscore_unregister_client(smscore_client_t *client)
1069 1067
1070 while (!list_empty(&client->idlist)) { 1068 while (!list_empty(&client->idlist)) {
1071 smscore_idlist_t *identry = 1069 smscore_idlist_t *identry =
1072 (smscore_idlist_t*) client->idlist.next; 1070 (smscore_idlist_t *) client->idlist.next;
1073 list_del(&identry->entry); 1071 list_del(&identry->entry);
1074 kfree(identry); 1072 kfree(identry);
1075 } 1073 }
diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h
index a5c4c0409a23..4860e318a5b8 100644
--- a/drivers/media/dvb/siano/smscoreapi.h
+++ b/drivers/media/dvb/siano/smscoreapi.h
@@ -45,7 +45,7 @@ typedef struct mutex kmutex_t;
45 45
46 46
47#ifndef min 47#ifndef min
48#define min(a,b) (((a) < (b)) ? (a) : (b)) 48#define min(a, b) (((a) < (b)) ? (a) : (b))
49#endif 49#endif
50 50
51#define SMS_ALLOC_ALIGNMENT 128 51#define SMS_ALLOC_ALIGNMENT 128
@@ -57,7 +57,7 @@ typedef struct mutex kmutex_t;
57#define SMS_DEVICE_NOT_READY 0x8000000 57#define SMS_DEVICE_NOT_READY 0x8000000
58 58
59typedef enum { 59typedef enum {
60 SMS_STELLAR= 0, 60 SMS_STELLAR = 0,
61 SMS_NOVA_A0, 61 SMS_NOVA_A0,
62 SMS_NOVA_B0, 62 SMS_NOVA_B0,
63 SMS_VEGA, 63 SMS_VEGA,
diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c
index 13980fb649c4..e3f09646bb81 100644
--- a/drivers/media/dvb/siano/smsdvb.c
+++ b/drivers/media/dvb/siano/smsdvb.c
@@ -34,7 +34,7 @@ int smsdvb_onresponse(void *context, smscore_buffer_t *cb)
34 smsdvb_client_t *client = (smsdvb_client_t *) context; 34 smsdvb_client_t *client = (smsdvb_client_t *) context;
35 SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *)(((u8 *) cb->p) + cb->offset); 35 SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *)(((u8 *) cb->p) + cb->offset);
36 36
37 switch(phdr->msgType) { 37 switch (phdr->msgType) {
38 case MSG_SMS_DVBT_BDA_DATA: 38 case MSG_SMS_DVBT_BDA_DATA:
39 dvb_dmx_swfilter(&client->demux, (u8 *)(phdr + 1), 39 dvb_dmx_swfilter(&client->demux, (u8 *)(phdr + 1),
40 cb->size - sizeof(SmsMsgHdr_ST)); 40 cb->size - sizeof(SmsMsgHdr_ST));
@@ -49,8 +49,7 @@ int smsdvb_onresponse(void *context, smscore_buffer_t *cb)
49 SmsMsgStatisticsInfo_ST *p = 49 SmsMsgStatisticsInfo_ST *p =
50 (SmsMsgStatisticsInfo_ST *)(phdr + 1); 50 (SmsMsgStatisticsInfo_ST *)(phdr + 1);
51 51
52 if (p->Stat.IsDemodLocked) 52 if (p->Stat.IsDemodLocked) {
53 {
54 client->fe_status = FE_HAS_SIGNAL | 53 client->fe_status = FE_HAS_SIGNAL |
55 FE_HAS_CARRIER | 54 FE_HAS_CARRIER |
56 FE_HAS_VITERBI | 55 FE_HAS_VITERBI |
@@ -85,7 +84,7 @@ int smsdvb_onresponse(void *context, smscore_buffer_t *cb)
85 84
86void smsdvb_unregister_client(smsdvb_client_t *client) 85void smsdvb_unregister_client(smsdvb_client_t *client)
87{ 86{
88 // must be called under clientslock 87 /* must be called under clientslock */
89 88
90 list_del(&client->entry); 89 list_del(&client->entry);
91 90
@@ -243,13 +242,12 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe,
243 printk("%s freq %d band %d\n", __func__, 242 printk("%s freq %d band %d\n", __func__,
244 fep->frequency, fep->u.ofdm.bandwidth); 243 fep->frequency, fep->u.ofdm.bandwidth);
245 244
246 switch(fep->u.ofdm.bandwidth) 245 switch (fep->u.ofdm.bandwidth) {
247 { 246 case BANDWIDTH_8_MHZ: Msg.Data[1] = BW_8_MHZ; break;
248 case BANDWIDTH_8_MHZ: Msg.Data[1] = BW_8_MHZ; break; 247 case BANDWIDTH_7_MHZ: Msg.Data[1] = BW_7_MHZ; break;
249 case BANDWIDTH_7_MHZ: Msg.Data[1] = BW_7_MHZ; break; 248 case BANDWIDTH_6_MHZ: Msg.Data[1] = BW_6_MHZ; break;
250 case BANDWIDTH_6_MHZ: Msg.Data[1] = BW_6_MHZ; break; 249 case BANDWIDTH_AUTO: return -EOPNOTSUPP;
251 case BANDWIDTH_AUTO: return -EOPNOTSUPP; 250 default: return -EINVAL;
252 default: return -EINVAL;
253 } 251 }
254 252
255 return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), 253 return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
@@ -263,7 +261,7 @@ static int smsdvb_get_frontend(struct dvb_frontend *fe,
263 261
264 printk("%s\n", __func__); 262 printk("%s\n", __func__);
265 263
266 // todo: 264 /* todo: */
267 memcpy(fep, &client->fe_params, 265 memcpy(fep, &client->fe_params,
268 sizeof(struct dvb_frontend_parameters)); 266 sizeof(struct dvb_frontend_parameters));
269 return 0; 267 return 0;
@@ -271,7 +269,7 @@ static int smsdvb_get_frontend(struct dvb_frontend *fe,
271 269
272static void smsdvb_release(struct dvb_frontend *fe) 270static void smsdvb_release(struct dvb_frontend *fe)
273{ 271{
274 // do nothing 272 /* do nothing */
275} 273}
276 274
277static struct dvb_frontend_ops smsdvb_fe_ops = { 275static struct dvb_frontend_ops smsdvb_fe_ops = {
@@ -310,7 +308,7 @@ int smsdvb_hotplug(smscore_device_t *coredev,
310 smsdvb_client_t *client; 308 smsdvb_client_t *client;
311 int rc; 309 int rc;
312 310
313 // device removal handled by onremove callback 311 /* device removal handled by onremove callback */
314 if (!arrival) 312 if (!arrival)
315 return 0; 313 return 0;
316 314
@@ -325,7 +323,7 @@ int smsdvb_hotplug(smscore_device_t *coredev,
325 return -ENOMEM; 323 return -ENOMEM;
326 } 324 }
327 325
328 // register dvb adapter 326 /* register dvb adapter */
329 rc = dvb_register_adapter(&client->adapter, "Siano Digital Receiver", 327 rc = dvb_register_adapter(&client->adapter, "Siano Digital Receiver",
330 THIS_MODULE, device, adapter_nr); 328 THIS_MODULE, device, adapter_nr);
331 if (rc < 0) { 329 if (rc < 0) {
@@ -333,9 +331,9 @@ int smsdvb_hotplug(smscore_device_t *coredev,
333 goto adapter_error; 331 goto adapter_error;
334 } 332 }
335 333
336 // init dvb demux 334 /* init dvb demux */
337 client->demux.dmx.capabilities = DMX_TS_FILTERING; 335 client->demux.dmx.capabilities = DMX_TS_FILTERING;
338 client->demux.filternum = 32; // todo: nova ??? 336 client->demux.filternum = 32; /* todo: nova ??? */
339 client->demux.feednum = 32; 337 client->demux.feednum = 32;
340 client->demux.start_feed = smsdvb_start_feed; 338 client->demux.start_feed = smsdvb_start_feed;
341 client->demux.stop_feed = smsdvb_stop_feed; 339 client->demux.stop_feed = smsdvb_stop_feed;
@@ -346,7 +344,7 @@ int smsdvb_hotplug(smscore_device_t *coredev,
346 goto dvbdmx_error; 344 goto dvbdmx_error;
347 } 345 }
348 346
349 // init dmxdev 347 /* init dmxdev */
350 client->dmxdev.filternum = 32; 348 client->dmxdev.filternum = 32;
351 client->dmxdev.demux = &client->demux.dmx; 349 client->dmxdev.demux = &client->demux.dmx;
352 client->dmxdev.capabilities = 0; 350 client->dmxdev.capabilities = 0;
@@ -357,7 +355,7 @@ int smsdvb_hotplug(smscore_device_t *coredev,
357 goto dmxdev_error; 355 goto dmxdev_error;
358 } 356 }
359 357
360 // init and register frontend 358 /* init and register frontend */
361 memcpy(&client->frontend.ops, &smsdvb_fe_ops, 359 memcpy(&client->frontend.ops, &smsdvb_fe_ops,
362 sizeof(struct dvb_frontend_ops)); 360 sizeof(struct dvb_frontend_ops));
363 361
diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c
index d9ce3ba0910f..2361f1a5e3c4 100644
--- a/drivers/media/dvb/siano/smsusb.c
+++ b/drivers/media/dvb/siano/smsusb.c
@@ -149,7 +149,7 @@ void smsusb_stop_streaming(smsusb_device_t *dev)
149{ 149{
150 int i; 150 int i;
151 151
152 for (i = 0; i < MAX_URBS; i ++) { 152 for (i = 0; i < MAX_URBS; i++) {
153 usb_kill_urb(&dev->surbs[i].urb); 153 usb_kill_urb(&dev->surbs[i].urb);
154 154
155 if (dev->surbs[i].cb) { 155 if (dev->surbs[i].cb) {
@@ -163,7 +163,7 @@ int smsusb_start_streaming(smsusb_device_t *dev)
163{ 163{
164 int i, rc; 164 int i, rc;
165 165
166 for (i = 0; i < MAX_URBS; i ++) { 166 for (i = 0; i < MAX_URBS; i++) {
167 rc = smsusb_submit_urb(dev, &dev->surbs[i]); 167 rc = smsusb_submit_urb(dev, &dev->surbs[i]);
168 if (rc < 0) { 168 if (rc < 0) {
169 printk(KERN_INFO "%s smsusb_submit_urb(...) " 169 printk(KERN_INFO "%s smsusb_submit_urb(...) "
@@ -275,7 +275,7 @@ void smsusb_term_device(struct usb_interface *intf)
275 if (dev) { 275 if (dev) {
276 smsusb_stop_streaming(dev); 276 smsusb_stop_streaming(dev);
277 277
278 // unregister from smscore 278 /* unregister from smscore */
279 if (dev->coredev) 279 if (dev->coredev)
280 smscore_unregister_device(dev->coredev); 280 smscore_unregister_device(dev->coredev);
281 281
@@ -293,7 +293,7 @@ int smsusb_init_device(struct usb_interface *intf)
293 smsusb_device_t *dev; 293 smsusb_device_t *dev;
294 int i, rc; 294 int i, rc;
295 295
296 // create device object 296 /* create device object */
297 dev = kzalloc(sizeof(smsusb_device_t), GFP_KERNEL); 297 dev = kzalloc(sizeof(smsusb_device_t), GFP_KERNEL);
298 if (!dev) { 298 if (!dev) {
299 printk(KERN_INFO "%s kzalloc(sizeof(smsusb_device_t) failed\n", 299 printk(KERN_INFO "%s kzalloc(sizeof(smsusb_device_t) failed\n",
@@ -313,13 +313,13 @@ int smsusb_init_device(struct usb_interface *intf)
313 params.setmode_handler = smsusb1_setmode; 313 params.setmode_handler = smsusb1_setmode;
314 params.detectmode_handler = smsusb1_detectmode; 314 params.detectmode_handler = smsusb1_detectmode;
315 params.device_type = SMS_STELLAR; 315 params.device_type = SMS_STELLAR;
316 printk(KERN_INFO "%s stellar device found\n", __func__ ); 316 printk(KERN_INFO "%s stellar device found\n", __func__);
317 break; 317 break;
318 default: 318 default:
319 switch (dev->udev->descriptor.idProduct) { 319 switch (dev->udev->descriptor.idProduct) {
320 case USB_PID_NOVA_A: 320 case USB_PID_NOVA_A:
321 params.device_type = SMS_NOVA_A0; 321 params.device_type = SMS_NOVA_A0;
322 printk(KERN_INFO "%s nova A0 found\n", __func__ ); 322 printk(KERN_INFO "%s nova A0 found\n", __func__);
323 break; 323 break;
324 default: 324 default:
325 case USB_PID_NOVA_B: 325 case USB_PID_NOVA_B:
@@ -357,7 +357,7 @@ int smsusb_init_device(struct usb_interface *intf)
357 return rc; 357 return rc;
358 } 358 }
359 359
360 // initialize urbs 360 /* initialize urbs */
361 for (i = 0; i < MAX_URBS; i++) { 361 for (i = 0; i < MAX_URBS; i++) {
362 dev->surbs[i].dev = dev; 362 dev->surbs[i].dev = dev;
363 usb_init_urb(&dev->surbs[i].urb); 363 usb_init_urb(&dev->surbs[i].urb);
@@ -405,7 +405,7 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id)
405 405
406 printk(KERN_INFO "smsusb_probe %d\n", 406 printk(KERN_INFO "smsusb_probe %d\n",
407 intf->cur_altsetting->desc.bInterfaceNumber); 407 intf->cur_altsetting->desc.bInterfaceNumber);
408 for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i ++) 408 for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++)
409 printk(KERN_INFO "endpoint %d %02x %02x %d\n", i, 409 printk(KERN_INFO "endpoint %d %02x %02x %d\n", i,
410 intf->cur_altsetting->endpoint[i].desc.bEndpointAddress, 410 intf->cur_altsetting->endpoint[i].desc.bEndpointAddress,
411 intf->cur_altsetting->endpoint[i].desc.bmAttributes, 411 intf->cur_altsetting->endpoint[i].desc.bmAttributes,
@@ -440,7 +440,7 @@ static struct usb_device_id smsusb_id_table [] = {
440 { USB_DEVICE(USB_VID_SIANO, USB_PID_NOVA_A) }, 440 { USB_DEVICE(USB_VID_SIANO, USB_PID_NOVA_A) },
441 { } /* Terminating entry */ 441 { } /* Terminating entry */
442}; 442};
443MODULE_DEVICE_TABLE (usb, smsusb_id_table); 443MODULE_DEVICE_TABLE(usb, smsusb_id_table);
444 444
445static struct usb_driver smsusb_driver = { 445static struct usb_driver smsusb_driver = {
446 .name = "smsusb", 446 .name = "smsusb",