From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.27]) by ozlabs.org (Postfix) with ESMTP id 8B74DDE066 for ; Tue, 26 May 2009 21:32:38 +1000 (EST) Received: by qw-out-2122.google.com with SMTP id 3so1925265qwe.15 for ; Tue, 26 May 2009 04:32:36 -0700 (PDT) MIME-Version: 1.0 Sender: timur.tabi@gmail.com In-Reply-To: References: <20090525221406.21370.30326.stgit@terra> <20090525221507.21370.68301.stgit@terra> Date: Tue, 26 May 2009 06:32:35 -0500 Message-ID: Subject: Re: [PATCH V4 1/5] The macro spin_event_timeout() takes a condition and timeout value From: Timur Tabi To: Geert Uytterhoeven Content-Type: text/plain; charset=ISO-8859-1 Cc: linuxppc-dev@ozlabs.org, alsa-devel@alsa-project.org, broonie@sirena.org.uk List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Tue, May 26, 2009 at 2:29 AM, Geert Uytterhoeven wrote: > static inline function, returning rc, instead of a macro? It won't work as an inline function ... >> + =A0 =A0 unsigned long __loops =3D tb_ticks_per_usec * timeout; =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0\ >> + =A0 =A0 unsigned long __start =3D get_tbl(); =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0\ >> + =A0 =A0 while ((rc =3D (condition)) && (tb_ticks_since(__start) <=3D _= _loops)) \ There's no way to pass a expression to an inline function. It has to be a macro. Here, the loop evaluates "condition" at every pass. If this were an inline function, "condition" would be evaluated once when the function were called, and never again. --=20 Timur Tabi Linux kernel developer at Freescale