Commit 7d464ed4 authored by Chas Williams's avatar Chas Williams Committed by David S. Miller

[ATM]: reduce CONFIG_PROC_FS #ifdef clutter in .c code (from levon@movementarian.org)

parent a203da95
......@@ -1114,12 +1114,10 @@ static int __init atm_init(void)
printk(KERN_ERR "atmsvc_init() failed with %d\n", error);
goto failure;
}
#ifdef CONFIG_PROC_FS
if ((error = atm_proc_init()) < 0) {
printk(KERN_ERR "atm_proc_init() failed with %d\n",error);
goto failure;
}
#endif
return 0;
failure:
......@@ -1130,9 +1128,7 @@ static int __init atm_init(void)
static void __exit atm_exit(void)
{
#ifdef CONFIG_PROC_FS
atm_proc_exit();
#endif
atmsvc_exit();
atmpvc_exit();
}
......
......@@ -33,8 +33,21 @@ int atmpvc_init(void);
void atmpvc_exit(void);
int atmsvc_init(void);
void atmsvc_exit(void);
#ifdef CONFIG_PROC_FS
int atm_proc_init(void);
void atm_proc_exit(void);
#else
static inline int atm_proc_init(void)
{
return 0;
}
static inline void atm_proc_exit(void)
{
/* nothing */
}
#endif /* CONFIG_PROC_FS */
/* SVC */
......
......@@ -593,6 +593,10 @@ int atm_proc_dev_register(struct atm_dev *dev)
int digits,num;
int error;
/* No proc info */
if (!dev->ops->proc_read)
return 0;
error = -ENOMEM;
digits = 0;
for (num = dev->number; num; num /= 10) digits++;
......@@ -619,6 +623,9 @@ int atm_proc_dev_register(struct atm_dev *dev)
void atm_proc_dev_deregister(struct atm_dev *dev)
{
if (!dev->ops->proc_read)
return;
remove_proc_entry(dev->proc_name, atm_proc_root);
kfree(dev->proc_name);
}
......
......@@ -110,8 +110,6 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
list_add_tail(&dev->dev_list, &atm_devs);
spin_unlock(&atm_dev_lock);
#ifdef CONFIG_PROC_FS
if (ops->proc_read) {
if (atm_proc_dev_register(dev) < 0) {
printk(KERN_ERR "atm_dev_register: "
"atm_proc_dev_register failed for dev %s\n",
......@@ -122,8 +120,6 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
__free_atm_dev(dev);
return NULL;
}
}
#endif
return dev;
}
......@@ -133,10 +129,8 @@ void atm_dev_deregister(struct atm_dev *dev)
{
unsigned long warning_time;
#ifdef CONFIG_PROC_FS
if (dev->ops->proc_read)
atm_proc_dev_deregister(dev);
#endif
spin_lock(&atm_dev_lock);
list_del(&dev->dev_list);
spin_unlock(&atm_dev_lock);
......
......@@ -24,6 +24,18 @@ int atm_dev_ioctl(unsigned int cmd, unsigned long arg);
int atm_proc_dev_register(struct atm_dev *dev);
void atm_proc_dev_deregister(struct atm_dev *dev);
#endif
#else
static inline int atm_proc_dev_register(struct atm_dev *dev)
{
return 0;
}
static inline void atm_proc_dev_deregister(struct atm_dev *dev)
{
/* nothing */
}
#endif /* CONFIG_PROC_FS */
#endif
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