mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Monica Puig-Pey <puigpeym@unican.es>
Cc: linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: Problem: plist_add undefined!
Date: Wed, 21 Dec 2011 22:51:02 -0500	[thread overview]
Message-ID: <1324525862.5916.121.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <4EF05465.7050507@unican.es>

On Tue, 2011-12-20 at 10:24 +0100, Monica Puig-Pey wrote:
> Hi there,
> 
> As I told in previous posts in this list I'm developing drivers for the
> 
> linux-rt kernel version in Ubuntu 10.04, based on 2.6.31 with rt_preempt 
> patch.
> 
> Currently I'm studying how to use priority lists (linux/plist.h) in a 
> module. I read some pages from the Linux Kernel Development book to 
> learn how linked list work in the kernel.
> 
> I made and easy example, shown below, trying to put three elements, with 
> their priorities, in a plist_head.
> 
> Then, I had two problems:
> 
> * First error:
> 
>    An error is produced when using the MACROs:
>      - PLIST_HEAD_INIT(head, _lock)
>      - PLIST_NODE_INIT(node, __prio)

Right, the macros are for static declarations. Either global variables
or a variable marked as static:

struct plist_head myhead = PLIST_HEAD_INIT(myhead, mylock);

or

int foo() {
	static struct plist_head bar = PLIST_HEAD_INIT(bar, mylock);

	[...]
}

or

struct foo bar = {
	.zoop = PLIST_HEAD_INIT(bar.zoop, mylock),
};


> 
>    it says :
> 
> 
> /home/monica/Escritorio/plists/priolist.c: In function 'init_module': 
> /home/monica/Escritorio/plists/priolist.c:67: error: expected expression 
> before '.' token
> 
> 
>    --> To solve this I used the functions:
> 
> 
> - static inline void plist_head_init(struct plist_head *head, struct 
> spinlock *lock)
> 
> - static inline void plist_node_init(struct plist_node *node, int prio)

Right, for runtime code you must use these.


> 
>    But I still have the problem with the MACRO
> 
> 
> 
> 
> * Second error, problem using plist_add:
> 
>    It says:
> 
> 
> “WARNING: "plist_add" [/home/monica/Escritorio/plists/priolist.ko] 
> undefined! ”

Simple, plist_add() isn't exported to modules.

Hmm, none of the plist functions are. I guess it wouldn't hurt to make
them EXPORT_SYMBOL_GPL()

Maybe we'll do that. Is this just for learning or are you planing on
adding a real GPL module to Linux that uses plists. For learning, it may
not be worth adding these symbols, but if you have a legit reason for
modules to use plists, than I don't see any harm in exporting them.

-- Steve

> 
>    I made the module GPL, I don't know what am I doing wrong.
> 
> Does anybody have an idea what is happening?
> 
> Thanks in advance for any help,
> 
> Cheers,
> 



      reply	other threads:[~2011-12-22  3:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-20  9:24 Monica Puig-Pey
2011-12-22  3:51 ` Steven Rostedt [this message]

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=1324525862.5916.121.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=puigpeym@unican.es \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®