The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier@cisco.com>
To: Jack Stone <jack@hawkeye.stone.uk.eu.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Spinlock init
Date: Wed, 20 Jun 2007 13:29:14 -0700	[thread overview]
Message-ID: <ada4pl29xph.fsf@cisco.com> (raw)
In-Reply-To: <46798A37.6050007@hawkeye.stone.uk.eu.org> (Jack Stone's message of "Wed, 20 Jun 2007 21:12:39 +0100")

 > can rwlock_init and spin_lock_init be used outside of functions declared
 > __init. The spinlock documentation suggests that it can't but I'd like
 > someone to confirm that.

Those function can be used in any function.  A function is declared
__init if it only runs during the kernel startup, so that the memory
holding the code for __init functions can be freed once startup is
done.  However, spin_lock_init() is just used to initialize a freshly
allocated spinlock, and spinlocks may be allocated at any time, even
long after the kernel is done starting up.  A quick look throught
kernel source code will show many, many examples where
spin_lock_init(), rwlock_init(), mutex_init(), etc. are called from
non-__init functions.


 - R.

  reply	other threads:[~2007-06-20 20:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-20 20:12 Spinlock init Jack Stone
2007-06-20 20:29 ` Roland Dreier [this message]
2007-06-20 20:31   ` Jack Stone

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=ada4pl29xph.fsf@cisco.com \
    --to=rdreier@cisco.com \
    --cc=jack@hawkeye.stone.uk.eu.org \
    --cc=linux-kernel@vger.kernel.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