Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13858d36 authored by Alexander Y. Fomichev's avatar Alexander Y. Fomichev Committed by Linus Torvalds
Browse files

jsm: correctly support multiple 4/8-port boards



If there are more then one 4/8-port board jsm_uart_port_init
allocate a line numbers of the second and further boards
from range of previous one.

This patch fixed the problem.

Signed-off-by: default avatarAlexander Y. Fomichev <git.user@gmail.com>

[printks fixed to add jsm: ]

Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9bb41699
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ enum {
	if ((DBG_##nlevel & jsm_debug))			\
	dev_printk(KERN_##klevel, pdev->dev, fmt, ## args)

#define	MAXLINES	256
#define MAXPORTS	8
#define MAX_STOPS_SENT	5

+12 −2
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@

#include "jsm.h"

static DECLARE_BITMAP(linemap, MAXLINES);

static void jsm_carrier(struct jsm_channel *ch);

static inline int jsm_get_mstat(struct jsm_channel *ch)
@@ -433,6 +435,7 @@ int __devinit jsm_tty_init(struct jsm_board *brd)
int __devinit jsm_uart_port_init(struct jsm_board *brd)
{
	int i;
	unsigned int line;
	struct jsm_channel *ch;

	if (!brd)
@@ -459,9 +462,15 @@ int __devinit jsm_uart_port_init(struct jsm_board *brd)
		brd->channels[i]->uart_port.membase = brd->re_map_membase;
		brd->channels[i]->uart_port.fifosize = 16;
		brd->channels[i]->uart_port.ops = &jsm_ops;
		brd->channels[i]->uart_port.line = brd->channels[i]->ch_portnum + brd->boardnum * 2;
		line = find_first_zero_bit(linemap, MAXLINES);
		if (line >= MAXLINES) {
			printk(KERN_INFO "jsm: linemap is full, added device failed\n");
			continue;
		} else
			set_bit((int)line, linemap);
		brd->channels[i]->uart_port.line = line;
		if (uart_add_one_port (&jsm_uart_driver, &brd->channels[i]->uart_port))
			printk(KERN_INFO "Added device failed\n");
			printk(KERN_INFO "jsm: add device failed\n");
		else
			printk(KERN_INFO "Added device \n");
	}
@@ -494,6 +503,7 @@ int jsm_remove_uart_port(struct jsm_board *brd)

		ch = brd->channels[i];

		clear_bit((int)(ch->uart_port.line), linemap);
		uart_remove_one_port(&jsm_uart_driver, &brd->channels[i]->uart_port);
	}