Re: linux driver for CM109 voip chipset

Oliver Neukum <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
Am Sonntag, 25. Februar 2007 21:45 schrieb Alfred E. Heggestad:
> hi
> 
> I have written a small driver for the C-Media CM109 chipset
> used in USB VoIP phones like the KIP-1000. The source can
> be found here:
> 
>   http://aeh.db.org/pub/cm109.c

	/* allocate usb buffers */
	cm109->irq_data = usb_buffer_alloc(udev, USB_PKT_LEN,
					GFP_ATOMIC, &cm109->irq_dma);
	if (cm109->irq_data == NULL)
		goto err;

	cm109->ctl_data = usb_buffer_alloc(udev, USB_PKT_LEN,
					GFP_ATOMIC, &cm109->ctl_dma);
	if (!cm109->ctl_data)
		goto err;

	cm109->ctl_req = usb_buffer_alloc(udev, sizeof(*(cm109->ctl_req)),
					GFP_ATOMIC, &cm109->ctl_req_dma);
	if (cm109->ctl_req == NULL)
		goto err;

No need for atomic allocations.

static DECLARE_RWSEM(sysfs_rwsema);

A mutex is enough. You never do anything but down_write().

static void input_close(struct input_dev *dev)
{
	struct cm109_dev *cmd = dev->private;

	usb_kill_urb(cmd->urb_ctl);
	usb_kill_urb(cmd->urb_irq);
}

This is a race condition. Due to your special requirement of submitting
the URBs from each other's completion handler the guarantees of usb_kill_urb()
are not strong enough for you. You need to use a flag under a spin_lock.

	Regards
		Oliver

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.