Re: [PATCH] Printer Gadget Driver v0.2.0 (kernel 2.6.21.3)
David Brownell <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Message-ID | <[email protected]> |
On Saturday 10 November 2007, Craig W. Nadler wrote:
> + /* we've already been disconnected ... no i/o is active */
> + /* Free all memory for this driver. */
> + if (likely(!list_empty(&dev->tx_reqs_active)))
> + ERROR(dev, "Driver still has active transfer left.\n");
> +
That would be "if (unlikely(...))" ... although branch hinting
in cold paths is probably best avoided.
I'll repost a slightly tweaked version of this patch; those would
be best as WARN_ON() calls.
> I changed the IOCTL code to 'G', the same as the gadgetfs, and offset
Actually gadgetfs uses 'g' (lowercase). Mr. Grep tells me that
uppercase G is used by include/asm-parisc/grfioctl.h ...
> the ioctl call number by 0x10.
>
> #define GADGET_GET_PRINTER_STATUS _IOR('G', 0x10, unsigned char)
> #define GADGET_SET_PRINTER_STATUS _IOWR('G', 0x11, unsigned char)
>
> Is that an acceptable approach?
I don't think I'll object too much. But I will make sure
the gadgetfs header has a corresponding note, and enlarge
that offset to avoid future problems. (All that's really
important is that the ioctl codes be unique.)
A minor warning: ENOIOCTLCMD is not the right code to
use for "wrong device type". That's ENOTTY ... stupid,
but the standard for like ever.
- Dave
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel