From fa830e8a014a206103d06a7600ed8c661b427db3 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 15 Jun 2008 15:52:43 -0300 Subject: V4L/DVB (8282): sms1xxx: more codingstyle cleanups Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/siano/smscoreapi.c | 36 +++++++++++++++++------------------- drivers/media/dvb/siano/smscoreapi.h | 4 ++-- drivers/media/dvb/siano/smsdvb.c | 36 +++++++++++++++++------------------- drivers/media/dvb/siano/smsusb.c | 18 +++++++++--------- 4 files changed, 45 insertions(+), 49 deletions(-) (limited to 'drivers') diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 5e8869a747f..e8267178c52 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, /* prepare dma buffers */ for (buffer = dev->common_buffer; dev->num_buffers < params->num_buffers; - dev->num_buffers ++, buffer += params->buffer_size) { + dev->num_buffers++, buffer += params->buffer_size) { smscore_buffer_t *cb = smscore_createbuffer(buffer, dev->common_buffer, dev->common_buffer_phys); if (!cb) { smscore_unregister_device(dev); @@ -499,8 +499,7 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, mem_address = *(u32 *) &payload[20]; } - while (size && rc >= 0) - { + while (size && rc >= 0) { SmsDataDownload_ST *DataMsg = (SmsDataDownload_ST *) msg; int payload_size = min((int) size, SMS_MAX_PAYLOAD_SIZE); @@ -530,11 +529,11 @@ int smscore_load_firmware_family2(smscore_device_t *coredev, void *buffer, sizeof(SmsMsgHdr_ST) + sizeof(u32) * 5); - TriggerMsg->msgData[0] = firmware->StartAddress; // Entry point - TriggerMsg->msgData[1] = 5; // Priority - TriggerMsg->msgData[2] = 0x200; // Stack size - TriggerMsg->msgData[3] = 0; // Parameter - TriggerMsg->msgData[4] = 4; // Task ID + TriggerMsg->msgData[0] = firmware->StartAddress; /* Entry point */ + TriggerMsg->msgData[1] = 5; /* Priority */ + TriggerMsg->msgData[2] = 0x200; /* Stack size */ + TriggerMsg->msgData[3] = 0; /* Parameter */ + TriggerMsg->msgData[4] = 4; /* Task ID */ if (coredev->device_flags & SMS_ROM_NO_RESPONSE) { rc = coredev->sendrequest_handler(coredev->context, TriggerMsg, TriggerMsg->xMsgHeader.msgLength); @@ -642,7 +641,7 @@ void smscore_unregister_device(smscore_device_t *coredev) while (1) { while ((cb = smscore_getbuffer(coredev))) { kfree(cb); - num_buffers ++; + num_buffers++; } if (num_buffers == coredev->num_buffers) break; @@ -842,14 +841,14 @@ smscore_client_t *smscore_find_client(smscore_device_t *coredev, int data_type, for (next = first->next; (next != first) && !client; next = next->next) { - firstid = &((smscore_client_t*)next)->idlist; + firstid = &((smscore_client_t *)next)->idlist; for (nextid = firstid->next; nextid != firstid; nextid = nextid->next) { - if ((((smscore_idlist_t*)nextid)->id == id) && - (((smscore_idlist_t*)nextid)->data_type == data_type || - (((smscore_idlist_t*)nextid)->data_type == 0))) { - client = (smscore_client_t*) next; + if ((((smscore_idlist_t *)nextid)->id == id) && + (((smscore_idlist_t *)nextid)->data_type == data_type || + (((smscore_idlist_t *)nextid)->data_type == 0))) { + client = (smscore_client_t *) next; break; } } @@ -880,8 +879,7 @@ void smscore_onresponse(smscore_device_t *coredev, smscore_buffer_t *cb) if (!last_sample_time) last_sample_time = time_now; - if (time_now - last_sample_time > 10000) - { + if (time_now - last_sample_time > 10000) { printk("\n%s data rate %d bytes/secs\n", __func__, (int)((data_total * 1000) / (time_now - last_sample_time))); @@ -989,9 +987,9 @@ int smscore_validate_client(smscore_device_t *coredev, return -EFAULT; } registered_client = smscore_find_client(coredev, data_type, id); - if (registered_client == client) { + if (registered_client == client) return 0; - } + if (registered_client) { PERROR("The msg ID already registered to another client.\n"); return -EEXIST; @@ -1069,7 +1067,7 @@ void smscore_unregister_client(smscore_client_t *client) while (!list_empty(&client->idlist)) { smscore_idlist_t *identry = - (smscore_idlist_t*) client->idlist.next; + (smscore_idlist_t *) client->idlist.next; list_del(&identry->entry); kfree(identry); } diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index a5c4c0409a2..4860e318a5b 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h @@ -45,7 +45,7 @@ typedef struct mutex kmutex_t; #ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) +#define min(a, b) (((a) < (b)) ? (a) : (b)) #endif #define SMS_ALLOC_ALIGNMENT 128 @@ -57,7 +57,7 @@ typedef struct mutex kmutex_t; #define SMS_DEVICE_NOT_READY 0x8000000 typedef enum { - SMS_STELLAR= 0, + SMS_STELLAR = 0, SMS_NOVA_A0, SMS_NOVA_B0, SMS_VEGA, diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index 13980fb649c..e3f09646bb8 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) smsdvb_client_t *client = (smsdvb_client_t *) context; SmsMsgHdr_ST *phdr = (SmsMsgHdr_ST *)(((u8 *) cb->p) + cb->offset); - switch(phdr->msgType) { + switch (phdr->msgType) { case MSG_SMS_DVBT_BDA_DATA: dvb_dmx_swfilter(&client->demux, (u8 *)(phdr + 1), cb->size - sizeof(SmsMsgHdr_ST)); @@ -49,8 +49,7 @@ int smsdvb_onresponse(void *context, smscore_buffer_t *cb) SmsMsgStatisticsInfo_ST *p = (SmsMsgStatisticsInfo_ST *)(phdr + 1); - if (p->Stat.IsDemodLocked) - { + if (p->Stat.IsDemodLocked) { client->fe_status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | @@ -85,7 +84,7 @@ int smsdvb_onresponse(void *context, smscore_buffer_t *cb) void smsdvb_unregister_client(smsdvb_client_t *client) { - // must be called under clientslock + /* must be called under clientslock */ list_del(&client->entry); @@ -243,13 +242,12 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe, printk("%s freq %d band %d\n", __func__, fep->frequency, fep->u.ofdm.bandwidth); - switch(fep->u.ofdm.bandwidth) - { - case BANDWIDTH_8_MHZ: Msg.Data[1] = BW_8_MHZ; break; - case BANDWIDTH_7_MHZ: Msg.Data[1] = BW_7_MHZ; break; - case BANDWIDTH_6_MHZ: Msg.Data[1] = BW_6_MHZ; break; - case BANDWIDTH_AUTO: return -EOPNOTSUPP; - default: return -EINVAL; + switch (fep->u.ofdm.bandwidth) { + case BANDWIDTH_8_MHZ: Msg.Data[1] = BW_8_MHZ; break; + case BANDWIDTH_7_MHZ: Msg.Data[1] = BW_7_MHZ; break; + case BANDWIDTH_6_MHZ: Msg.Data[1] = BW_6_MHZ; break; + case BANDWIDTH_AUTO: return -EOPNOTSUPP; + default: return -EINVAL; } return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), @@ -263,7 +261,7 @@ static int smsdvb_get_frontend(struct dvb_frontend *fe, printk("%s\n", __func__); - // todo: + /* todo: */ memcpy(fep, &client->fe_params, sizeof(struct dvb_frontend_parameters)); return 0; @@ -271,7 +269,7 @@ static int smsdvb_get_frontend(struct dvb_frontend *fe, static void smsdvb_release(struct dvb_frontend *fe) { - // do nothing + /* do nothing */ } static struct dvb_frontend_ops smsdvb_fe_ops = { @@ -310,7 +308,7 @@ int smsdvb_hotplug(smscore_device_t *coredev, smsdvb_client_t *client; int rc; - // device removal handled by onremove callback + /* device removal handled by onremove callback */ if (!arrival) return 0; @@ -325,7 +323,7 @@ int smsdvb_hotplug(smscore_device_t *coredev, return -ENOMEM; } - // register dvb adapter + /* register dvb adapter */ rc = dvb_register_adapter(&client->adapter, "Siano Digital Receiver", THIS_MODULE, device, adapter_nr); if (rc < 0) { @@ -333,9 +331,9 @@ int smsdvb_hotplug(smscore_device_t *coredev, goto adapter_error; } - // init dvb demux + /* init dvb demux */ client->demux.dmx.capabilities = DMX_TS_FILTERING; - client->demux.filternum = 32; // todo: nova ??? + client->demux.filternum = 32; /* todo: nova ??? */ client->demux.feednum = 32; client->demux.start_feed = smsdvb_start_feed; client->demux.stop_feed = smsdvb_stop_feed; @@ -346,7 +344,7 @@ int smsdvb_hotplug(smscore_device_t *coredev, goto dvbdmx_error; } - // init dmxdev + /* init dmxdev */ client->dmxdev.filternum = 32; client->dmxdev.demux = &client->demux.dmx; client->dmxdev.capabilities = 0; @@ -357,7 +355,7 @@ int smsdvb_hotplug(smscore_device_t *coredev, goto dmxdev_error; } - // init and register frontend + /* init and register frontend */ memcpy(&client->frontend.ops, &smsdvb_fe_ops, sizeof(struct dvb_frontend_ops)); diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index d9ce3ba0910..2361f1a5e3c 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) { int i; - for (i = 0; i < MAX_URBS; i ++) { + for (i = 0; i < MAX_URBS; i++) { usb_kill_urb(&dev->surbs[i].urb); if (dev->surbs[i].cb) { @@ -163,7 +163,7 @@ int smsusb_start_streaming(smsusb_device_t *dev) { int i, rc; - for (i = 0; i < MAX_URBS; i ++) { + for (i = 0; i < MAX_URBS; i++) { rc = smsusb_submit_urb(dev, &dev->surbs[i]); if (rc < 0) { printk(KERN_INFO "%s smsusb_submit_urb(...) " @@ -275,7 +275,7 @@ void smsusb_term_device(struct usb_interface *intf) if (dev) { smsusb_stop_streaming(dev); - // unregister from smscore + /* unregister from smscore */ if (dev->coredev) smscore_unregister_device(dev->coredev); @@ -293,7 +293,7 @@ int smsusb_init_device(struct usb_interface *intf) smsusb_device_t *dev; int i, rc; - // create device object + /* create device object */ dev = kzalloc(sizeof(smsusb_device_t), GFP_KERNEL); if (!dev) { printk(KERN_INFO "%s kzalloc(sizeof(smsusb_device_t) failed\n", @@ -313,13 +313,13 @@ int smsusb_init_device(struct usb_interface *intf) params.setmode_handler = smsusb1_setmode; params.detectmode_handler = smsusb1_detectmode; params.device_type = SMS_STELLAR; - printk(KERN_INFO "%s stellar device found\n", __func__ ); + printk(KERN_INFO "%s stellar device found\n", __func__); break; default: switch (dev->udev->descriptor.idProduct) { case USB_PID_NOVA_A: params.device_type = SMS_NOVA_A0; - printk(KERN_INFO "%s nova A0 found\n", __func__ ); + printk(KERN_INFO "%s nova A0 found\n", __func__); break; default: case USB_PID_NOVA_B: @@ -357,7 +357,7 @@ int smsusb_init_device(struct usb_interface *intf) return rc; } - // initialize urbs + /* initialize urbs */ for (i = 0; i < MAX_URBS; i++) { dev->surbs[i].dev = dev; usb_init_urb(&dev->surbs[i].urb); @@ -405,7 +405,7 @@ int smsusb_probe(struct usb_interface *intf, const struct usb_device_id *id) printk(KERN_INFO "smsusb_probe %d\n", intf->cur_altsetting->desc.bInterfaceNumber); - for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i ++) + for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) printk(KERN_INFO "endpoint %d %02x %02x %d\n", i, intf->cur_altsetting->endpoint[i].desc.bEndpointAddress, intf->cur_altsetting->endpoint[i].desc.bmAttributes, @@ -440,7 +440,7 @@ static struct usb_device_id smsusb_id_table [] = { { USB_DEVICE(USB_VID_SIANO, USB_PID_NOVA_A) }, { } /* Terminating entry */ }; -MODULE_DEVICE_TABLE (usb, smsusb_id_table); +MODULE_DEVICE_TABLE(usb, smsusb_id_table); static struct usb_driver smsusb_driver = { .name = "smsusb", -- cgit v1.2.3-70-g09d2