Commit ea9f4006 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Remove the devfs_should* functions I added, and replace them with one devfs_only() call

This now explains what is really going on much better than before.
parent 05535aec
...@@ -453,7 +453,7 @@ struct block_device_operations * get_blkfops(unsigned int major) ...@@ -453,7 +453,7 @@ struct block_device_operations * get_blkfops(unsigned int major)
int register_blkdev(unsigned int major, const char * name, struct block_device_operations *bdops) int register_blkdev(unsigned int major, const char * name, struct block_device_operations *bdops)
{ {
if (devfs_should_register_blkdev()) if (devfs_only())
return 0; return 0;
if (major == 0) { if (major == 0) {
for (major = MAX_BLKDEV-1; major > 0; major--) { for (major = MAX_BLKDEV-1; major > 0; major--) {
...@@ -476,7 +476,7 @@ int register_blkdev(unsigned int major, const char * name, struct block_device_o ...@@ -476,7 +476,7 @@ int register_blkdev(unsigned int major, const char * name, struct block_device_o
int unregister_blkdev(unsigned int major, const char * name) int unregister_blkdev(unsigned int major, const char * name)
{ {
if (devfs_should_unregister_blkdev()) if (devfs_only())
return 0; return 0;
if (major >= MAX_BLKDEV) if (major >= MAX_BLKDEV)
return -EINVAL; return -EINVAL;
......
...@@ -2228,60 +2228,18 @@ const char *devfs_get_name (devfs_handle_t de, unsigned int *namelen) ...@@ -2228,60 +2228,18 @@ const char *devfs_get_name (devfs_handle_t de, unsigned int *namelen)
/** /**
* devfs_should_register_chrdev - should we register a conventional character driver. * devfs_only - returns if "devfs=only" is a boot option
* *
* If "devfs=only" this function will return -1, otherwise 0 is returned. * If "devfs=only" this function will return 1, otherwise 0 is returned.
*/ */
int devfs_should_register_chrdev (void) int devfs_only (void)
{ {
if (boot_options & OPTION_ONLY) if (boot_options & OPTION_ONLY)
return -1; return 1;
return 0;
}
/**
* devfs_should_register_blkdev - should we register a conventional block driver.
*
* If the "devfs=only" option was provided at boot time, this function will
* return -1, otherwise 0 is returned.
*/
int devfs_should_register_blkdev (void)
{
if (boot_options & OPTION_ONLY)
return -1;
return 0;
}
/**
* devfs_should_unregister_chrdev - should we unregister a conventional character driver.
*
* If "devfs=only" this function will return -1, otherwise 0 is returned
*/
int devfs_should_unregister_chrdev (void)
{
if (boot_options & OPTION_ONLY)
return -1;
return 0; return 0;
} }
/**
* devfs_should_unregister_blkdev - should we unregister a conventional block driver.
*
* If the "devfs=only" option was provided at boot time, this function will
* return -1, otherwise 0 is returned.
*/
int devfs_should_unregister_blkdev (void)
{
if (boot_options & OPTION_ONLY)
return -1;
return 0;
}
/** /**
* devfs_setup - Process kernel boot options. * devfs_setup - Process kernel boot options.
* @str: The boot options after the "devfs=". * @str: The boot options after the "devfs=".
......
...@@ -98,7 +98,7 @@ static struct file_operations * get_chrfops(unsigned int major, unsigned int min ...@@ -98,7 +98,7 @@ static struct file_operations * get_chrfops(unsigned int major, unsigned int min
int register_chrdev(unsigned int major, const char * name, struct file_operations *fops) int register_chrdev(unsigned int major, const char * name, struct file_operations *fops)
{ {
if (devfs_should_register_chrdev()) if (devfs_only())
return 0; return 0;
if (major == 0) { if (major == 0) {
write_lock(&chrdevs_lock); write_lock(&chrdevs_lock);
...@@ -128,7 +128,7 @@ int register_chrdev(unsigned int major, const char * name, struct file_operation ...@@ -128,7 +128,7 @@ int register_chrdev(unsigned int major, const char * name, struct file_operation
int unregister_chrdev(unsigned int major, const char * name) int unregister_chrdev(unsigned int major, const char * name)
{ {
if (devfs_should_register_chrdev()) if (devfs_only())
return 0; return 0;
if (major >= MAX_CHRDEV) if (major >= MAX_CHRDEV)
return -EINVAL; return -EINVAL;
......
...@@ -94,10 +94,7 @@ extern devfs_handle_t devfs_get_next_sibling (devfs_handle_t de); ...@@ -94,10 +94,7 @@ extern devfs_handle_t devfs_get_next_sibling (devfs_handle_t de);
extern void devfs_auto_unregister (devfs_handle_t master,devfs_handle_t slave); extern void devfs_auto_unregister (devfs_handle_t master,devfs_handle_t slave);
extern devfs_handle_t devfs_get_unregister_slave (devfs_handle_t master); extern devfs_handle_t devfs_get_unregister_slave (devfs_handle_t master);
extern const char *devfs_get_name (devfs_handle_t de, unsigned int *namelen); extern const char *devfs_get_name (devfs_handle_t de, unsigned int *namelen);
extern int devfs_should_register_chrdev (void); extern int devfs_only (void);
extern int devfs_should_register_blkdev (void);
extern int devfs_should_unregister_chrdev (void);
extern int devfs_should_unregister_blkdev (void);
extern void devfs_register_tape (devfs_handle_t de); extern void devfs_register_tape (devfs_handle_t de);
extern void devfs_register_series (devfs_handle_t dir, const char *format, extern void devfs_register_series (devfs_handle_t dir, const char *format,
...@@ -237,19 +234,7 @@ static inline const char *devfs_get_name (devfs_handle_t de, ...@@ -237,19 +234,7 @@ static inline const char *devfs_get_name (devfs_handle_t de,
{ {
return NULL; return NULL;
} }
static inline int devfs_should_register_chrdev (void) static inline int devfs_only (void)
{
return 0;
}
static inline int devfs_should_register_blkdev (void)
{
return 0;
}
static inline int devfs_should_unregister_chrdev (void)
{
return 0;
}
static inline int devfs_should_unregister_blkdev (void)
{ {
return 0; return 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