[Linux1394-cvslog] rev 757 - trunk
Brought to you by:
aeb,
bencollins
From: SVN U. <ben...@li...> - 2003-02-01 14:23:34
|
Author: bencollins Date: 2003-01-23 19:37:12 -0500 (Thu, 23 Jan 2003) New Revision: 757 Modified: trunk/ieee1394_core.c Log: Merge in newer module interfaces from 2.5.59. Modified: trunk/ieee1394_core.c ============================================================================== --- trunk/ieee1394_core.c (original) +++ trunk/ieee1394_core.c 2003-02-01 08:59:37.000000000 -0500 @@ -1055,7 +1055,7 @@ { int ret = 0; - if( (blocknum < 0) || (blocknum > 15) ) + if ((blocknum < 0) || (blocknum > 15)) return ret; read_lock(&ieee1394_chardevs_lock); @@ -1063,11 +1063,10 @@ *module = ieee1394_chardevs[blocknum].module; *file_ops = ieee1394_chardevs[blocknum].file_ops; - if(*file_ops == NULL) + if (*file_ops == NULL) goto out; - /* don't need try_inc_mod_count if the driver is non-modular */ - if(*module && (try_inc_mod_count(*module) == 0)) + if (!try_module_get(*module)) goto out; /* success! */ @@ -1127,36 +1126,26 @@ if(retval == 0) { /* If the open() succeeded, then ieee1394 will be left - with an extra module reference, so we discard it here. - - The task-specific driver still has the extra - reference given to it by ieee1394_get_chardev(). - This extra reference prevents the module from - unloading while the file is open, and will be - dropped by the VFS when the file is released. - */ - - if(THIS_MODULE) - __MOD_DEC_USE_COUNT((struct module*) THIS_MODULE); - - /* note that if ieee1394 is compiled into the kernel, - THIS_MODULE will be (void*) NULL, hence the if and - the cast are necessary */ + * with an extra module reference, so we discard it here. + * + * The task-specific driver still has the extra reference + * given to it by ieee1394_get_chardev(). This extra + * reference prevents the module from unloading while the + * file is open, and will be dropped by the VFS when the + * file is released. */ + module_put(THIS_MODULE); } else { - - /* if the open() failed, then we need to drop the - extra reference we gave to the task-specific - driver */ - - if(module) - __MOD_DEC_USE_COUNT(module); - /* point the file's f_ops back to ieee1394. The VFS will then decrement ieee1394's reference count immediately after this function returns. */ file->f_op = &ieee1394_chardev_ops; + + /* If the open() failed, then we need to drop the extra + * reference we gave to the task-specific driver. */ + + module_put(module); } return retval; |