Messages in this thread Patch in this message | | | Subject | Revertion of bad "cleanup". | Date | Thu, 6 Jul 2000 10:48:04 +0200 (MEST) | From | (Rogier Wolff) |
| |
Hi,
If I understand things correctly, an open of a device with the driver as a module now automatically increases the module use count. That's great!
So all "open" routines that contained nothing but "inc_module_use_count" were removed. Great!
However, the SX and RIO drivers use a "misc" device to download the firmware. The problem is that the "misc" driver returns "enodev" when there is no "open" routine. So either we need to make it allow "misc" devices that don't have an open/close routine, or we have to reinstate the open routines for the SX and RIO firmware devices.
The attached patch does just that. (If I remember correctly, Linux usually assumes "no special open code" when "...->open" is NULL, so I'd say that "misc" is wrong. But my guess is that someone ran into SOME problem when this was changed. Maybe it has always been like this.)
Anyway, this makes RIO and SX work again.
Roger.
diff -u -r --new-file linux-2.4.0-test3-pre1.clean/drivers/char/rio/rio_linux.c linux-2.4.0-test3-pre1.ozon/drivers/char/rio/rio_linux.c --- linux-2.4.0-test3-pre1.clean/drivers/char/rio/rio_linux.c Wed Jul 5 11:09:58 2000 +++ linux-2.4.0-test3-pre1.ozon/drivers/char/rio/rio_linux.c Wed Jul 5 16:14:56 2000 @@ -201,6 +201,8 @@ static int rio_chars_in_buffer (void * ptr); static int rio_fw_ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); +static int rio_fw_open(struct inode *inode, struct file *filp); +static INT rio_fw_release(struct inode *inode, struct file *filp); static int rio_init_drivers(void); @@ -277,6 +279,8 @@ static struct file_operations rio_fw_fops = { owner: THIS_MODULE, ioctl: rio_fw_ioctl, + open: rio_fw_open, + release: rio_fw_release, }; struct miscdevice rio_fw_device = { @@ -529,6 +533,27 @@ * Here are the routines that actually * * interface with the generic_serial driver * * ********************************************************************** */ + + + +static int rio_fw_open(struct inode *inode, struct file *filp) +{ + func_enter (); + /* rio_inc_mod_count (); */ + func_exit (); + return 0; +} + + +static INT rio_fw_release(struct inode *inode, struct file *filp) +{ + func_enter (); + /* rio_dec_mod_count (); */ + func_exit (); + return NO_ERROR; +} + + /* Ehhm. I don't know how to fiddle with interrupts on the Specialix cards. .... Hmm. Ok I figured it out. You don't. -- REW */ diff -u -r --new-file linux-2.4.0-test3-pre1.clean/drivers/char/sx.c linux-2.4.0-test3-pre1.ozon/drivers/char/sx.c --- linux-2.4.0-test3-pre1.clean/drivers/char/sx.c Wed Jul 5 11:09:59 2000 +++ linux-2.4.0-test3-pre1.ozon/drivers/char/sx.c Wed Jul 5 15:33:44 2000 @@ -304,6 +304,8 @@ static int sx_init_portstructs (int nboards, int nports); static int sx_fw_ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); +static int sx_fw_open(struct inode *inode, struct file *filp); +static INT sx_fw_release(struct inode *inode, struct file *filp); static int sx_init_drivers(void); @@ -419,6 +421,8 @@ static struct file_operations sx_fw_fops = { owner: THIS_MODULE, ioctl: sx_fw_ioctl, + open: sx_fw_open, + release: sx_fw_release, }; struct miscdevice sx_fw_device = { @@ -1414,6 +1418,25 @@ * Here are the routines that actually * * interface with the rest of the system * * ********************************************************************** */ + +static int sx_fw_open(struct inode *inode, struct file *filp) +{ + func_enter (); + /* MOD_INC_USE_COUNT; */ + func_exit (); + return 0; +} + + +static INT sx_fw_release(struct inode *inode, struct file *filp) +{ + func_enter (); + /* MOD_DEC_USE_COUNT; */ + func_exit (); + return NO_ERROR; +} + + static int sx_open (struct tty_struct * tty, struct file * filp) {
-- ** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 ** *-- BitWizard writes Linux device drivers for any device you may have! --* * Common sense is the collection of * ****** prejudices acquired by age eighteen. -- Albert Einstein ******** - 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/
| |