]> rtime.felk.cvut.cz Git - linux-lin.git/commitdiff
sllin: Added module parameters.
authorRostislav Lisovy <lisovy@gmail.com>
Mon, 19 Dec 2011 14:10:17 +0000 (15:10 +0100)
committerRostislav Lisovy <lisovy@gmail.com>
Mon, 19 Dec 2011 14:10:17 +0000 (15:10 +0100)
sllin/linux/lin_bus.h
sllin/sllin.c

index 429b82ae1cabb06b59da76b6c34f328394d04a33..313b851e246b98070edb3b6c9433e013dbb04269 100644 (file)
@@ -5,6 +5,8 @@
 #define LIN_ID_MAX             LIN_ID_MASK
 #define LIN_CTRL_FRAME                 CAN_EFF_FLAG
 
+#define LIN_DEFAULT_BAUDRATE   19200
+
 #define LIN_CANFR_FLAGS_OFFS   6 /* Lower 6 bits in can_id correspond to LIN ID */
 /* Save configuration for particular LIN ID */
 #define LIN_ID_CONF            (1 <<  LIN_CANFR_FLAGS_OFFS)
index 2e3a1c33bdf73462949755e76aed9ecd12af57cd..459ae9f58eabd8b8ee1706e7aa5d551e9413132d 100644 (file)
@@ -80,6 +80,14 @@ MODULE_AUTHOR("Pavel Pisa <pisa@cmp.felk.cvut.cz>");
 #define SLLIN_MAGIC            0x53CA
 /* #define BREAK_BY_BAUD */
 
+static int master = true;
+static int baudrate = 0; /* Use LIN_DEFAULT_BAUDRATE when not set */
+
+module_param(master, bool, 0);
+MODULE_PARM_DESC(master, "LIN interface is Master device");
+module_param(baudrate, int, 0);
+MODULE_PARM_DESC(baudrate, "Baudrate of LIN interface");
+
 static int maxdev = 10;                /* MAX number of SLLIN channels;
                                   This can be overridden with
                                   insmod sllin.ko maxdev=nnn   */
@@ -1121,11 +1129,12 @@ static int sllin_open(struct tty_struct *tty)
 
        if (!test_bit(SLF_INUSE, &sl->flags)) {
                /* Perform the low-level SLLIN initialization. */
-               sl->lin_master = true;
+               sl->lin_master = master;
 
                sllin_reset_buffs(sl);
 
-               sl->lin_baud  = 19200;
+               sl->lin_baud = (baudrate == 0) ? LIN_DEFAULT_BAUDRATE : baudrate;
+               pr_debug("sllin: Baudrate set to %u\n", sl->lin_baud);
 
                sl->lin_state = SLSTATE_IDLE;