aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda
diff options
context:
space:
mode:
authorRoss Burton <ross@openedhand.com>2008-01-22 21:27:53 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:10:54 -0500
commit91cde6f7d295a9eafea51d821f6e609288736c79 (patch)
tree8465492a91f93aad746437468510aed76e421c53 /net/irda
parentc0e1899bdbd5e997d2256fcc23fc4e3d2bc5f811 (diff)
[IrDA]: LMP discovery timer not started by default
By default, LMP sets up a 3 seconds timer for discovery. We don't need it until discovery is set to 1. Signed-off-by: Ross Burton <ross@openedhand.com> Signed-off-by: Samuel Ortiz <samuel@sortiz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/irda')
-rw-r--r--net/irda/irlmp.c7
-rw-r--r--net/irda/irlmp_event.c4
-rw-r--r--net/irda/irsysctl.c28
3 files changed, 33 insertions, 6 deletions
diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c
index f24cb755908e..135ac6907bbf 100644
--- a/net/irda/irlmp.c
+++ b/net/irda/irlmp.c
@@ -103,9 +103,12 @@ int __init irlmp_init(void)
103 irlmp->last_lsap_sel = 0x0f; /* Reserved 0x00-0x0f */ 103 irlmp->last_lsap_sel = 0x0f; /* Reserved 0x00-0x0f */
104 strcpy(sysctl_devname, "Linux"); 104 strcpy(sysctl_devname, "Linux");
105 105
106 /* Do discovery every 3 seconds */
107 init_timer(&irlmp->discovery_timer); 106 init_timer(&irlmp->discovery_timer);
108 irlmp_start_discovery_timer(irlmp, sysctl_discovery_timeout*HZ); 107
108 /* Do discovery every 3 seconds, conditionaly */
109 if (sysctl_discovery)
110 irlmp_start_discovery_timer(irlmp,
111 sysctl_discovery_timeout*HZ);
109 112
110 return 0; 113 return 0;
111} 114}
diff --git a/net/irda/irlmp_event.c b/net/irda/irlmp_event.c
index 1bba87e78609..150cd3f1129a 100644
--- a/net/irda/irlmp_event.c
+++ b/net/irda/irlmp_event.c
@@ -174,9 +174,7 @@ void irlmp_discovery_timer_expired(void *data)
174 /* We always cleanup the log (active & passive discovery) */ 174 /* We always cleanup the log (active & passive discovery) */
175 irlmp_do_expiry(); 175 irlmp_do_expiry();
176 176
177 /* Active discovery is conditional */ 177 irlmp_do_discovery(sysctl_discovery_slots);
178 if (sysctl_discovery)
179 irlmp_do_discovery(sysctl_discovery_slots);
180 178
181 /* Restart timer */ 179 /* Restart timer */
182 irlmp_start_discovery_timer(irlmp, sysctl_discovery_timeout * HZ); 180 irlmp_start_discovery_timer(irlmp, sysctl_discovery_timeout * HZ);
diff --git a/net/irda/irsysctl.c b/net/irda/irsysctl.c
index d8aba869ff11..9ab3df15425d 100644
--- a/net/irda/irsysctl.c
+++ b/net/irda/irsysctl.c
@@ -29,6 +29,8 @@
29#include <linux/init.h> 29#include <linux/init.h>
30 30
31#include <net/irda/irda.h> /* irda_debug */ 31#include <net/irda/irda.h> /* irda_debug */
32#include <net/irda/irlmp.h>
33#include <net/irda/timer.h>
32#include <net/irda/irias_object.h> 34#include <net/irda/irias_object.h>
33 35
34extern int sysctl_discovery; 36extern int sysctl_discovery;
@@ -45,6 +47,8 @@ extern int sysctl_max_noreply_time;
45extern int sysctl_warn_noreply_time; 47extern int sysctl_warn_noreply_time;
46extern int sysctl_lap_keepalive_time; 48extern int sysctl_lap_keepalive_time;
47 49
50extern struct irlmp_cb *irlmp;
51
48/* this is needed for the proc_dointvec_minmax - Jean II */ 52/* this is needed for the proc_dointvec_minmax - Jean II */
49static int max_discovery_slots = 16; /* ??? */ 53static int max_discovery_slots = 16; /* ??? */
50static int min_discovery_slots = 1; 54static int min_discovery_slots = 1;
@@ -85,6 +89,27 @@ static int do_devname(ctl_table *table, int write, struct file *filp,
85 return ret; 89 return ret;
86} 90}
87 91
92
93static int do_discovery(ctl_table *table, int write, struct file *filp,
94 void __user *buffer, size_t *lenp, loff_t *ppos)
95{
96 int ret;
97
98 ret = proc_dointvec(table, write, filp, buffer, lenp, ppos);
99 if (ret)
100 return ret;
101
102 if (irlmp == NULL)
103 return -ENODEV;
104
105 if (sysctl_discovery)
106 irlmp_start_discovery_timer(irlmp, sysctl_discovery_timeout*HZ);
107 else
108 del_timer_sync(&irlmp->discovery_timer);
109
110 return ret;
111}
112
88/* One file */ 113/* One file */
89static ctl_table irda_table[] = { 114static ctl_table irda_table[] = {
90 { 115 {
@@ -93,7 +118,8 @@ static ctl_table irda_table[] = {
93 .data = &sysctl_discovery, 118 .data = &sysctl_discovery,
94 .maxlen = sizeof(int), 119 .maxlen = sizeof(int),
95 .mode = 0644, 120 .mode = 0644,
96 .proc_handler = &proc_dointvec 121 .proc_handler = &do_discovery,
122 .strategy = &sysctl_intvec
97 }, 123 },
98 { 124 {
99 .ctl_name = NET_IRDA_DEVNAME, 125 .ctl_name = NET_IRDA_DEVNAME,