diff options
author | Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 2005-07-27 13:10:11 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-09-08 14:41:25 -0700 |
commit | 2d8331792ea3f5ccfd147288afba148537337019 (patch) | |
tree | 7d144ae862363a5fd6bfa031cca04a42cc79d879 /drivers/w1/w1_netlink.c | |
parent | 1b11d78cf87a7014f96e5b7fa2e1233cc8081a00 (diff) |
[PATCH] W1: w1_netlink: New init/fini netlink callbacks.
They are guarded with NETLINK_DISABLE compile time options,
so if CONFIG_NET is disabled, no linking errors occur.
Bug noticed by Adrian Bunk <bunk@stusta.de>.
Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/w1/w1_netlink.c')
-rw-r--r-- | drivers/w1/w1_netlink.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/w1/w1_netlink.c b/drivers/w1/w1_netlink.c index e7b774423dd6..328645da7972 100644 --- a/drivers/w1/w1_netlink.c +++ b/drivers/w1/w1_netlink.c @@ -57,10 +57,36 @@ void w1_netlink_send(struct w1_master *dev, struct w1_netlink_msg *msg) nlmsg_failure: return; } + +int dev_init_netlink(struct w1_master *dev) +{ + dev->nls = netlink_kernel_create(NETLINK_W1, 1, NULL, THIS_MODULE); + if (!dev->nls) { + printk(KERN_ERR "Failed to create new netlink socket(%u) for w1 master %s.\n", + NETLINK_W1, dev->dev.bus_id); + } + + return 0; +} + +void dev_fini_netlink(struct w1_master *dev) +{ + if (dev->nls && dev->nls->sk_socket) + sock_release(dev->nls->sk_socket); +} #else #warning Netlink support is disabled. Please compile with NET support enabled. void w1_netlink_send(struct w1_master *dev, struct w1_netlink_msg *msg) { } + +int dev_init_netlink(struct w1_master *dev) +{ + return 0; +} + +void dev_fini_netlink(struct w1_master *dev) +{ +} #endif |