Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755672AbbFLQXb (ORCPT ); Fri, 12 Jun 2015 12:23:31 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56521 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755631AbbFLQX2 (ORCPT ); Fri, 12 Jun 2015 12:23:28 -0400 Date: Fri, 12 Jun 2015 09:23:27 -0700 From: Greg KH To: Juergen Gross Cc: linux-kernel@vger.kernel.org, xen-devel@lists.xensource.com, konrad.wilk@oracle.com, david.vrabel@citrix.com, boris.ostrovsky@oracle.com, linux-usb@vger.kernel.org Subject: Re: [Patch V2 1/3] usb: Add Xen pvUSB protocol description Message-ID: <20150612162327.GD15911@kroah.com> References: <1434118201-25617-1-git-send-email-jgross@suse.com> <1434118201-25617-2-git-send-email-jgross@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1434118201-25617-2-git-send-email-jgross@suse.com> User-Agent: Mutt/1.5.23+89 (0255b37be491) (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3479 Lines: 112 On Fri, Jun 12, 2015 at 04:09:59PM +0200, Juergen Gross wrote: > +enum usb_spec_version { > + USB_VER_UNKNOWN = 0, > + USB_VER_USB11, > + USB_VER_USB20, > + USB_VER_USB30, /* not supported yet */ > +}; > + You are defining a bunch of things in this .h file that start with "usb" yet are not part of the USB core at all, but rather are xen specific. Please don't polute the namespace with such things. > +/* > + * USB pipe in usbif_request > + * > + * - port number: bits 0-4 > + * (USB_MAXCHILDREN is 31) > + * > + * - operation flag: bit 5 > + * (0 = submit urb, > + * 1 = unlink urb) > + * > + * - direction: bit 7 > + * (0 = Host-to-Device [Out] > + * 1 = Device-to-Host [In]) > + * > + * - device address: bits 8-14 > + * > + * - endpoint: bits 15-18 > + * > + * - pipe type: bits 30-31 > + * (00 = isochronous, 01 = interrupt, > + * 10 = control, 11 = bulk) > + */ > + > +#define USBIF_PIPE_PORT_MASK 0x0000001f > +#define USBIF_PIPE_UNLINK 0x00000020 > +#define USBIF_PIPE_DIR 0x00000080 > +#define USBIF_PIPE_DEV_MASK 0x0000007f > +#define USBIF_PIPE_DEV_SHIFT 8 > +#define USBIF_PIPE_EP_MASK 0x0000000f > +#define USBIF_PIPE_EP_SHIFT 15 > +#define USBIF_PIPE_TYPE_MASK 0x00000003 > +#define USBIF_PIPE_TYPE_SHIFT 30 > +#define USBIF_PIPE_TYPE_ISOC 0 > +#define USBIF_PIPE_TYPE_INT 1 > +#define USBIF_PIPE_TYPE_CTRL 2 > +#define USBIF_PIPE_TYPE_BULK 3 Why can't you just use the defines we have for this already? > + > +#define usbif_pipeportnum(pipe) ((pipe) & USBIF_PIPE_PORT_MASK) > +#define usbif_setportnum_pipe(pipe, portnum) ((pipe) | (portnum)) > + > +#define usbif_pipeunlink(pipe) ((pipe) & USBIF_PIPE_UNLINK) > +#define usbif_pipesubmit(pipe) (!usbif_pipeunlink(pipe)) > +#define usbif_setunlink_pipe(pipe) ((pipe) | USBIF_PIPE_UNLINK) > + > +#define usbif_pipein(pipe) ((pipe) & USBIF_PIPE_DIR) > +#define usbif_pipeout(pipe) (!usbif_pipein(pipe)) > + > +#define usbif_pipedevice(pipe) \ > + (((pipe) >> USBIF_PIPE_DEV_SHIFT) & USBIF_PIPE_DEV_MASK) > + > +#define usbif_pipeendpoint(pipe) \ > + (((pipe) >> USBIF_PIPE_EP_SHIFT) & USBIF_PIPE_EP_MASK) > + > +#define usbif_pipetype(pipe) \ > + (((pipe) >> USBIF_PIPE_TYPE_SHIFT) & USBIF_PIPE_TYPE_MASK) > +#define usbif_pipeisoc(pipe) (usbif_pipetype(pipe) == USBIF_PIPE_TYPE_ISOC) > +#define usbif_pipeint(pipe) (usbif_pipetype(pipe) == USBIF_PIPE_TYPE_INT) > +#define usbif_pipectrl(pipe) (usbif_pipetype(pipe) == USBIF_PIPE_TYPE_CTRL) > +#define usbif_pipebulk(pipe) (usbif_pipetype(pipe) == USBIF_PIPE_TYPE_BULK) Same for all of these? > + > +#define USBIF_MAX_SEGMENTS_PER_REQUEST (16) > +#define USBIF_MAX_PORTNR 31 Why does userspace have to know this? > + > +/* > + * RING for transferring urbs. > + */ > +struct usbif_request_segment { > + grant_ref_t gref; > + uint16_t offset; > + uint16_t length; > +}; Please use proper kernel types for things that go outside of the kernel (__u16 and the like). There is no "uint16_t" as a valid type in the kernel, sorry. Well, ok, we have it, just because it snuck in somehow, but it should be removed one of these days... > +struct usbif_urb_request { Again, very generic structure name for a xen specific thing :( I stopped reading here. greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/