linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: <igal.liberman@freescale.com>
Cc: <netdev@vger.kernel.org>, <linuxppc-dev@lists.ozlabs.org>,
	<linux-kernel@vger.kernel.org>, <madalin.bucur@freescale.com>,
	<pebolle@tiscali.nl>, <joakim.tjernlund@transmode.se>,
	<ppc@mindchasers.com>, <stephen@networkplumber.org>,
	<davem@davemloft.net>
Subject: Re: [v5, 2/6] fsl/fman: Add FMan support
Date: Thu, 1 Oct 2015 22:35:06 -0500	[thread overview]
Message-ID: <20151002033506.GA8067@home.buserror.net> (raw)
In-Reply-To: <1443085838-7539-3-git-send-email-igal.liberman@freescale.com>

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

  reply	other threads:[~2015-10-02  3:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-24  9:10 [v5, 0/6] Freescale DPAA FMan igal.liberman
2015-09-24  9:10 ` [v5, 1/6] fsl/fman: Add FMan MURAM support igal.liberman
2015-09-24  9:10 ` [v5, 2/6] fsl/fman: Add FMan support igal.liberman
2015-10-02  3:35   ` Scott Wood [this message]
2015-09-24  9:10 ` [v5, 3/6] fsl/fman: Add FMan MAC support igal.liberman
2015-09-24  9:10 ` [v5, 4/6] fsl/fman: Add FMan SP support igal.liberman
2015-09-24  9:10 ` [v5, 5/6] fsl/fman: Add FMan Port Support igal.liberman
2015-09-24  9:10 ` [v5, 6/6] fsl/fman: Add FMan MAC driver igal.liberman
     [not found] <1442836354-5445-1-git-send-email-igal.liberman@freescale.com>
2015-09-25 23:01 ` [V5, 2/6] fsl/fman: Add FMan support Scott Wood
2015-10-27 16:32   ` Liberman Igal
2015-10-28 21:30     ` Scott Wood
2015-10-29 15:22       ` Liberman Igal
2015-10-29 15:24         ` Scott Wood
2015-10-29 16:08           ` Liberman Igal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151002033506.GA8067@home.buserror.net \
    --to=scottwood@freescale.com \
    --cc=davem@davemloft.net \
    --cc=igal.liberman@freescale.com \
    --cc=joakim.tjernlund@transmode.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=madalin.bucur@freescale.com \
    --cc=netdev@vger.kernel.org \
    --cc=pebolle@tiscali.nl \
    --cc=ppc@mindchasers.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).