[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to access correctly serial port inside module?



Hi,
I am writing a radio card driver for the Gemtek "Wizard Radio". This radio 
device is connected to computer through serial port so int the driver I need 
to access serial port to send command to radio device. Few days ago, Anil 
(aprasad@in.ibm.com) give me a code to access a file from within the kernel:

struct file *filp;
mm_segment_t old_fs;
filp = filp_open(name,flags,mode);
old_fs= getfs();
set_fs(KERNEL_DS);
filp->f_op->read(filp,buffer,count,&filp->f_pos);

This code was declared dangerous so what is the correct way to access serial 
port within the kernel?

Thanks to all.

Tiziano
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.surriel.com/kernelnewbies.shtml