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
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to