From 9fa728ea35501fb5cd56880839ad867265c61822 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Sun, 29 Jan 2012 16:55:28 -0300 Subject: [media] easycap: Fix mem leak in easycap_usb_probe() If allocating 'pdata_urb' fails, the function will return -ENOMEM without freeing the memory allocated, just a few lines above, for 'purb' and will leak that memory when 'purb' goes out of scope. This patch resolves the leak by freeing the allocated storage with usb_free_urb() before the return. Signed-off-by: Jesper Juhl Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/easycap/easycap_main.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/media/easycap/easycap_main.c b/drivers/staging/media/easycap/easycap_main.c index 8ff5f38ea196..3d439b790cc6 100644 --- a/drivers/staging/media/easycap/easycap_main.c +++ b/drivers/staging/media/easycap/easycap_main.c @@ -3825,6 +3825,7 @@ static int easycap_usb_probe(struct usb_interface *intf, /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ pdata_urb = kzalloc(sizeof(struct data_urb), GFP_KERNEL); if (!pdata_urb) { + usb_free_urb(purb); SAM("ERROR: Could not allocate struct data_urb.\n"); return -ENOMEM; } -- cgit v1.2.3 From 0c07aec31a98a63ee83f2bbad4a2fab0e0f58d33 Mon Sep 17 00:00:00 2001 From: Alexey Khoroshilov Date: Mon, 13 Feb 2012 11:01:32 -0300 Subject: [media] staging: go7007: fix mismatch in mutex lock-unlock in [read|write]_reg_fp If go7007_usb_vendor_request() fails in write_reg_fp() or in read_reg_fp(), the usb->i2c_lock mutex left locked. The patch moves mutex_unlock(&usb->i2c_lock) before check for go7007_usb_vendor_request() returned value. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/go7007/s2250-board.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/go7007/s2250-board.c b/drivers/staging/media/go7007/s2250-board.c index e7736a915530..014d38410c99 100644 --- a/drivers/staging/media/go7007/s2250-board.c +++ b/drivers/staging/media/go7007/s2250-board.c @@ -192,6 +192,7 @@ static int write_reg_fp(struct i2c_client *client, u16 addr, u16 val) { struct go7007 *go = i2c_get_adapdata(client->adapter); struct go7007_usb *usb; + int rc; u8 *buf; struct s2250 *dec = i2c_get_clientdata(client); @@ -216,12 +217,13 @@ static int write_reg_fp(struct i2c_client *client, u16 addr, u16 val) kfree(buf); return -EINTR; } - if (go7007_usb_vendor_request(go, 0x57, addr, val, buf, 16, 1) < 0) { + rc = go7007_usb_vendor_request(go, 0x57, addr, val, buf, 16, 1); + mutex_unlock(&usb->i2c_lock); + if (rc < 0) { kfree(buf); - return -EFAULT; + return rc; } - mutex_unlock(&usb->i2c_lock); if (buf[0] == 0) { unsigned int subaddr, val_read; @@ -254,6 +256,7 @@ static int read_reg_fp(struct i2c_client *client, u16 addr, u16 *val) { struct go7007 *go = i2c_get_adapdata(client->adapter); struct go7007_usb *usb; + int rc; u8 *buf; if (go == NULL) @@ -276,11 +279,12 @@ static int read_reg_fp(struct i2c_client *client, u16 addr, u16 *val) kfree(buf); return -EINTR; } - if (go7007_usb_vendor_request(go, 0x58, addr, 0, buf, 16, 1) < 0) { + rc = go7007_usb_vendor_request(go, 0x58, addr, 0, buf, 16, 1); + mutex_unlock(&usb->i2c_lock); + if (rc < 0) { kfree(buf); - return -EFAULT; + return rc; } - mutex_unlock(&usb->i2c_lock); *val = (buf[0] << 8) | buf[1]; kfree(buf); -- cgit v1.2.3 From f8f7be019ac801950512cfb040949ccc380be301 Mon Sep 17 00:00:00 2001 From: Gianluca Gennari Date: Tue, 14 Feb 2012 09:25:00 -0300 Subject: [media] as102: map URB DMA addresses in the driver On a set-top-box based on the Broadcom 7405 SoC (MIPS), the Abilis as102 driver causes a kernel oops while trying to map the URB stream buffers DMA addresses: CPU 0 Unable to handle kernel paging request at virtual address 007b9900, epc == 80010cc4, ra == 8039d108 Call Trace: [<80010cc4>] mips_dma_map_page+0x14/0x108 [<8039d108>] usb_hcd_map_urb_for_dma+0x338/0x4a8 [<8039d540>] usb_hcd_submit_urb+0x2c8/0x8cc [] as102_submit_urb_stream+0x64/0xc8 [dvb_as102] [] as102_usb_start_stream+0x44/0x80 [dvb_as102] [] as102_dvb_dmx_start_feed+0xb4/0x17c [dvb_as102] [<803e20f4>] dmx_ts_feed_start_filtering+0x5c/0x134 [<803de454>] dvb_dmxdev_start_feed+0xd4/0x158 [<803dff28>] dvb_dmxdev_filter_start+0x2b8/0x448 [<803e07ac>] dvb_demux_do_ioctl+0x2a0/0x654 [<803ddc8c>] dvb_usercopy+0x124/0x204 [<800d5284>] do_vfs_ioctl+0xa0/0x6c0 [<800d58e8>] sys_ioctl+0x44/0xa8 [<8000ecfc>] stack_done+0x20/0x40 On other boxes based on older SoCs (7401) this doesn't happen, so it looks like a bug in the kernel specific to MIPS SMP. This issue has been reproduced on several kernel versions from 2.6.18 to 3.1.0. Since the base DMA address and the offsets are known, it is possible to map the DMA addresses of the URB buffers directly in the driver. This workaround fixes the problem and has been tested on both MIPS and x86 CPUs with success. By the way, with this fix the driver works perfectly fine on the set-top-box: both UHF and VHF frequencies are tuned without problems, and zapping is quite fast. SNR and signal strength reports seems to work fine, too. The only remaining problem (on both the PC and the set-top-box) is that after a soft reboot the device is not recognized again by the kernel. It requires a power cycle (or a manual unplug/replug) to be recognized again. So probably the device state is not reset properly at shut-down. Signed-off-by: Gianluca Gennari Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/as102/as102_usb_drv.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/media/as102/as102_usb_drv.c b/drivers/staging/media/as102/as102_usb_drv.c index d775be0173ea..8d2c84c36a5c 100644 --- a/drivers/staging/media/as102/as102_usb_drv.c +++ b/drivers/staging/media/as102/as102_usb_drv.c @@ -270,6 +270,8 @@ static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) } urb->transfer_buffer = dev->stream + (i * AS102_USB_BUF_SIZE); + urb->transfer_dma = dev->dma_addr + (i * AS102_USB_BUF_SIZE); + urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; urb->transfer_buffer_length = AS102_USB_BUF_SIZE; dev->stream_urb[i] = urb; -- cgit v1.2.3 From 2bc1e212b3f1f783cae9adc5d16aa1a899dc2f82 Mon Sep 17 00:00:00 2001 From: Ezequiel García Date: Wed, 22 Feb 2012 18:46:14 -0300 Subject: [media] staging: easycap: Clean comment style in easycap_usb_probe() Some of these comments may still need to be reviewed. This patch only cleans the comment style. Signed-off-by: Ezequiel Garcia Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/easycap/easycap_main.c | 243 +++++++++------------------ 1 file changed, 79 insertions(+), 164 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/easycap/easycap_main.c b/drivers/staging/media/easycap/easycap_main.c index 3d439b790cc6..95f3cc1867db 100644 --- a/drivers/staging/media/easycap/easycap_main.c +++ b/drivers/staging/media/easycap/easycap_main.c @@ -2849,13 +2849,11 @@ static const struct v4l2_file_operations v4l2_fops = { .poll = easycap_poll, .mmap = easycap_mmap, }; -/*****************************************************************************/ -/*---------------------------------------------------------------------------*/ + /* - * WHEN THE EasyCAP IS PHYSICALLY PLUGGED IN, THIS FUNCTION IS CALLED THREE - * TIMES, ONCE FOR EACH OF THE THREE INTERFACES. BEWARE. + * When the device is plugged, this function is called three times, + * one for each interface. */ -/*---------------------------------------------------------------------------*/ static int easycap_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -2884,7 +2882,6 @@ static int easycap_usb_probe(struct usb_interface *intf, usbdev = interface_to_usbdev(intf); -/*---------------------------------------------------------------------------*/ alt = usb_altnum_to_altsetting(intf, 0); if (!alt) { SAY("ERROR: usb_host_interface not found\n"); @@ -2896,11 +2893,8 @@ static int easycap_usb_probe(struct usb_interface *intf, SAY("ERROR: intf_descriptor is NULL\n"); return -EFAULT; } -/*---------------------------------------------------------------------------*/ -/* - * GET PROPERTIES OF PROBED INTERFACE - */ -/*---------------------------------------------------------------------------*/ + + /* Get properties of probed interface */ bInterfaceNumber = interface->bInterfaceNumber; bInterfaceClass = interface->bInterfaceClass; bInterfaceSubClass = interface->bInterfaceSubClass; @@ -2912,28 +2906,23 @@ static int easycap_usb_probe(struct usb_interface *intf, (long int)(intf->cur_altsetting - intf->altsetting)); JOT(4, "intf[%i]: bInterfaceClass=0x%02X bInterfaceSubClass=0x%02X\n", bInterfaceNumber, bInterfaceClass, bInterfaceSubClass); -/*---------------------------------------------------------------------------*/ -/* - * A NEW struct easycap IS ALWAYS ALLOCATED WHEN INTERFACE 0 IS PROBED. - * IT IS NOT POSSIBLE HERE TO FREE ANY EXISTING struct easycap. THIS - * SHOULD HAVE BEEN DONE BY easycap_delete() WHEN THE EasyCAP WAS - * PHYSICALLY UNPLUGGED. - * - * THE POINTER peasycap TO THE struct easycap IS REMEMBERED WHEN - * INTERFACES 1 AND 2 ARE PROBED. -*/ -/*---------------------------------------------------------------------------*/ + + /* + * A new struct easycap is always allocated when interface 0 is probed. + * It is not possible here to free any existing struct easycap. + * This should have been done by easycap_delete() when the device was + * physically unplugged. + * The allocated struct easycap is saved for later usage when + * interfaces 1 and 2 are probed. + */ if (0 == bInterfaceNumber) { peasycap = kzalloc(sizeof(struct easycap), GFP_KERNEL); if (!peasycap) { SAY("ERROR: Could not allocate peasycap\n"); return -ENOMEM; } -/*---------------------------------------------------------------------------*/ -/* - * PERFORM URGENT INTIALIZATIONS ... -*/ -/*---------------------------------------------------------------------------*/ + + /* Perform urgent initializations */ peasycap->minor = -1; kref_init(&peasycap->kref); JOM(8, "intf[%i]: after kref_init(..._video) " @@ -2976,11 +2965,7 @@ static int easycap_usb_probe(struct usb_interface *intf, peasycap->allocation_video_struct = sizeof(struct easycap); -/*---------------------------------------------------------------------------*/ -/* - * ... AND FURTHER INITIALIZE THE STRUCTURE -*/ -/*---------------------------------------------------------------------------*/ + /* and further initialize the structure */ peasycap->pusb_device = usbdev; peasycap->pusb_interface = intf; @@ -3002,11 +2987,7 @@ static int easycap_usb_probe(struct usb_interface *intf, peasycap->frame_buffer_many = FRAME_BUFFER_MANY; -/*---------------------------------------------------------------------------*/ -/* - * DYNAMICALLY FILL IN THE AVAILABLE FORMATS ... - */ -/*---------------------------------------------------------------------------*/ + /* Dynamically fill in the available formats */ rc = easycap_video_fillin_formats(); if (0 > rc) { SAM("ERROR: fillin_formats() rc = %i\n", rc); @@ -3014,10 +2995,8 @@ static int easycap_usb_probe(struct usb_interface *intf, } JOM(4, "%i formats available\n", rc); - /* ... AND POPULATE easycap.inputset[] */ - + /* Populate easycap.inputset[] */ inputset = peasycap->inputset; - fmtidx = peasycap->ntsc ? NTSC_M : PAL_BGHIN; m = 0; mask = 0; @@ -3030,7 +3009,6 @@ static int easycap_usb_probe(struct usb_interface *intf, mask = easycap_standard[i].mask; } } - if (1 != m) { SAM("ERROR: " "inputset->standard_offset unpopulated, %i=m\n", m); @@ -3089,14 +3067,13 @@ static int easycap_usb_probe(struct usb_interface *intf, JOM(4, "populated inputset[]\n"); JOM(4, "finished initialization\n"); } else { -/*---------------------------------------------------------------------------*/ -/* - * FIXME - * - * IDENTIFY THE APPROPRIATE POINTER peasycap FOR INTERFACES 1 AND 2. - * THE ADDRESS OF peasycap->pusb_device IS RELUCTANTLY USED FOR THIS PURPOSE. - */ -/*---------------------------------------------------------------------------*/ + + /* + * FIXME: Identify the appropriate pointer + * peasycap for interfaces 1 and 2. + * The address of peasycap->pusb_device + * is reluctantly used for this purpose. + */ for (ndong = 0; ndong < DONGLE_MANY; ndong++) { if (usbdev == easycapdc60_dongle[ndong].peasycap-> pusb_device) { @@ -3117,7 +3094,7 @@ static int easycap_usb_probe(struct usb_interface *intf, return -ENODEV; } } -/*---------------------------------------------------------------------------*/ + if ((USB_CLASS_VIDEO == bInterfaceClass) || (USB_CLASS_VENDOR_SPEC == bInterfaceClass)) { if (-1 == peasycap->video_interface) { @@ -3149,14 +3126,12 @@ static int easycap_usb_probe(struct usb_interface *intf, } } } -/*---------------------------------------------------------------------------*/ -/* - * INVESTIGATE ALL ALTSETTINGS. - * DONE IN DETAIL BECAUSE USB DEVICE 05e1:0408 HAS DISPARATE INCARNATIONS. - */ -/*---------------------------------------------------------------------------*/ - isokalt = 0; + /* + * Investigate all altsettings. This is done in detail + * because USB device 05e1:0408 has disparate incarnations. + */ + isokalt = 0; for (i = 0; i < intf->num_altsetting; i++) { alt = usb_altnum_to_altsetting(intf, i); if (!alt) { @@ -3172,7 +3147,6 @@ static int easycap_usb_probe(struct usb_interface *intf, if (0 == interface->bNumEndpoints) JOM(4, "intf[%i]alt[%i] has no endpoints\n", bInterfaceNumber, i); -/*---------------------------------------------------------------------------*/ for (j = 0; j < interface->bNumEndpoints; j++) { ep = &alt->endpoint[j].desc; if (!ep) { @@ -3312,19 +3286,12 @@ static int easycap_usb_probe(struct usb_interface *intf, } } } -/*---------------------------------------------------------------------------*/ -/* - * PERFORM INITIALIZATION OF THE PROBED INTERFACE - */ -/*---------------------------------------------------------------------------*/ + + /* Perform initialization of the probed interface */ JOM(4, "initialization begins for interface %i\n", interface->bInterfaceNumber); switch (bInterfaceNumber) { -/*---------------------------------------------------------------------------*/ -/* - * INTERFACE 0 IS THE VIDEO INTERFACE - */ -/*---------------------------------------------------------------------------*/ + /* 0: Video interface */ case 0: { if (!peasycap) { SAM("MISTAKE: peasycap is NULL\n"); @@ -3337,11 +3304,8 @@ static int easycap_usb_probe(struct usb_interface *intf, peasycap->video_altsetting_on = okalt[isokalt - 1]; JOM(4, "%i=video_altsetting_on <====\n", peasycap->video_altsetting_on); -/*---------------------------------------------------------------------------*/ -/* - * DECIDE THE VIDEO STREAMING PARAMETERS - */ -/*---------------------------------------------------------------------------*/ + + /* Decide video streaming parameters */ peasycap->video_endpointnumber = okepn[isokalt - 1]; JOM(4, "%i=video_endpointnumber\n", peasycap->video_endpointnumber); maxpacketsize = okmps[isokalt - 1]; @@ -3373,7 +3337,6 @@ static int easycap_usb_probe(struct usb_interface *intf, SAM("MISTAKE: peasycap->video_isoc_buffer_size too big\n"); return -EFAULT; } -/*---------------------------------------------------------------------------*/ if (-1 == peasycap->video_interface) { SAM("MISTAKE: video_interface is unset\n"); return -EFAULT; @@ -3398,14 +3361,13 @@ static int easycap_usb_probe(struct usb_interface *intf, SAM("MISTAKE: video_isoc_buffer_size is unset\n"); return -EFAULT; } -/*---------------------------------------------------------------------------*/ -/* - * ALLOCATE MEMORY FOR VIDEO BUFFERS. LISTS MUST BE INITIALIZED FIRST. - */ -/*---------------------------------------------------------------------------*/ + + /* + * Allocate memory for video buffers. + * Lists must be initialized first. + */ INIT_LIST_HEAD(&(peasycap->urb_video_head)); peasycap->purb_video_head = &(peasycap->urb_video_head); -/*---------------------------------------------------------------------------*/ JOM(4, "allocating %i frame buffers of size %li\n", FRAME_BUFFER_MANY, (long int)FRAME_BUFFER_SIZE); JOM(4, ".... each scattered over %li pages\n", @@ -3436,7 +3398,6 @@ static int easycap_usb_probe(struct usb_interface *intf, peasycap->frame_read = 0; JOM(4, "allocation of frame buffers done: %i pages\n", k * m); -/*---------------------------------------------------------------------------*/ JOM(4, "allocating %i field buffers of size %li\n", FIELD_BUFFER_MANY, (long int)FIELD_BUFFER_SIZE); JOM(4, ".... each scattered over %li pages\n", @@ -3468,7 +3429,6 @@ static int easycap_usb_probe(struct usb_interface *intf, peasycap->field_read = 0; JOM(4, "allocation of field buffers done: %i pages\n", k * m); -/*---------------------------------------------------------------------------*/ JOM(4, "allocating %i isoc video buffers of size %i\n", VIDEO_ISOC_BUFFER_MANY, peasycap->video_isoc_buffer_size); @@ -3492,11 +3452,8 @@ static int easycap_usb_probe(struct usb_interface *intf, } JOM(4, "allocation of isoc video buffers done: %i pages\n", k * (0x01 << VIDEO_ISOC_ORDER)); -/*---------------------------------------------------------------------------*/ -/* - * ALLOCATE AND INITIALIZE MULTIPLE struct urb ... - */ -/*---------------------------------------------------------------------------*/ + + /* Allocate and initialize multiple struct usb */ JOM(4, "allocating %i struct urb.\n", VIDEO_ISOC_BUFFER_MANY); JOM(4, "using %i=peasycap->video_isoc_framesperdesc\n", peasycap->video_isoc_framesperdesc); @@ -3515,7 +3472,6 @@ static int easycap_usb_probe(struct usb_interface *intf, } peasycap->allocation_video_urb += 1; -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ pdata_urb = kzalloc(sizeof(struct data_urb), GFP_KERNEL); if (!pdata_urb) { SAM("ERROR: Could not allocate struct data_urb.\n"); @@ -3530,11 +3486,8 @@ static int easycap_usb_probe(struct usb_interface *intf, pdata_urb->length = 0; list_add_tail(&(pdata_urb->list_head), peasycap->purb_video_head); -/*---------------------------------------------------------------------------*/ -/* - * ... AND INITIALIZE THEM - */ -/*---------------------------------------------------------------------------*/ + + /* Initialize allocated urbs */ if (!k) { JOM(4, "initializing video urbs thus:\n"); JOM(4, " purb->interval = 1;\n"); @@ -3582,20 +3535,17 @@ static int easycap_usb_probe(struct usb_interface *intf, } } JOM(4, "allocation of %i struct urb done.\n", k); -/*--------------------------------------------------------------------------*/ -/* - * SAVE POINTER peasycap IN THIS INTERFACE. - */ -/*--------------------------------------------------------------------------*/ + + /* Save pointer peasycap in this interface */ usb_set_intfdata(intf, peasycap); -/*---------------------------------------------------------------------------*/ -/* - * IT IS ESSENTIAL TO INITIALIZE THE HARDWARE BEFORE, RATHER THAN AFTER, - * THE DEVICE IS REGISTERED, BECAUSE SOME VERSIONS OF THE videodev MODULE - * CALL easycap_open() IMMEDIATELY AFTER REGISTRATION, CAUSING A CLASH. - * BEWARE. -*/ -/*---------------------------------------------------------------------------*/ + + /* + * It is essential to initialize the hardware before, + * rather than after, the device is registered, + * because some versions of the videodev module + * call easycap_open() immediately after registration, + * causing a clash. + */ peasycap->ntsc = easycap_ntsc; JOM(8, "defaulting initially to %s\n", easycap_ntsc ? "NTSC" : "PAL"); @@ -3604,27 +3554,20 @@ static int easycap_usb_probe(struct usb_interface *intf, SAM("ERROR: reset() rc = %i\n", rc); return -EFAULT; } -/*--------------------------------------------------------------------------*/ -/* - * THE VIDEO DEVICE CAN BE REGISTERED NOW, AS IT IS READY. - */ -/*--------------------------------------------------------------------------*/ + + /* The video device can now be registered */ if (v4l2_device_register(&intf->dev, &peasycap->v4l2_device)) { SAM("v4l2_device_register() failed\n"); return -ENODEV; } JOM(4, "registered device instance: %s\n", peasycap->v4l2_device.name); -/*---------------------------------------------------------------------------*/ -/* - * FIXME - * - * - * THIS IS BELIEVED TO BE HARMLESS, BUT MAY WELL BE UNNECESSARY OR WRONG: -*/ -/*---------------------------------------------------------------------------*/ + + /* + * FIXME: This is believed to be harmless, + * but may well be unnecessary or wrong. + */ peasycap->video_device.v4l2_dev = NULL; -/*---------------------------------------------------------------------------*/ strcpy(&peasycap->video_device.name[0], "easycapdc60"); @@ -3648,28 +3591,19 @@ static int easycap_usb_probe(struct usb_interface *intf, break; } -/*--------------------------------------------------------------------------*/ -/* - * INTERFACE 1 IS THE AUDIO CONTROL INTERFACE - * INTERFACE 2 IS THE AUDIO STREAMING INTERFACE - */ -/*--------------------------------------------------------------------------*/ + /* 1: Audio control */ case 1: { if (!peasycap) { SAM("MISTAKE: peasycap is NULL\n"); return -EFAULT; } -/*--------------------------------------------------------------------------*/ -/* - * SAVE POINTER peasycap IN INTERFACE 1 - */ -/*--------------------------------------------------------------------------*/ + /* Save pointer peasycap in this interface */ usb_set_intfdata(intf, peasycap); JOM(4, "no initialization required for interface %i\n", interface->bInterfaceNumber); break; } -/*--------------------------------------------------------------------------*/ + /* 2: Audio streaming */ case 2: { if (!peasycap) { SAM("MISTAKE: peasycap is NULL\n"); @@ -3769,15 +3703,14 @@ static int easycap_usb_probe(struct usb_interface *intf, SAM("MISTAKE: audio_isoc_buffer_size is unset\n"); return -EFAULT; } -/*---------------------------------------------------------------------------*/ -/* - * ALLOCATE MEMORY FOR AUDIO BUFFERS. LISTS MUST BE INITIALIZED FIRST. - */ -/*---------------------------------------------------------------------------*/ + + /* + * Allocate memory for audio buffers. + * Lists must be initialized first. + */ INIT_LIST_HEAD(&(peasycap->urb_audio_head)); peasycap->purb_audio_head = &(peasycap->urb_audio_head); -/*---------------------------------------------------------------------------*/ JOM(4, "allocating %i isoc audio buffers of size %i\n", AUDIO_ISOC_BUFFER_MANY, peasycap->audio_isoc_buffer_size); @@ -3800,11 +3733,8 @@ static int easycap_usb_probe(struct usb_interface *intf, peasycap->audio_isoc_buffer[k].kount = k; } JOM(4, "allocation of isoc audio buffers done.\n"); -/*---------------------------------------------------------------------------*/ -/* - * ALLOCATE AND INITIALIZE MULTIPLE struct urb ... - */ -/*---------------------------------------------------------------------------*/ + + /* Allocate and initialize urbs */ JOM(4, "allocating %i struct urb.\n", AUDIO_ISOC_BUFFER_MANY); JOM(4, "using %i=peasycap->audio_isoc_framesperdesc\n", peasycap->audio_isoc_framesperdesc); @@ -3822,7 +3752,6 @@ static int easycap_usb_probe(struct usb_interface *intf, return -ENOMEM; } peasycap->allocation_audio_urb += 1 ; -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ pdata_urb = kzalloc(sizeof(struct data_urb), GFP_KERNEL); if (!pdata_urb) { usb_free_urb(purb); @@ -3837,11 +3766,7 @@ static int easycap_usb_probe(struct usb_interface *intf, pdata_urb->length = 0; list_add_tail(&(pdata_urb->list_head), peasycap->purb_audio_head); -/*---------------------------------------------------------------------------*/ -/* - * ... AND INITIALIZE THEM - */ -/*---------------------------------------------------------------------------*/ + if (!k) { JOM(4, "initializing audio urbs thus:\n"); JOM(4, " purb->interval = 1;\n"); @@ -3889,17 +3814,11 @@ static int easycap_usb_probe(struct usb_interface *intf, } } JOM(4, "allocation of %i struct urb done.\n", k); -/*---------------------------------------------------------------------------*/ -/* - * SAVE POINTER peasycap IN THIS INTERFACE. - */ -/*---------------------------------------------------------------------------*/ + + /* Save pointer peasycap in this interface */ usb_set_intfdata(intf, peasycap); -/*---------------------------------------------------------------------------*/ -/* - * THE AUDIO DEVICE CAN BE REGISTERED NOW, AS IT IS READY. - */ -/*---------------------------------------------------------------------------*/ + + /* The audio device can now be registered */ JOM(4, "initializing ALSA card\n"); rc = easycap_alsa_probe(peasycap); @@ -3915,11 +3834,7 @@ static int easycap_usb_probe(struct usb_interface *intf, peasycap->registered_audio++; break; } -/*---------------------------------------------------------------------------*/ -/* - * INTERFACES OTHER THAN 0, 1 AND 2 ARE UNEXPECTED - */ -/*---------------------------------------------------------------------------*/ + /* Interfaces other than 0,1,2 are unexpected */ default: JOM(4, "ERROR: unexpected interface %i\n", bInterfaceNumber); return -EINVAL; -- cgit v1.2.3 From d994c46d4309df85aea86049024cadfcbf523116 Mon Sep 17 00:00:00 2001 From: Ezequiel García Date: Wed, 22 Feb 2012 18:46:15 -0300 Subject: [media] staging: easycap: Fix incorrect comment Signed-off-by: Ezequiel Garcia Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/easycap/easycap_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/easycap/easycap_main.c b/drivers/staging/media/easycap/easycap_main.c index 95f3cc1867db..d0fe34afc2e5 100644 --- a/drivers/staging/media/easycap/easycap_main.c +++ b/drivers/staging/media/easycap/easycap_main.c @@ -3542,9 +3542,8 @@ static int easycap_usb_probe(struct usb_interface *intf, /* * It is essential to initialize the hardware before, * rather than after, the device is registered, - * because some versions of the videodev module - * call easycap_open() immediately after registration, - * causing a clash. + * because some udev rules triggers easycap_open() + * immediately after registration, causing a clash. */ peasycap->ntsc = easycap_ntsc; JOM(8, "defaulting initially to %s\n", -- cgit v1.2.3 From abf9d005375d6c6160cc9c17e5dcac32e412c8dc Mon Sep 17 00:00:00 2001 From: Gianluca Gennari Date: Tue, 6 Mar 2012 09:47:45 -0300 Subject: [media] as102: add __packed attribute to structs defined inside packed structs This patch fixes a regression in kernel 3.3 due to this patch: http://patchwork.linuxtv.org/patch/8332/ That patch changes "#pragma pack(1)" with "__packed" attributes, but it is not complete. In fact, in the as102 driver there are a lot of structs/unions defined inside other structs/unions. When the "__packed" attribute is applied only on the external struct, it will not affect the internal struct definitions. So the regression is fixed by specifiying the "__packed" attribute also on the internal structs. This patch should go into 3.3, as it fixes a regression introduced in the new kernel version. Signed-off-by: Gianluca Gennari Signed-off-by: Ryley Angus Cc: stable@kernel.org # for v3.3 Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/as102/as102_fw.h | 2 +- drivers/staging/media/as102/as10x_cmd.h | 80 +++++++++++++++---------------- drivers/staging/media/as102/as10x_types.h | 2 +- 3 files changed, 42 insertions(+), 42 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/as102/as102_fw.h b/drivers/staging/media/as102/as102_fw.h index bd21f0554392..4bfc6849d95a 100644 --- a/drivers/staging/media/as102/as102_fw.h +++ b/drivers/staging/media/as102/as102_fw.h @@ -29,7 +29,7 @@ struct as10x_fw_pkt_t { union { unsigned char request[2]; unsigned char length[2]; - } u; + } __packed u; struct as10x_raw_fw_pkt raw; } __packed; diff --git a/drivers/staging/media/as102/as10x_cmd.h b/drivers/staging/media/as102/as10x_cmd.h index 4ea249e7adab..e21ec6c702a9 100644 --- a/drivers/staging/media/as102/as10x_cmd.h +++ b/drivers/staging/media/as102/as10x_cmd.h @@ -99,14 +99,14 @@ union as10x_turn_on { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_turn_off { @@ -114,14 +114,14 @@ union as10x_turn_off { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* error */ uint8_t err; - } rsp; + } __packed rsp; } __packed; union as10x_set_tune { @@ -131,14 +131,14 @@ union as10x_set_tune { uint16_t proc_id; /* tune params */ struct as10x_tune_args args; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* response error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_get_tune_status { @@ -146,7 +146,7 @@ union as10x_get_tune_status { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -155,7 +155,7 @@ union as10x_get_tune_status { uint8_t error; /* tune status */ struct as10x_tune_status sts; - } rsp; + } __packed rsp; } __packed; union as10x_get_tps { @@ -163,7 +163,7 @@ union as10x_get_tps { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -172,7 +172,7 @@ union as10x_get_tps { uint8_t error; /* tps details */ struct as10x_tps tps; - } rsp; + } __packed rsp; } __packed; union as10x_common { @@ -180,14 +180,14 @@ union as10x_common { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* response error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_add_pid_filter { @@ -201,7 +201,7 @@ union as10x_add_pid_filter { uint8_t stream_type; /* PID index in filter table */ uint8_t idx; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -210,7 +210,7 @@ union as10x_add_pid_filter { uint8_t error; /* Filter id */ uint8_t filter_id; - } rsp; + } __packed rsp; } __packed; union as10x_del_pid_filter { @@ -220,14 +220,14 @@ union as10x_del_pid_filter { uint16_t proc_id; /* PID to remove */ uint16_t pid; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* response error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_start_streaming { @@ -235,14 +235,14 @@ union as10x_start_streaming { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_stop_streaming { @@ -250,14 +250,14 @@ union as10x_stop_streaming { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_get_demod_stats { @@ -265,7 +265,7 @@ union as10x_get_demod_stats { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -274,7 +274,7 @@ union as10x_get_demod_stats { uint8_t error; /* demod stats */ struct as10x_demod_stats stats; - } rsp; + } __packed rsp; } __packed; union as10x_get_impulse_resp { @@ -282,7 +282,7 @@ union as10x_get_impulse_resp { struct { /* request identifier */ uint16_t proc_id; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -291,7 +291,7 @@ union as10x_get_impulse_resp { uint8_t error; /* impulse response ready */ uint8_t is_ready; - } rsp; + } __packed rsp; } __packed; union as10x_fw_context { @@ -305,7 +305,7 @@ union as10x_fw_context { uint16_t tag; /* context request type */ uint16_t type; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -316,7 +316,7 @@ union as10x_fw_context { uint16_t type; /* error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_set_register { @@ -328,14 +328,14 @@ union as10x_set_register { struct as10x_register_addr reg_addr; /* register content */ struct as10x_register_value reg_val; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; union as10x_get_register { @@ -345,7 +345,7 @@ union as10x_get_register { uint16_t proc_id; /* register description */ struct as10x_register_addr reg_addr; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -354,7 +354,7 @@ union as10x_get_register { uint8_t error; /* register content */ struct as10x_register_value reg_val; - } rsp; + } __packed rsp; } __packed; union as10x_cfg_change_mode { @@ -364,14 +364,14 @@ union as10x_cfg_change_mode { uint16_t proc_id; /* mode */ uint8_t mode; - } req; + } __packed req; /* response */ struct { /* response identifier */ uint16_t proc_id; /* error */ uint8_t error; - } rsp; + } __packed rsp; } __packed; struct as10x_cmd_header_t { @@ -394,7 +394,7 @@ union as10x_dump_memory { struct as10x_register_addr reg_addr; /* nb blocks to read */ uint16_t num_blocks; - } req; + } __packed req; /* response */ struct { /* response identifier */ @@ -408,8 +408,8 @@ union as10x_dump_memory { uint8_t data8[DUMP_BLOCK_SIZE]; uint16_t data16[DUMP_BLOCK_SIZE / sizeof(uint16_t)]; uint32_t data32[DUMP_BLOCK_SIZE / sizeof(uint32_t)]; - } u; - } rsp; + } __packed u; + } __packed rsp; } __packed; union as10x_dumplog_memory { @@ -418,7 +418,7 @@ union as10x_dumplog_memory { uint16_t proc_id; /* dump memory type request */ uint8_t dump_req; - } req; + } __packed req; struct { /* request identifier */ uint16_t proc_id; @@ -428,7 +428,7 @@ union as10x_dumplog_memory { uint8_t dump_rsp; /* dump data */ uint8_t data[DUMP_BLOCK_SIZE]; - } rsp; + } __packed rsp; } __packed; union as10x_raw_data { @@ -437,14 +437,14 @@ union as10x_raw_data { uint16_t proc_id; uint8_t data[64 - sizeof(struct as10x_cmd_header_t) - 2 /* proc_id */]; - } req; + } __packed req; /* response */ struct { uint16_t proc_id; uint8_t error; uint8_t data[64 - sizeof(struct as10x_cmd_header_t) - 2 /* proc_id */ - 1 /* rc */]; - } rsp; + } __packed rsp; } __packed; struct as10x_cmd_t { @@ -469,7 +469,7 @@ struct as10x_cmd_t { union as10x_dump_memory dump_memory; union as10x_dumplog_memory dumplog_memory; union as10x_raw_data raw_data; - } body; + } __packed body; } __packed; struct as10x_token_cmd_t { diff --git a/drivers/staging/media/as102/as10x_types.h b/drivers/staging/media/as102/as10x_types.h index fde8140ae88b..af26e057d9a2 100644 --- a/drivers/staging/media/as102/as10x_types.h +++ b/drivers/staging/media/as102/as10x_types.h @@ -181,7 +181,7 @@ struct as10x_register_value { uint8_t value8; /* 8 bit value */ uint16_t value16; /* 16 bit value */ uint32_t value32; /* 32 bit value */ - } u; + } __packed u; } __packed; struct as10x_register_addr { -- cgit v1.2.3 From abfac0b64876294aaf1aab01df56041a3995a91f Mon Sep 17 00:00:00 2001 From: Gianluca Gennari Date: Tue, 6 Mar 2012 09:47:46 -0300 Subject: [media] as102: set optimal eLNA config values for each device Ryley and me tested several eLNA configuration values with both a rooftop and a portable antenna. Ryley fuond out that the best value for his Elgato stick is indeed the current default value 0xC0. Instead, my stick is not capable of tuning VHF channels with 0xC0. With 0x80, VHF works but the tuner sensitivity with the portable antenna is poor. Instead, the value 0xA0 works with VHF and also gives good performance with both the rooftop and the portable antenna. So we concluded that devices built on the reference design work best with 0xA0, while custom designs (Elgato, PCTV) seem to require 0xC0. I also removed the unused parameter "minor" in struct as102_dev_t. Signed-off-by: Gianluca Gennari Signed-off-by: Ryley Angus Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/as102/as102_drv.h | 2 +- drivers/staging/media/as102/as102_fe.c | 2 +- drivers/staging/media/as102/as102_usb_drv.c | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/as102/as102_drv.h b/drivers/staging/media/as102/as102_drv.h index 957f0ed0d81a..b0e5a23bd532 100644 --- a/drivers/staging/media/as102/as102_drv.h +++ b/drivers/staging/media/as102/as102_drv.h @@ -76,7 +76,7 @@ struct as102_dev_t { struct as10x_bus_adapter_t bus_adap; struct list_head device_entry; struct kref kref; - unsigned long minor; + uint8_t elna_cfg; struct dvb_adapter dvb_adap; struct dvb_frontend dvb_fe; diff --git a/drivers/staging/media/as102/as102_fe.c b/drivers/staging/media/as102/as102_fe.c index bdc5a38cddf7..043c520183d7 100644 --- a/drivers/staging/media/as102/as102_fe.c +++ b/drivers/staging/media/as102/as102_fe.c @@ -265,7 +265,7 @@ static int as102_fe_ts_bus_ctrl(struct dvb_frontend *fe, int acquire) if (acquire) { if (elna_enable) - as10x_cmd_set_context(&dev->bus_adap, 1010, 0xC0); + as10x_cmd_set_context(&dev->bus_adap, CONTEXT_LNA, dev->elna_cfg); ret = as10x_cmd_turn_on(&dev->bus_adap); } else { diff --git a/drivers/staging/media/as102/as102_usb_drv.c b/drivers/staging/media/as102/as102_usb_drv.c index 8d2c84c36a5c..0f6bfe7eccba 100644 --- a/drivers/staging/media/as102/as102_usb_drv.c +++ b/drivers/staging/media/as102/as102_usb_drv.c @@ -57,6 +57,17 @@ static const char * const as102_device_names[] = { NULL /* Terminating entry */ }; +/* eLNA configuration: devices built on the reference design work best + with 0xA0, while custom designs seem to require 0xC0 */ +static uint8_t const as102_elna_cfg[] = { + 0xA0, + 0xC0, + 0xC0, + 0xA0, + 0xA0, + 0x00 /* Terminating entry */ +}; + struct usb_driver as102_usb_driver = { .name = DRIVER_FULL_NAME, .probe = as102_usb_probe, @@ -371,8 +382,10 @@ static int as102_usb_probe(struct usb_interface *intf, /* Assign the user-friendly device name */ for (i = 0; i < (sizeof(as102_usb_id_table) / sizeof(struct usb_device_id)); i++) { - if (id == &as102_usb_id_table[i]) + if (id == &as102_usb_id_table[i]) { as102_dev->name = as102_device_names[i]; + as102_dev->elna_cfg = as102_elna_cfg[i]; + } } if (as102_dev->name == NULL) -- cgit v1.2.3 From b47acf2a161b2f3001bf50dfa740477db6d32327 Mon Sep 17 00:00:00 2001 From: "Justin P. Mattock" Date: Mon, 5 Mar 2012 11:49:26 -0300 Subject: [media] staging: Fix comments and some typos in staging/media/* linux-next: I like to spend some time reading code, in doing so I have found some typos in some of the comments. Signed-off-by: Justin P. Mattock Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/Kconfig | 2 +- drivers/staging/media/as102/as102_drv.c | 2 +- drivers/staging/media/as102/as102_fe.c | 4 ++-- drivers/staging/media/go7007/go7007-v4l2.c | 8 ++++---- drivers/staging/media/lirc/lirc_serial.c | 2 +- drivers/staging/media/solo6x10/Kconfig | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/Kconfig b/drivers/staging/media/Kconfig index 7e5caa39ed3f..4f4b7d6281a7 100644 --- a/drivers/staging/media/Kconfig +++ b/drivers/staging/media/Kconfig @@ -6,7 +6,7 @@ menuconfig STAGING_MEDIA don't have the "normal" Linux kernel quality level. Most of them don't follow properly the V4L, DVB and/or RC API's, so, they won't likely work fine with the existing applications. - That also means that, one fixed, their API's will change to match + That also means that, once fixed, their API's will change to match the existing ones. If you wish to work on these drivers, to help improve them, or diff --git a/drivers/staging/media/as102/as102_drv.c b/drivers/staging/media/as102/as102_drv.c index aae0505a36c4..ea4f992de235 100644 --- a/drivers/staging/media/as102/as102_drv.c +++ b/drivers/staging/media/as102/as102_drv.c @@ -27,7 +27,7 @@ #include #include -/* header file for Usb device driver*/ +/* header file for usb device driver*/ #include "as102_drv.h" #include "as102_fw.h" #include "dvbdev.h" diff --git a/drivers/staging/media/as102/as102_fe.c b/drivers/staging/media/as102/as102_fe.c index 043c520183d7..5917657b9d0f 100644 --- a/drivers/staging/media/as102/as102_fe.c +++ b/drivers/staging/media/as102/as102_fe.c @@ -337,7 +337,7 @@ int as102_dvb_register_fe(struct as102_dev_t *as102_dev, strncpy(dvb_fe->ops.info.name, as102_dev->name, sizeof(dvb_fe->ops.info.name)); - /* register dbvb frontend */ + /* register dvb frontend */ errno = dvb_register_frontend(dvb_adap, dvb_fe); if (errno == 0) dvb_fe->tuner_priv = as102_dev; @@ -349,7 +349,7 @@ static void as10x_fe_copy_tps_parameters(struct dtv_frontend_properties *fe_tps, struct as10x_tps *as10x_tps) { - /* extract consteallation */ + /* extract constellation */ switch (as10x_tps->modulation) { case CONST_QPSK: fe_tps->modulation = QPSK; diff --git a/drivers/staging/media/go7007/go7007-v4l2.c b/drivers/staging/media/go7007/go7007-v4l2.c index 2b27d8da70a2..f91658670e34 100644 --- a/drivers/staging/media/go7007/go7007-v4l2.c +++ b/drivers/staging/media/go7007/go7007-v4l2.c @@ -1050,15 +1050,15 @@ static int vidioc_s_parm(struct file *filp, void *priv, return 0; } -/* VIDIOC_ENUMSTD on go7007 were used for enumberating the supported fps and +/* VIDIOC_ENUMSTD on go7007 were used for enumerating the supported fps and its resolution, when the device is not connected to TV. - This were an API abuse, probably used by the lack of specific IOCTL's to - enumberate it, by the time the driver were written. + This is were an API abuse, probably used by the lack of specific IOCTL's to + enumerate it, by the time the driver was written. However, since kernel 2.6.19, two new ioctls (VIDIOC_ENUM_FRAMEINTERVALS and VIDIOC_ENUM_FRAMESIZES) were added for this purpose. - The two functions bellow implements the newer ioctls + The two functions below implement the newer ioctls */ static int vidioc_enum_framesizes(struct file *filp, void *priv, struct v4l2_frmsizeenum *fsize) diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c index 8dd8897ad860..97352cf6bd98 100644 --- a/drivers/staging/media/lirc/lirc_serial.c +++ b/drivers/staging/media/lirc/lirc_serial.c @@ -1282,7 +1282,7 @@ MODULE_PARM_DESC(iommap, "physical base for memory mapped I/O" /* * some architectures (e.g. intel xscale) align the 8bit serial registers * on 32bit word boundaries. - * See linux-kernel/serial/8250.c serial_in()/out() + * See linux-kernel/drivers/tty/serial/8250/8250.c serial_in()/out() */ module_param(ioshift, int, S_IRUGO); MODULE_PARM_DESC(ioshift, "shift I/O register offset (0 = no shift)"); diff --git a/drivers/staging/media/solo6x10/Kconfig b/drivers/staging/media/solo6x10/Kconfig index 03dcac4ea4d0..63352de5eabf 100644 --- a/drivers/staging/media/solo6x10/Kconfig +++ b/drivers/staging/media/solo6x10/Kconfig @@ -5,4 +5,4 @@ config SOLO6X10 select SND_PCM ---help--- This driver supports the Softlogic based MPEG-4 and h.264 codec - codec cards. + cards. -- cgit v1.2.3 From 23bfb5be9f4c14937d70ed09f24a19d86df1951b Mon Sep 17 00:00:00 2001 From: Andrew Miller Date: Fri, 9 Mar 2012 22:51:01 -0300 Subject: [media] Staging: media: solo6x10: core.c Fix some coding style issue Replaced spaces with tabs Signed-off-by: Andrew Miller Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/solo6x10/core.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/solo6x10/core.c b/drivers/staging/media/solo6x10/core.c index f974f6412ad7..d2fd842e37cf 100644 --- a/drivers/staging/media/solo6x10/core.c +++ b/drivers/staging/media/solo6x10/core.c @@ -195,28 +195,28 @@ static int __devinit solo_pci_probe(struct pci_dev *pdev, SOLO6010_SYS_CFG_OUTDIV(3); solo_reg_write(solo_dev, SOLO_SYS_CFG, reg); - if (solo_dev->flags & FLAGS_6110) { - u32 sys_clock_MHz = SOLO_CLOCK_MHZ; - u32 pll_DIVQ; - u32 pll_DIVF; - - if (sys_clock_MHz < 125) { - pll_DIVQ = 3; - pll_DIVF = (sys_clock_MHz * 4) / 3; - } else { - pll_DIVQ = 2; - pll_DIVF = (sys_clock_MHz * 2) / 3; - } - - solo_reg_write(solo_dev, SOLO6110_PLL_CONFIG, + if (solo_dev->flags & FLAGS_6110) { + u32 sys_clock_MHz = SOLO_CLOCK_MHZ; + u32 pll_DIVQ; + u32 pll_DIVF; + + if (sys_clock_MHz < 125) { + pll_DIVQ = 3; + pll_DIVF = (sys_clock_MHz * 4) / 3; + } else { + pll_DIVQ = 2; + pll_DIVF = (sys_clock_MHz * 2) / 3; + } + + solo_reg_write(solo_dev, SOLO6110_PLL_CONFIG, SOLO6110_PLL_RANGE_5_10MHZ | SOLO6110_PLL_DIVR(9) | SOLO6110_PLL_DIVQ_EXP(pll_DIVQ) | SOLO6110_PLL_DIVF(pll_DIVF) | SOLO6110_PLL_FSEN); - mdelay(1); // PLL Locking time (1ms) + mdelay(1); /* PLL Locking time (1ms) */ solo_reg_write(solo_dev, SOLO_DMA_CTRL1, 3 << 8); /* ? */ - } else + } else solo_reg_write(solo_dev, SOLO_DMA_CTRL1, 1 << 8); /* ? */ solo_reg_write(solo_dev, SOLO_TIMER_CLOCK_NUM, SOLO_CLOCK_MHZ - 1); -- cgit v1.2.3