From owner-svn-src-all@FreeBSD.ORG Sun Jan 23 12:06:47 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F8EE1065673; Sun, 23 Jan 2011 12:06:47 +0000 (UTC) (envelope-from gljennjohn@googlemail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 08B5B8FC17; Sun, 23 Jan 2011 12:06:45 +0000 (UTC) Received: by bwz12 with SMTP id 12so2937323bwz.13 for ; Sun, 23 Jan 2011 04:06:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:in-reply-to :references:reply-to:x-mailer:mime-version:content-type :content-transfer-encoding; bh=9SNhwn54WZvx5i75eZkagfwEcZHap9lC6gt8k3/AeBk=; b=Np1SYfEg0h8aBRzcNAcRFvKbJC9qCcfw37rS+N3ogZzEtgb91iK66unxTq1ZuLI6Nm sfzSclReuuI6Do8q67wDxNKJvvJDI0Ln6c/Evon4HuOVJZQos3m6mZUcVki3KVWUoo2U JMDom9zQUTPZs54Nzc76lSC+pcbehDi+c1nVM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :x-mailer:mime-version:content-type:content-transfer-encoding; b=HjDwD/cQOwC1mWUunx4uckqbDRVUgSZc9a3+us2npzBppDd49ptisjETT93SME1LFZ TM0LHp20hPu/E+sGKlkq2TqPJLNUO3RbdWgjU5SqZlAZlreOX89jSzCUARVi0E1xbW2U 5WAHgqT97+JEEBURLrgAGNYoQ1v7jbRIX4Xzs= Received: by 10.204.66.79 with SMTP id m15mr2512266bki.124.1295784404451; Sun, 23 Jan 2011 04:06:44 -0800 (PST) Received: from ernst.jennejohn.org (p578E2276.dip.t-dialin.net [87.142.34.118]) by mx.google.com with ESMTPS id rc9sm4084668bkb.2.2011.01.23.04.06.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 23 Jan 2011 04:06:43 -0800 (PST) Date: Sun, 23 Jan 2011 13:06:41 +0100 From: Gary Jennejohn To: Hans Petter Selasky Message-ID: <20110123130641.7653ea79@ernst.jennejohn.org> In-Reply-To: <201101231019.02603.hselasky@freebsd.org> References: <201101221352.p0MDqNt3093630@svn.freebsd.org> <20110122160918.373f8670@ernst.jennejohn.org> <201101231019.02603.hselasky@freebsd.org> X-Mailer: Claws Mail 3.7.8 (GTK+ 2.18.7; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r217718 - in head/sys: conf dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: gljennjohn@googlemail.com List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jan 2011 12:06:47 -0000 On Sun, 23 Jan 2011 10:19:02 +0100 Hans Petter Selasky wrote: > On Saturday 22 January 2011 16:09:18 Gary Jennejohn wrote: > > On Sat, 22 Jan 2011 13:52:23 +0000 (UTC) > > > > Hans Petter Selasky wrote: > > > Author: hselasky > > > Date: Sat Jan 22 13:52:23 2011 > > > New Revision: 217718 > > > URL: http://svn.freebsd.org/changeset/base/217718 > > > > > > Log: > > > Allow USB_HOST_ALIGN to be configured at compile time. This patch is > > > necessary for MIPS based RouterStation Pro board and maybe other MIPS > > > based boards as well. > > > > > > Submitted by: Milan Obuch > > > Approved by: thompsa (mentor) > > > > > > Modified: > > > head/sys/conf/options > > > head/sys/dev/usb/usb_freebsd.h > > > > > > Modified: head/sys/conf/options > > > ========================================================================= > > > ===== --- head/sys/conf/options Sat Jan 22 13:18:28 2011 (r217717) > > > +++ head/sys/conf/options Sat Jan 22 13:52:23 2011 (r217718) > > > @@ -642,6 +642,7 @@ BUS_DEBUG opt_bus.h > > > > > > # options for USB support > > > USB_DEBUG opt_usb.h > > > > > > +USB_HOST_ALIGN opt_usb.h > > Sorry I didn't see this option sneaking in during r217631 :-) Anyway, two > times is better than one time :-) > > > > > > > USB_REQ_DEBUG opt_usb.h > > > USB_VERBOSE opt_usb.h > > > USB_EHCI_BIG_ENDIAN_DESC opt_usb.h > > > > > > Modified: head/sys/dev/usb/usb_freebsd.h > > > ========================================================================= > > > ===== --- head/sys/dev/usb/usb_freebsd.h Sat Jan 22 13:18:28 > > > 2011 (r217717) +++ head/sys/dev/usb/usb_freebsd.h Sat Jan 22 13:52:23 > > > 2011 (r217718) @@ -46,7 +46,12 @@ > > > > > > #define USB_TD_GET_PROC(td) (td)->td_proc > > > #define USB_PROC_GET_GID(td) (td)->p_pgid > > > > > > +#if defined(USB_HOST_ALIGN) && (USB_HOST_ALIGN != 0) > > > +/* USB_HOST_ALIGN is already defined and valid */ > > > > Not necessarily valid. What if the user sets it to -24? The compiler > > will happily accept that with the above #if-statement. > > > > IMO you should test for USB_HOST_ALIGN > 0, which should always work. > > > > Defensive programming is always a good idea. > > I agree. > > Does this look OK: > > #if defined(USB_HOST_ALIGN) && (USB_HOST_ALIGN != 0) > #if (-USB_HOST_ALIGN & USB_HOST_ALIGN) == USB_HOST_ALIGN > #error "USB_HOST_ALIGN is not power of two." > #endif > #if (USB_HOST_ALIGN <= 0) > #error "USB_HOST_ALIGN is less than or equal to zero." > #endif > > ... Looks OK to me. Rather convoluted, but the #else down below makes that necessary, I guess. > > > > > +#else > > > +#undef USB_HOST_ALIGN > > > > > > #define USB_HOST_ALIGN 8 /* bytes, must be power of two */ > > > > > > +#endif > > > > > > #define USB_FS_ISOC_UFRAME_MAX 4 /* exclusive unit */ > > > #define USB_BUS_MAX 256 /* units */ > > > #define USB_MAX_DEVICES 128 /* units */ > -- Gary Jennejohn