Re: Question about linux drivers

Alessandro Rubini (rubini@pop.systemy.it)
Mon, 16 Nov 1998 17:15:21 +0100


Hello.

> If I have a driver with dynamic major number, it won't know it's major
> number until after it's loaded into the kernel. Is there any
> standarized ways of retrieving it's major number, so the special file
> in the /dev directory can be updated?

You can grep for its name in /proc/devices, and create your /dev
nodes based on that.

I'm sending you one such script privately.

> [...] Is there any ways to automate this? I.e. I call a function
> before I enter this loop that sais: "It's OK to switch
> process/context when appropriate", so I don't have to worry about
> locking the whole kernel.

Yes. You can change current->state to TASK_INTERRUPTIBLE, and then
call schedule(). If a process is wating for processor time, it will
get it. Change back current->stat to TASK_RUNNING when you are done.

The kernel is full of such examples.

/alessandro

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