wl1251: add reset handling
[pandora-wifi.git] / compat / compat-2.6.31.c
1 /*
2  * Copyright 2007       Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * Compatibility file for Linux wireless for kernels 2.6.31.
9  */
10
11 #include <linux/compat.h>
12
13 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31))
14
15 #include <linux/netdevice.h>
16
17 /**
18  * genl_register_family_with_ops - register a generic netlink family
19  * @family: generic netlink family
20  * @ops: operations to be registered
21  * @n_ops: number of elements to register
22  *
23  * Registers the specified family and operations from the specified table.
24  * Only one family may be registered with the same family name or identifier.
25  *
26  * The family id may equal GENL_ID_GENERATE causing an unique id to
27  * be automatically generated and assigned.
28  *
29  * Either a doit or dumpit callback must be specified for every registered
30  * operation or the function will fail. Only one operation structure per
31  * command identifier may be registered.
32  *
33  * See include/net/genetlink.h for more documenation on the operations
34  * structure.
35  *
36  * This is equivalent to calling genl_register_family() followed by
37  * genl_register_ops() for every operation entry in the table taking
38  * care to unregister the family on error path.
39  *
40  * Return 0 on success or a negative error code.
41  */
42 int genl_register_family_with_ops(struct genl_family *family,
43         struct genl_ops *ops, size_t n_ops)
44 {
45         int err, i;
46
47         err = genl_register_family(family);
48         if (err)
49                 return err;
50
51         for (i = 0; i < n_ops; ++i, ++ops) {
52                 err = genl_register_ops(family, ops);
53                 if (err)
54                         goto err_out;
55         }
56         return 0;
57 err_out:
58         genl_unregister_family(family);
59         return err;
60 }
61 EXPORT_SYMBOL(genl_register_family_with_ops);
62
63 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) */
64