lkml.org 
[lkml]   [1999]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectSimple driver question.
My ISA I/O board (tsio) driver seems to work well, but there is one
possible problem I foresee. For a quick functional description, the
board is based on 4 8255 chips 4 * (3 usable i/o ports + 1 control
byte). Each is assigned it's own node, so I have /dev/tsio0-15 with
minor number representing the offset of each port from io_base. Here
is tsio_write():

ssize_t tsio_write (struct file *filp,
const char *buf,
size_t count,
loff_t *loff)
{
unsigned char c = buf [0];
int offset = MINOR(filp->f_dentry->d_inode->i_rdev);

get_user (c, buf);
outb (c, io_base + offset);

#ifdef DEBUG
printk ("getting user byte %-#12x\n", c);
printk ("tsio write %-#12x\n", c);
printk ("offset = %d\n", offset);
#endif

return 1;
}

The problem is that if two processes try to write to different devices
simultaneously, offset could be set by process 1, then reset by
process 2 before process 1 completes the outb. Does the kernel handle
this case or should the driver? What mechanism would the driver use
to handle it.

D->|

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.030 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site