From d0129b0be24b9d6cfedb1b08cae086876381e46f Mon Sep 17 00:00:00 2001 From: Rostislav Lisovy Date: Mon, 19 Dec 2011 15:10:17 +0100 Subject: [PATCH] sllin: Added module parameters. --- sllin/linux/lin_bus.h | 2 ++ sllin/sllin.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sllin/linux/lin_bus.h b/sllin/linux/lin_bus.h index 429b82a..313b851 100644 --- a/sllin/linux/lin_bus.h +++ b/sllin/linux/lin_bus.h @@ -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) diff --git a/sllin/sllin.c b/sllin/sllin.c index 2e3a1c3..459ae9f 100644 --- a/sllin/sllin.c +++ b/sllin/sllin.c @@ -80,6 +80,14 @@ MODULE_AUTHOR("Pavel Pisa "); #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; -- 2.39.2