Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 325644
b: refs/heads/master
c: 38daf88
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Aug 10, 2012
1 parent 7eb93ce commit 06ccb9a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c565ee07708e19474cd1133bf50289a36b5bcc26
refs/heads/master: 38daf88ae16d053cffc8745e05b9f7a324ce36eb
35 changes: 31 additions & 4 deletions trunk/drivers/tty/mxser.c
Original file line number Diff line number Diff line change
Expand Up @@ -2337,11 +2337,36 @@ static struct tty_port_operations mxser_port_ops = {
* The MOXA Smartio/Industio serial driver boot-time initialization code!
*/

static bool allow_overlapping_vector;
module_param(allow_overlapping_vector, bool, 444);
MODULE_PARM_DESC(allow_overlapping_vector, "whether we allow ISA cards to be configured such that vector overlabs IO ports (default=no)");

static bool mxser_overlapping_vector(struct mxser_board *brd)
{
return allow_overlapping_vector &&
brd->vector >= brd->ports[0].ioaddr &&
brd->vector < brd->ports[0].ioaddr + 8 * brd->info->nports;
}

static int mxser_request_vector(struct mxser_board *brd)
{
if (mxser_overlapping_vector(brd))
return 0;
return request_region(brd->vector, 1, "mxser(vector)") ? 0 : -EIO;
}

static void mxser_release_vector(struct mxser_board *brd)
{
if (mxser_overlapping_vector(brd))
return;
release_region(brd->vector, 1);
}

static void mxser_release_ISA_res(struct mxser_board *brd)
{
free_irq(brd->irq, brd);
release_region(brd->ports[0].ioaddr, 8 * brd->info->nports);
release_region(brd->vector, 1);
mxser_release_vector(brd);
}

static int __devinit mxser_initbrd(struct mxser_board *brd,
Expand Down Expand Up @@ -2396,7 +2421,7 @@ static int __devinit mxser_initbrd(struct mxser_board *brd,

static int __init mxser_get_ISA_conf(int cap, struct mxser_board *brd)
{
int id, i, bits;
int id, i, bits, ret;
unsigned short regs[16], irq;
unsigned char scratch, scratch2;

Expand Down Expand Up @@ -2492,13 +2517,15 @@ static int __init mxser_get_ISA_conf(int cap, struct mxser_board *brd)
8 * brd->info->nports - 1);
return -EIO;
}
if (!request_region(brd->vector, 1, "mxser(vector)")) {

ret = mxser_request_vector(brd);
if (ret) {
release_region(brd->ports[0].ioaddr, 8 * brd->info->nports);
printk(KERN_ERR "mxser: can't request interrupt vector region: "
"0x%.8lx-0x%.8lx\n",
brd->ports[0].ioaddr, brd->ports[0].ioaddr +
8 * brd->info->nports - 1);
return -EIO;
return ret;
}
return brd->info->nports;

Expand Down

0 comments on commit 06ccb9a

Please sign in to comment.