Re: Calling usb_bulk_msg inside usbtouch_process_pkt is causing kernel panic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 03, 2012 at 06:20:26PM +0000, Nuno Santos wrote:
> On 01/03/2012 06:16 PM, Greg KH wrote:
> >On Tue, Jan 03, 2012 at 06:00:18PM +0000, Nuno Santos wrote:
> >>Hi Greg,
> >>
> >>This is my packet process function. This is a multitouch controller.
> >>In every frame I need to get touch data and if any touch is
> >>available to be inject into the system, that is done in this method.
> >>
> >>static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch,
> >>unsigned char *pkt, int len)
> >>{
> >>     int touch=0,currentTouch=0,transferedBytes=0;
> >>     PDPX_TOUCH Touch;
> >>
> >>     struct usbtouch_device_info *type = usbtouch->type;
> >>     struct dpx_priv *priv = usbtouch->priv;
> >>     struct usb_device *usbdev = interface_to_usbdev(usbtouch->interface);
> >>
> >>     if (!type->read_data(usbtouch, pkt))
> >>         return;
> >>
> >>     tCurrent = jiffies;
> >>     elapsed = tCurrent-tInitial;
> >>     elapsed = elapsed * 1000 / HZ;
> >>
> >>     if (elapsed>1000)
> >>     {
> >I'm guessing this code isn't in the kernel tree, right?  :)
> It's really bad?

Wrong coding style.

> >
> >Why not?
> Why not what? :)

Why isn't this code/driver in the main kernel.org tree already?  Has it
been submitted?

> >>         priv->context->State.Acquisition.FrameRate =
> >>priv->context->Data.Acquisition.Frames;
> >>         priv->context->Data.Acquisition.Frames = 0;
> >>
> >>         tInitial = tCurrent;
> >>     }
> >>
> >>     priv->context->State.Acquisition.FrameCounter++;
> >>
> >>     if (usbdev)
> >>     {
> >>         if (priv->context->State.Acquisition.FrameCounter>DPX_INTERVAL_FRAMES_BETWEEN_AUTO_SETUP)
> >>         {
> >>             usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, (int)0x02),
> >>0x00, 8,&transferedBytes, 1000);
> >What's wrong with just firing off a urb for this here?  That should work
> >just fine, have you tried it?
> Yes, it always crashes my kernel. I'll try to take a picture!! :)

Submitting a urb (note, with a call to usb_submit_urb()) should not
cause a problem here, as long as you pass the proper flags to the call,
which you are doing, right?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux