lkml.org 
[lkml]   [2004]   [Aug]   [2]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
FromMåns Rullgård <>
SubjectRe: Oops in register_chrdev, what did I do?
DateMon, 02 Aug 2004 10:15:05 +0200
Tommy Reynolds <Tommy.Reynolds@MegaCoder.com> writes:

> Uttered Måns Rullgård <mru@kth.se>, spake thus:
>
>> While experimenting a bit with a small kernel module, I got this
>> oops.  Digging further, I found that /proc/devices had an entry saying
>> 248 <NULL>
>> which would indicate that I passed a NULL name to register_chrdev(),
>> only I didn't.  I used a string constant, so I can't see what changed
>> it to NULL along the way.
>> 
>> What am I missing here?
>
> Enough information for us to help you.  Show us your code snippet,
> please.

I can't imagine that the details of the fops functions are a problem,
since they never get called.

static struct file_operations foo_fops = {
    .owner   = THIS_MODULE,
    .open    = foo_open,
    .read    = foo_read,
    .write   = foo_write,
    .mmap    = foo_mmap,
    .release = foo_release
};
static int __init
init_foo(void)
{
    int err;
    err = register_chrdev(foo_major, "foo", &foo_fops);
    if(err)
	return err;
    return 0;
}
static void __exit
exit_foo(void)
{
    unregister_chrdev(foo_major, "foo");
}
module_init(init_foo);
module_exit(exit_foo);
MODULE_LICENSE("GPL");

-- 
Måns Rullgård
mru@kth.se

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:04    [from the cache]
©2003-2008