Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=91cde6f7d295a9eafea51d821f6e609288736c79
Commit:     91cde6f7d295a9eafea51d821f6e609288736c79
Parent:     c0e1899bdbd5e997d2256fcc23fc4e3d2bc5f811
Author:     Ross Burton <[EMAIL PROTECTED]>
AuthorDate: Tue Jan 22 18:27:53 2008 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Mon Jan 28 15:10:54 2008 -0800

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: Samuel Ortiz <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/irda/irlmp.c       |    7 +++++--
 net/irda/irlmp_event.c |    4 +---
 net/irda/irsysctl.c    |   28 +++++++++++++++++++++++++++-
 3 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c
index f24cb75..135ac69 100644
--- a/net/irda/irlmp.c
+++ b/net/irda/irlmp.c
@@ -103,9 +103,12 @@ int __init irlmp_init(void)
        irlmp->last_lsap_sel = 0x0f; /* Reserved 0x00-0x0f */
        strcpy(sysctl_devname, "Linux");
 
-       /* Do discovery every 3 seconds */
        init_timer(&irlmp->discovery_timer);
-       irlmp_start_discovery_timer(irlmp, sysctl_discovery_timeout*HZ);
+
+       /* Do discovery every 3 seconds, conditionaly */
+       if (sysctl_discovery)
+               irlmp_start_discovery_timer(irlmp,
+                                           sysctl_discovery_timeout*HZ);
 
        return 0;
 }
diff --git a/net/irda/irlmp_event.c b/net/irda/irlmp_event.c
index 1bba87e..150cd3f 100644
--- a/net/irda/irlmp_event.c
+++ b/net/irda/irlmp_event.c
@@ -174,9 +174,7 @@ void irlmp_discovery_timer_expired(void *data)
        /* We always cleanup the log (active & passive discovery) */
        irlmp_do_expiry();
 
-       /* Active discovery is conditional */
-       if (sysctl_discovery)
-               irlmp_do_discovery(sysctl_discovery_slots);
+       irlmp_do_discovery(sysctl_discovery_slots);
 
        /* Restart timer */
        irlmp_start_discovery_timer(irlmp, sysctl_discovery_timeout * HZ);
diff --git a/net/irda/irsysctl.c b/net/irda/irsysctl.c
index d8aba86..9ab3df1 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,
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to