Commit ab5024ab authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by David S. Miller

net: ppp_generic - use DEFINE_IDR for static initialization

We could use DEFINE_IDR for statically allocated idr
that allow us to save a few lines of code.

And spell fix.
Signed-off-by: default avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a109a5b9
...@@ -179,7 +179,7 @@ struct channel { ...@@ -179,7 +179,7 @@ struct channel {
*/ */
static DEFINE_MUTEX(all_ppp_mutex); static DEFINE_MUTEX(all_ppp_mutex);
static atomic_t ppp_unit_count = ATOMIC_INIT(0); static atomic_t ppp_unit_count = ATOMIC_INIT(0);
static struct idr ppp_units_idr; static DEFINE_IDR(ppp_units_idr);
/* /*
* all_channels_lock protects all_channels and last_channel_index, * all_channels_lock protects all_channels and last_channel_index,
...@@ -852,8 +852,6 @@ static int __init ppp_init(void) ...@@ -852,8 +852,6 @@ static int __init ppp_init(void)
"ppp"); "ppp");
} }
idr_init(&ppp_units_idr);
out: out:
if (err) if (err)
printk(KERN_ERR "failed to register PPP device (%d)\n", err); printk(KERN_ERR "failed to register PPP device (%d)\n", err);
...@@ -2435,7 +2433,7 @@ ppp_create_interface(int unit, int *retp) ...@@ -2435,7 +2433,7 @@ ppp_create_interface(int unit, int *retp)
if (unit_find(&ppp_units_idr, unit)) if (unit_find(&ppp_units_idr, unit))
goto out2; /* unit already exists */ goto out2; /* unit already exists */
else { else {
/* darn, someone is cheatting us? */ /* darn, someone is cheating us? */
*retp = -EINVAL; *retp = -EINVAL;
goto out2; goto out2;
} }
......
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