From owner-freebsd-usb@FreeBSD.ORG Thu Aug 17 12:39:03 2006 Return-Path: X-Original-To: usb@freebsd.org Delivered-To: freebsd-usb@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7665316A504 for ; Thu, 17 Aug 2006 12:39:03 +0000 (UTC) (envelope-from tofik@oxygen.az) Received: from mail.oxygen.az (mail.oxygen.az [212.47.128.37]) by mx1.FreeBSD.org (Postfix) with ESMTP id DA63543D49 for ; Thu, 17 Aug 2006 12:39:02 +0000 (GMT) (envelope-from tofik@oxygen.az) Received: from mail.oxygen.az (localhost [127.0.0.1]) by mail.oxygen.az (Postfix) with ESMTP id 7384E16AF7; Thu, 17 Aug 2006 17:32:35 +0500 (AZST) X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on earth.oxygen.az X-Spam-Level: X-Spam-Status: No, score=-3.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.0 Received: from webmail.oxygen.az (mail.oxygen.az [212.47.128.37]) by mail.oxygen.az (Postfix) with ESMTP id 2EF1516AC0; Thu, 17 Aug 2006 17:32:35 +0500 (AZST) Received: from 85.132.32.38 (proxying for 85.132.14.38) (SquirrelMail authenticated user secnews); by webmail.oxygen.az with HTTP; Thu, 17 Aug 2006 17:32:35 +0500 (AZST) Message-ID: <35146.85.132.32.38.1155817977.squirrel@85.132.32.38> In-Reply-To: <20060817121307.GA804@gremlin.foo.is> References: <35069.85.132.32.38.1155816624.squirrel@85.132.32.38> <20060817121307.GA804@gremlin.foo.is> Date: Thu, 17 Aug 2006 17:32:35 +0500 (AZST) From: "Tofig Suleymanov" To: "Baldur Gislason" User-Agent: SquirrelMail/1.4.3a X-Mailer: SquirrelMail/1.4.3a MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: -= ClamAV =- Cc: usb@freebsd.org, Tofig Suleymanov Subject: Re: USB_ATTACH_SETUP macros question X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: tofik@oxygen.az List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2006 12:39:03 -0000 > On Thu, Aug 17, 2006 at 05:10:02PM +0500, Tofig Suleymanov wrote: >> Hello hackers, >> >> is there anybody to explain why do we have infinite loop inside of >> USB_ATTACH_SETUP macros inside of usb_port.h ? How does his loop gets >> escaped when we use it in some usb driver ? >> >> #define USB_ATTACH_SETUP \ >> do { \ >> sc->sc_dev = self; \ >> device_set_desc_copy(self, devinfo); \ >> device_printf(self, "%s\n", devinfo); \ >> } while (0); >> >> Thank you ! >> >> Tofig Suleymanov >> > This isn't an infinite loop, in fact it will never be executed. > > Baldur > Made a little test which shows that this code is going to be executed only once.How did i miss that :) Now the other question comes next: Why don not we use just: #define USB_ATTACH_SETUP \ sc->sc_dev = self; \ device_set_desc_copy(self, devinfo); \ device_printf(self, "%s\n", devinfo); ? Thank you, Tofig Suleymanov