aboutsummaryrefslogtreecommitdiff
path: root/net/irda/irsysctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/irda/irsysctl.c')
-rw-r--r--net/irda/irsysctl.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/net/irda/irsysctl.c b/net/irda/irsysctl.c
index d8aba869ff1..9ab3df15425 100644
--- a/net/irda/irsysctl.c
+++ b/net/irda/irsysctl.c
@@ -29,6 +29,8 @@
#include <linux/init.h>
#include <net/irda/irda.h> /* irda_debug */
+#include <net/irda/irlmp.h>
+#include <net/irda/timer.h>
#include <net/irda/irias_object.h>
extern int sysctl_discovery;
@@ -45,6 +47,8 @@ extern int sysctl_max_noreply_time;
extern int sysctl_warn_noreply_time;
extern int sysctl_lap_keepalive_time;
+extern struct irlmp_cb *irlmp;
+
/* this is needed for the proc_dointvec_minmax - Jean II */
static int max_discovery_slots = 16; /* ??? */
static int min_discovery_slots = 1;
@@ -85,6 +89,27 @@ static int do_devname(ctl_table *table, int write, struct file *filp,
return ret;
}
+
+static int do_discovery(ctl_table *table, int write, struct file *filp,
+ void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+ int ret;
+
+ ret = proc_dointvec(table, write, filp, buffer, lenp, ppos);
+ if (ret)
+ return ret;
+
+ if (irlmp == NULL)
+ return -ENODEV;
+
+ if (sysctl_discovery)
+ irlmp_start_discovery_timer(irlmp, sysctl_discovery_timeout*HZ);
+ else
+ del_timer_sync(&irlmp->discovery_timer);
+
+ return ret;
+}
+
/* One file */
static ctl_table irda_table[] = {
{
@@ -93,7 +118,8 @@ static ctl_table irda_table[] = {
.data = &sysctl_discovery,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = &proc_dointvec
+ .proc_handler = &do_discovery,
+ .strategy = &sysctl_intvec
},
{
.ctl_name = NET_IRDA_DEVNAME,