public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Carlos Vidal <yorugua@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: spinlock_t typedef visibility and uninitialized spinlock
Date: Mon, 1 Nov 2004 12:05:04 +0100	[thread overview]
Message-ID: <cb62342b04110103057dc7dff0@mail.gmail.com> (raw)

I'm porting CIPE 1.6.0 kernel module to Kernel 2.6.8 and had problems
with "spin_is_locked on uninitialized spinlock".

After tracing the problem I found that the spinlock_t structure is not
visible to the module code. A 'gcc -E' yields:
     typedef struct { } spinlock_t;

In spinlock.h, this declaration is inside a #ifdef
CONFIG_DEBUG_SPINLOCK block, so it becomes visible only
CONFIG_DEBUG_SPINLOCK is 'y'.

If I turn CONFIG_DEBUG_SPINLOCK on, the module loads nicely. Otherwise
I get a nasty error in syslog and sometimes a system crash, as if in
CIPE the struct was not allocated (what is the case if the compiler
uses the typedef as it is above).

The question is: is this a bug or a feature? ;-)

Should the declaration be out of the #ifdef CONFIG_DEBUG_SPINLOCK? Or
should I use a special compiler flag?

Carlos

             reply	other threads:[~2004-11-01 11:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-01 11:05 Carlos Vidal [this message]
2004-11-01 14:04 ` spinlock_t typedef visibility and uninitialized spinlock Zwane Mwaikambo

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=cb62342b04110103057dc7dff0@mail.gmail.com \
    --to=yorugua@gmail.com \
    --cc=carlos@tarkus.se \
    --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