Commit ddef8ca8 authored by Richard Gooch's avatar Richard Gooch

Merge atnf.csiro.au:/workaholix1/kernel/v2.5/linus

into atnf.csiro.au:/workaholix1/kernel/v2.5/rgooch-2.5
parents 46979afd 0043c64d
......@@ -1941,3 +1941,12 @@ Changes for patch v214
- Updated README from master HTML file
- Fixed devfs entry leak in <devfs_readdir> when *readdir fails
===============================================================================
Changes for patch v215
- Created <devfs_find_and_unregister>
- Switched many functions from <devfs_find_handle> to
<devfs_find_and_unregister>
- Switched many functions from <devfs_find_handle> to <devfs_get_handle>
......@@ -336,7 +336,7 @@ void cleanup_module(void)
del_gendisk(&ida_gendisk[i]);
}
devfs_unregister(devfs_find_handle(NULL, "ida", 0, 0, 0, 0));
devfs_find_and_unregister(NULL, "ida", 0, 0, 0, 0);
remove_proc_entry("cpqarray", proc_root_driver);
kfree(ida);
kfree(ida_sizes);
......
......@@ -1957,8 +1957,7 @@ int __init aztcd_init(void)
void __exit aztcd_exit(void)
{
devfs_unregister(devfs_find_handle
(NULL, "aztcd", 0, 0, DEVFS_SPECIAL_BLK, 0));
devfs_find_and_unregister(NULL, "aztcd", 0, 0, DEVFS_SPECIAL_BLK, 0);
if ((devfs_unregister_blkdev(MAJOR_NR, "aztcd") == -EINVAL)) {
printk("What's that: can't unregister aztcd\n");
return;
......
......@@ -933,8 +933,7 @@ void __exit exit_gscd(void)
{
CLEAR_TIMER;
devfs_unregister(devfs_find_handle
(NULL, "gscd", 0, 0, DEVFS_SPECIAL_BLK, 0));
devfs_find_and_unregister(NULL, "gscd", 0, 0, DEVFS_SPECIAL_BLK, 0);
if ((devfs_unregister_blkdev(MAJOR_NR, "gscd") == -EINVAL)) {
printk("What's that: can't unregister GoldStar-module\n");
return;
......
......@@ -2051,8 +2051,7 @@ int __init optcd_init(void)
void __exit optcd_exit(void)
{
devfs_unregister(devfs_find_handle(NULL, "optcd", 0, 0,
DEVFS_SPECIAL_BLK, 0));
devfs_find_and_unregister(NULL, "optcd", 0, 0, DEVFS_SPECIAL_BLK, 0);
if (devfs_unregister_blkdev(MAJOR_NR, "optcd") == -EINVAL) {
printk(KERN_ERR "optcd: what's that: can't unregister\n");
return;
......
......@@ -1802,8 +1802,7 @@ static int sjcd_cleanup(void)
void __exit sjcd_exit(void)
{
devfs_unregister(devfs_find_handle
(NULL, "sjcd", 0, 0, DEVFS_SPECIAL_BLK, 0));
devfs_find_and_unregister(NULL, "sjcd", 0, 0, DEVFS_SPECIAL_BLK, 0);
if (sjcd_cleanup())
printk("SJCD: module: cannot be removed.\n");
else
......
......@@ -1700,8 +1700,8 @@ sony535_exit(void)
kfree(sony_buffer);
kfree(last_sony_subcode);
kfree(sony_toc);
devfs_unregister(devfs_find_handle(NULL, CDU535_HANDLE, 0, 0,
DEVFS_SPECIAL_BLK, 0));
devfs_find_and_unregister(NULL, CDU535_HANDLE, 0, 0,
DEVFS_SPECIAL_BLK, 0);
if (devfs_unregister_blkdev(MAJOR_NR, CDU535_HANDLE) == -EINVAL)
printk("Uh oh, couldn't unregister " CDU535_HANDLE "\n");
else
......
......@@ -426,17 +426,17 @@ void cleanup_module(void)
}
for (i = 0; i < 4; i++) {
sprintf(devname, "qft%i", i);
devfs_unregister(devfs_find_handle(NULL, devname, QIC117_TAPE_MAJOR, i, DEVFS_SPECIAL_CHR, 0));
devfs_find_and_unregister(NULL, devname, QIC117_TAPE_MAJOR, i, DEVFS_SPECIAL_CHR, 0);
sprintf(devname, "nqft%i", i);
devfs_unregister(devfs_find_handle(NULL, devname, QIC117_TAPE_MAJOR, i + 4, DEVFS_SPECIAL_CHR, 0));
devfs_find_and_unregister(NULL, devname, QIC117_TAPE_MAJOR, i + 4, DEVFS_SPECIAL_CHR, 0);
sprintf(devname, "zqft%i", i);
devfs_unregister(devfs_find_handle(NULL, devname, QIC117_TAPE_MAJOR, i + 16, DEVFS_SPECIAL_CHR, 0));
devfs_find_and_unregister(NULL, devname, QIC117_TAPE_MAJOR, i + 16, DEVFS_SPECIAL_CHR, 0);
sprintf(devname, "nzqft%i", i);
devfs_unregister(devfs_find_handle(NULL, devname, QIC117_TAPE_MAJOR, i + 20, DEVFS_SPECIAL_CHR, 0));
devfs_find_and_unregister(NULL, devname, QIC117_TAPE_MAJOR, i + 20, DEVFS_SPECIAL_CHR, 0);
sprintf(devname, "rawqft%i", i);
devfs_unregister(devfs_find_handle(NULL, devname, QIC117_TAPE_MAJOR, i + 32, DEVFS_SPECIAL_CHR, 0));
devfs_find_and_unregister(NULL, devname, QIC117_TAPE_MAJOR, i + 32, DEVFS_SPECIAL_CHR, 0);
sprintf(devname, "nrawqft%i", i);
devfs_unregister(devfs_find_handle(NULL, devname, QIC117_TAPE_MAJOR, i + 36, DEVFS_SPECIAL_CHR, 0));
devfs_find_and_unregister(NULL, devname, QIC117_TAPE_MAJOR, i + 36, DEVFS_SPECIAL_CHR, 0);
}
zft_uninit_mem(); /* release remaining memory, if any */
printk(KERN_INFO "zftape successfully unloaded.\n");
......
......@@ -2931,30 +2931,22 @@ void cleanup_module(void)
qic02_release_resources();
}
devfs_unregister_chrdev(QIC02_TAPE_MAJOR, TPQIC02_NAME);
devfs_unregister(devfs_find_handle
(NULL, "ntpqic11", QIC02_TAPE_MAJOR, 2,
DEVFS_SPECIAL_CHR, 0));
devfs_unregister(devfs_find_handle
(NULL, "tpqic11", QIC02_TAPE_MAJOR, 3,
DEVFS_SPECIAL_CHR, 0));
devfs_unregister(devfs_find_handle
(NULL, "ntpqic24", QIC02_TAPE_MAJOR, 4,
DEVFS_SPECIAL_CHR, 0));
devfs_unregister(devfs_find_handle
(NULL, "tpqic24", QIC02_TAPE_MAJOR, 5,
DEVFS_SPECIAL_CHR, 0));
devfs_unregister(devfs_find_handle
(NULL, "ntpqic120", QIC02_TAPE_MAJOR, 6,
DEVFS_SPECIAL_CHR, 0));
devfs_unregister(devfs_find_handle
(NULL, "tpqic120", QIC02_TAPE_MAJOR, 7,
DEVFS_SPECIAL_CHR, 0));
devfs_unregister(devfs_find_handle
(NULL, "ntpqic150", QIC02_TAPE_MAJOR, 8,
DEVFS_SPECIAL_CHR, 0));
devfs_unregister(devfs_find_handle
(NULL, "tpqic150", QIC02_TAPE_MAJOR, 9,
DEVFS_SPECIAL_CHR, 0));
devfs_find_and_unregister(NULL, "ntpqic11", QIC02_TAPE_MAJOR, 2,
DEVFS_SPECIAL_CHR, 0);
devfs_find_and_unregister(NULL, "tpqic11", QIC02_TAPE_MAJOR, 3,
DEVFS_SPECIAL_CHR, 0);
devfs_find_and_unregister(NULL, "ntpqic24", QIC02_TAPE_MAJOR, 4,
DEVFS_SPECIAL_CHR, 0);
devfs_find_and_unregister(NULL, "tpqic24", QIC02_TAPE_MAJOR, 5,
DEVFS_SPECIAL_CHR, 0);
devfs_find_and_unregister(NULL, "ntpqic120", QIC02_TAPE_MAJOR, 6,
DEVFS_SPECIAL_CHR, 0);
devfs_find_and_unregister(NULL, "tpqic120", QIC02_TAPE_MAJOR, 7,
DEVFS_SPECIAL_CHR, 0);
devfs_find_and_unregister(NULL, "ntpqic150", QIC02_TAPE_MAJOR, 8,
DEVFS_SPECIAL_CHR, 0);
devfs_find_and_unregister(NULL, "tpqic150", QIC02_TAPE_MAJOR, 9,
DEVFS_SPECIAL_CHR, 0);
}
int init_module(void)
......
......@@ -2047,14 +2047,12 @@ void tty_register_devfs (struct tty_driver *driver, unsigned int flags, unsigned
void tty_unregister_devfs (struct tty_driver *driver, unsigned minor)
{
#ifdef CONFIG_DEVFS_FS
void * handle;
int idx = minor - driver->minor_start;
char buf[32];
sprintf(buf, driver->name, idx + driver->name_base);
handle = devfs_find_handle (NULL, buf, driver->major, minor,
devfs_find_and_unregister(NULL, buf, driver->major, minor,
DEVFS_SPECIAL_CHR, 0);
devfs_unregister (handle);
#endif /* CONFIG_DEVFS_FS */
}
......
......@@ -480,10 +480,10 @@ void vcs_make_devfs (unsigned int index, int unregister)
sprintf (name, "a%u", index + 1);
if (unregister)
{
devfs_unregister ( devfs_find_handle (devfs_handle, name + 1, 0, 0,
DEVFS_SPECIAL_CHR, 0) );
devfs_unregister ( devfs_find_handle (devfs_handle, name, 0, 0,
DEVFS_SPECIAL_CHR, 0) );
devfs_find_and_unregister(devfs_handle, name + 1, 0, 0,
DEVFS_SPECIAL_CHR, 0);
devfs_find_and_unregister(devfs_handle, name, 0, 0,
DEVFS_SPECIAL_CHR, 0);
}
else
{
......
......@@ -1527,7 +1527,7 @@ static void __exit capi_exit(void)
proc_exit();
devfs_unregister_chrdev(capi_major, "capi20");
devfs_unregister(devfs_find_handle(NULL, "isdn/capi20", capi_major, 0, DEVFS_SPECIAL_CHR, 0));
devfs_find_and_unregister(NULL, "isdn/capi20", capi_major, 0, DEVFS_SPECIAL_CHR, 0);
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
capinc_tty_exit();
......
......@@ -3412,12 +3412,13 @@ void __init md_setup_drive(void)
*p++ = 0;
dev = name_to_kdev_t(devname);
handle = devfs_find_handle(NULL, devname, major(dev), minor(dev),
handle = devfs_get_handle(NULL, devname, major(dev), minor(dev),
DEVFS_SPECIAL_BLK, 1);
if (handle != 0) {
unsigned major, minor;
devfs_get_maj_min(handle, &major, &minor);
dev = mk_kdev(major, minor);
devfs_put(handle);
}
if (kdev_none(dev)) {
printk(KERN_WARNING "md: Unknown device name: %s\n", devname);
......
......@@ -54,18 +54,15 @@ void fs3270_devfs_register(tub_t *tubp)
void fs3270_devfs_unregister(tub_t *tubp)
{
char name[16];
devfs_handle_t handle;
sprintf(name, "tub%.4x", tubp->devno);
handle = devfs_find_handle (fs3270_devfs_dir, name,
devfs_find_and_unregister(fs3270_devfs_dir, name,
IBM_FS3270_MAJOR, tubp->minor,
DEVFS_SPECIAL_CHR, 0);
devfs_unregister (handle);
sprintf(name, "tty%.4x", tubp->devno);
handle = devfs_find_handle (fs3270_devfs_dir, name,
devfs_find_and_unregister(fs3270_devfs_dir, name,
IBM_TTY3270_MAJOR, tubp->minor,
DEVFS_SPECIAL_CHR, 0);
devfs_unregister(handle);
}
#endif
......
......@@ -2077,7 +2077,6 @@ int register_sparcaudio_driver(struct sparcaudio_driver *drv, int duplex)
int unregister_sparcaudio_driver(struct sparcaudio_driver *drv, int duplex)
{
devfs_handle_t de;
int i;
char name_buf[32];
......@@ -2104,9 +2103,8 @@ int unregister_sparcaudio_driver(struct sparcaudio_driver *drv, int duplex)
/* Unregister ourselves with devfs */
for (i=0; i < sizeof (dev_list) / sizeof (*dev_list); i++) {
sparcaudio_mkname (name_buf, dev_list[i].name, drv->index);
de = devfs_find_handle (devfs_handle, name_buf, 0, 0,
devfs_find_and_unregister(devfs_handle, name_buf, 0, 0,
DEVFS_SPECIAL_CHR, 0);
devfs_unregister (de);
}
MOD_DEC_USE_COUNT;
......
......@@ -765,8 +765,11 @@ static /* const */ struct usb_driver hiddev_driver = {
int __init hiddev_init(void)
{
hiddev_devfs_handle =
devfs_mk_dir(devfs_find_handle(NULL, "usb", 0, 0, 0, 0), "hid", NULL);
devfs_handle_t de;
de = devfs_get_handle(NULL, "usb", 0, 0, 0, 0);
hiddev_devfs_handle = devfs_mk_dir(de, "hid", NULL);
devfs_put(de);
usb_register(&hiddev_driver);
return 0;
}
......
......@@ -489,11 +489,12 @@ int check_disk_change(kdev_t dev)
if (bdops == NULL) {
devfs_handle_t de;
de = devfs_find_handle (NULL, NULL, i, minor(dev),
de = devfs_get_handle(NULL, NULL, i, minor(dev),
DEVFS_SPECIAL_BLK, 0);
if (de) {
bdops = devfs_get_ops (de);
devfs_put_ops (de); /* We're running in owner module */
bdops = devfs_get_ops(de);
devfs_put_ops(de); /* We're running in owner module */
devfs_put(de);
}
}
if (bdops == NULL)
......
......@@ -639,6 +639,9 @@
20020722 Richard Gooch <rgooch@atnf.csiro.au>
Fixed devfs entry leak in <devfs_readdir> when *readdir fails.
v1.18
20020725 Richard Gooch <rgooch@atnf.csiro.au>
Created <devfs_find_and_unregister>.
v1.19
*/
#include <linux/types.h>
#include <linux/errno.h>
......@@ -671,7 +674,7 @@
#include <asm/bitops.h>
#include <asm/atomic.h>
#define DEVFS_VERSION "1.18 (20020722)"
#define DEVFS_VERSION "1.19 (20020725)"
#define DEVFS_NAME "devfs"
......@@ -1881,6 +1884,16 @@ devfs_handle_t devfs_get_handle (devfs_handle_t dir, const char *name,
return _devfs_find_entry (dir, name, major, minor, type,traverse_symlinks);
} /* End Function devfs_get_handle */
void devfs_find_and_unregister (devfs_handle_t dir, const char *name,
unsigned int major, unsigned int minor,
char type, int traverse_symlinks)
{
devfs_handle_t de = devfs_get_handle (dir, name, major, minor,
type,traverse_symlinks);
devfs_unregister (de);
devfs_put (de);
}
/* Compatibility function. Will be removed in sometime in 2.5 */
......
......@@ -74,6 +74,9 @@ extern devfs_handle_t devfs_mk_dir (devfs_handle_t dir, const char *name,
extern devfs_handle_t devfs_get_handle (devfs_handle_t dir, const char *name,
unsigned int major,unsigned int minor,
char type, int traverse_symlinks);
extern void devfs_find_and_unregister (devfs_handle_t dir, const char *name,
unsigned int major, unsigned int minor,
char type, int traverse_symlinks);
extern devfs_handle_t devfs_find_handle (devfs_handle_t dir, const char *name,
unsigned int major,unsigned int minor,
char type, int traverse_symlinks);
......@@ -164,6 +167,13 @@ static inline devfs_handle_t devfs_get_handle (devfs_handle_t dir,
{
return NULL;
}
static inline void devfs_find_and_unregister (devfs_handle_t dir,
const char *name,
unsigned int major,
unsigned int minor,
char type, int traverse_symlinks)
{
}
static inline devfs_handle_t devfs_find_handle (devfs_handle_t dir,
const char *name,
unsigned int major,
......
......@@ -356,11 +356,12 @@ static int __init create_dev(char *name, dev_t dev, char *devfs_name)
if (!do_devfs)
return sys_mknod(name, S_IFBLK|0600, dev);
handle = devfs_find_handle(NULL, !dev ? devfs_name : NULL,
handle = devfs_get_handle(NULL, !dev ? devfs_name : NULL,
MAJOR(dev), MINOR(dev), DEVFS_SPECIAL_BLK, 1);
if (!handle)
return -1;
n = devfs_generate_path(handle, path + 5, sizeof (path) - 5);
devfs_put(handle);
if (n < 0)
return -1;
return sys_symlink(path + n + 5, name);
......
......@@ -973,10 +973,10 @@ void snd_info_free_device(snd_info_entry_t * entry)
sprintf(dname, "snd/%s", entry->name);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
master = devfs_find_handle(NULL, dname, strlen(dname), 0, 0, DEVFS_SPECIAL_CHR, 0);
devfs_unregister(master);
#else
master = devfs_find_handle(NULL, dname, 0, 0, DEVFS_SPECIAL_CHR, 0);
devfs_find_and_unregister(NULL, dname, 0, 0, DEVFS_SPECIAL_CHR, 0);
#endif
devfs_unregister(master);
}
#endif
snd_info_free_entry(entry);
......
......@@ -368,10 +368,10 @@ static void __exit alsa_sound_exit(void)
sprintf(controlname, "snd/controlC%d", controlnum);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
master = devfs_find_handle(NULL, controlname, strlen(controlname), 0, 0, DEVFS_SPECIAL_CHR, 0);
devfs_unregister(master);
#else
master = devfs_find_handle(NULL, controlname, 0, 0, DEVFS_SPECIAL_CHR, 0);
devfs_find_and_unregister(NULL, controlname, 0, 0, DEVFS_SPECIAL_CHR, 0);
#endif
devfs_unregister(master);
}
#endif
......
......@@ -566,13 +566,9 @@ static void soundcard_register_devfs (int do_register)
SOUND_MAJOR, dev_list[i].minor+ (j* 0x10),
S_IFCHR | dev_list[i].mode,
&oss_sound_fops, NULL);
else {
devfs_handle_t de;
de = devfs_find_handle (NULL, name_buf, 0, 0,
DEVFS_SPECIAL_CHR, 0);
devfs_unregister (de);
}
else
devfs_find_and_unregister(NULL, name_buf, 0, 0,
DEVFS_SPECIAL_CHR,0);
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment