From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0133.outbound.protection.outlook.com [65.55.169.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id F37F21A017A for ; Fri, 2 Oct 2015 13:35:27 +1000 (AEST) Date: Thu, 1 Oct 2015 22:35:06 -0500 From: Scott Wood To: CC: , , , , , , , , Subject: Re: [v5, 2/6] fsl/fman: Add FMan support Message-ID: <20151002033506.GA8067@home.buserror.net> References: <1443085838-7539-1-git-send-email-igal.liberman@freescale.com> <1443085838-7539-3-git-send-email-igal.liberman@freescale.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" In-Reply-To: <1443085838-7539-3-git-send-email-igal.liberman@freescale.com> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Thu, Sep 24, 2015 at 12:10:34PM +0300, igal.liberman@freescale.com wrote: > +int fman_get_rx_extra_headroom(void) > +{ > + static bool fm_check_rx_extra_headroom; > + > + if (!fm_check_rx_extra_headroom) { > + if (fsl_fm_rx_extra_headroom > FSL_FM_RX_EXTRA_HEADROOM_MAX || > + fsl_fm_rx_extra_headroom < FSL_FM_RX_EXTRA_HEADROOM_MIN) { > + pr_warn("Invalid fsl_fm_rx_extra_headroom value (%d) in bootargs, valid range is %d-%d. Falling back to the default (%d)\n", > + fsl_fm_rx_extra_headroom, > + FSL_FM_RX_EXTRA_HEADROOM_MIN, > + FSL_FM_RX_EXTRA_HEADROOM_MAX, > + FSL_FM_RX_EXTRA_HEADROOM); > + fsl_fm_rx_extra_headroom = FSL_FM_RX_EXTRA_HEADROOM; > + } > + > + fsl_fm_rx_extra_headroom = true; I think you mean "fm_check_rx_extra_headroom = true". > + fsl_fm_rx_extra_headroom = ALIGN(fsl_fm_rx_extra_headroom, 16); > + } > + > + return fsl_fm_rx_extra_headroom; > +} > +EXPORT_SYMBOL(fman_get_rx_extra_headroom); Please just check things like this once during module init. Init-on-first-use is unnecessarily complicated, and race-prone. -Scott