Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
c5bea379
Commit
c5bea379
authored
Jun 11, 2003
by
Alexander Viro
Committed by
Linus Torvalds
Jun 11, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] tty_driver refcounting
drivers/char/pcmcia/synclink_cs.c converted to dynamic allocation
parent
9e5637f7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
41 deletions
+48
-41
drivers/char/pcmcia/synclink_cs.c
drivers/char/pcmcia/synclink_cs.c
+48
-41
No files found.
drivers/char/pcmcia/synclink_cs.c
View file @
c5bea379
...
@@ -495,7 +495,7 @@ MODULE_LICENSE("GPL");
...
@@ -495,7 +495,7 @@ MODULE_LICENSE("GPL");
static
char
*
driver_name
=
"SyncLink PC Card driver"
;
static
char
*
driver_name
=
"SyncLink PC Card driver"
;
static
char
*
driver_version
=
"$Revision: 4.10 $"
;
static
char
*
driver_version
=
"$Revision: 4.10 $"
;
static
struct
tty_driver
serial_driver
;
static
struct
tty_driver
*
serial_driver
;
/* number of characters left in xmit buffer before we ask for more */
/* number of characters left in xmit buffer before we ask for more */
#define WAKEUP_CHARS 256
#define WAKEUP_CHARS 256
...
@@ -3115,6 +3115,30 @@ static struct pcmcia_driver mgslpc_driver = {
...
@@ -3115,6 +3115,30 @@ static struct pcmcia_driver mgslpc_driver = {
.
detach
=
mgslpc_detach
,
.
detach
=
mgslpc_detach
,
};
};
static
struct
tty_operations
mgslpc_ops
=
{
.
open
=
mgslpc_open
,
.
close
=
mgslpc_close
,
.
write
=
mgslpc_write
,
.
put_char
=
mgslpc_put_char
,
.
flush_chars
=
mgslpc_flush_chars
,
.
write_room
=
mgslpc_write_room
,
.
chars_in_buffer
=
mgslpc_chars_in_buffer
,
.
flush_buffer
=
mgslpc_flush_buffer
,
.
ioctl
=
mgslpc_ioctl
,
.
throttle
=
mgslpc_throttle
,
.
unthrottle
=
mgslpc_unthrottle
,
.
send_xchar
=
mgslpc_send_xchar
,
.
break_ctl
=
mgslpc_break
,
.
wait_until_sent
=
mgslpc_wait_until_sent
,
.
read_proc
=
mgslpc_read_proc
,
.
set_termios
=
mgslpc_set_termios
,
.
stop
=
tx_pause
,
.
start
=
tx_release
,
.
hangup
=
mgslpc_hangup
,
.
tiocmget
=
tiocmget
,
.
tiocmset
=
tiocmset
,
};
static
int
__init
synclink_cs_init
(
void
)
static
int
__init
synclink_cs_init
(
void
)
{
{
int
error
;
int
error
;
...
@@ -3126,56 +3150,38 @@ static int __init synclink_cs_init(void)
...
@@ -3126,56 +3150,38 @@ static int __init synclink_cs_init(void)
printk
(
"%s %s
\n
"
,
driver_name
,
driver_version
);
printk
(
"%s %s
\n
"
,
driver_name
,
driver_version
);
serial_driver
=
alloc_tty_driver
(
MAX_DEVICE_COUNT
);
if
(
!
serial_driver
)
return
-
ENOMEM
;
error
=
pcmcia_register_driver
(
&
mgslpc_driver
);
error
=
pcmcia_register_driver
(
&
mgslpc_driver
);
if
(
error
)
if
(
error
)
{
put_tty_driver
(
serial_driver
);
return
error
;
return
error
;
}
/* Initialize the tty_driver structure */
/* Initialize the tty_driver structure */
memset
(
&
serial_driver
,
0
,
sizeof
(
struct
tty_driver
));
serial_driver
->
owner
=
THIS_MODULE
;
serial_driver
.
magic
=
TTY_DRIVER_MAGIC
;
serial_driver
->
driver_name
=
"synclink_cs"
;
serial_driver
.
owner
=
THIS_MODULE
;
serial_driver
->
name
=
"ttySLP"
;
serial_driver
.
driver_name
=
"synclink_cs"
;
serial_driver
->
major
=
ttymajor
;
serial_driver
.
name
=
"ttySLP"
;
serial_driver
->
minor_start
=
64
;
serial_driver
.
major
=
ttymajor
;
serial_driver
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
serial_driver
.
minor_start
=
64
;
serial_driver
->
subtype
=
SERIAL_TYPE_NORMAL
;
serial_driver
.
num
=
MAX_DEVICE_COUNT
;
serial_driver
->
init_termios
=
tty_std_termios
;
serial_driver
.
type
=
TTY_DRIVER_TYPE_SERIAL
;
serial_driver
->
init_termios
.
c_cflag
=
serial_driver
.
subtype
=
SERIAL_TYPE_NORMAL
;
serial_driver
.
init_termios
=
tty_std_termios
;
serial_driver
.
init_termios
.
c_cflag
=
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
serial_driver
.
flags
=
TTY_DRIVER_REAL_RAW
;
serial_driver
->
flags
=
TTY_DRIVER_REAL_RAW
;
tty_set_operations
(
serial_driver
,
&
mgslpc_ops
);
serial_driver
.
open
=
mgslpc_open
;
serial_driver
.
close
=
mgslpc_close
;
if
(
tty_register_driver
(
serial_driver
)
<
0
)
serial_driver
.
write
=
mgslpc_write
;
serial_driver
.
put_char
=
mgslpc_put_char
;
serial_driver
.
flush_chars
=
mgslpc_flush_chars
;
serial_driver
.
write_room
=
mgslpc_write_room
;
serial_driver
.
chars_in_buffer
=
mgslpc_chars_in_buffer
;
serial_driver
.
flush_buffer
=
mgslpc_flush_buffer
;
serial_driver
.
ioctl
=
mgslpc_ioctl
;
serial_driver
.
throttle
=
mgslpc_throttle
;
serial_driver
.
unthrottle
=
mgslpc_unthrottle
;
serial_driver
.
send_xchar
=
mgslpc_send_xchar
;
serial_driver
.
break_ctl
=
mgslpc_break
;
serial_driver
.
wait_until_sent
=
mgslpc_wait_until_sent
;
serial_driver
.
read_proc
=
mgslpc_read_proc
;
serial_driver
.
set_termios
=
mgslpc_set_termios
;
serial_driver
.
stop
=
tx_pause
;
serial_driver
.
start
=
tx_release
;
serial_driver
.
hangup
=
mgslpc_hangup
;
serial_driver
.
tiocmget
=
tiocmget
;
serial_driver
.
tiocmset
=
tiocmset
;
if
(
tty_register_driver
(
&
serial_driver
)
<
0
)
printk
(
"%s(%d):Couldn't register serial driver
\n
"
,
printk
(
"%s(%d):Couldn't register serial driver
\n
"
,
__FILE__
,
__LINE__
);
__FILE__
,
__LINE__
);
printk
(
"%s %s, tty major#%d
\n
"
,
printk
(
"%s %s, tty major#%d
\n
"
,
driver_name
,
driver_version
,
driver_name
,
driver_version
,
serial_driver
.
major
);
serial_driver
->
major
);
return
0
;
return
0
;
}
}
...
@@ -3189,9 +3195,10 @@ static void __exit synclink_cs_exit(void)
...
@@ -3189,9 +3195,10 @@ static void __exit synclink_cs_exit(void)
while
(
mgslpc_device_list
)
while
(
mgslpc_device_list
)
mgslpc_remove_device
(
mgslpc_device_list
);
mgslpc_remove_device
(
mgslpc_device_list
);
if
((
rc
=
tty_unregister_driver
(
&
serial_driver
)))
if
((
rc
=
tty_unregister_driver
(
serial_driver
)))
printk
(
"%s(%d) failed to unregister tty driver err=%d
\n
"
,
printk
(
"%s(%d) failed to unregister tty driver err=%d
\n
"
,
__FILE__
,
__LINE__
,
rc
);
__FILE__
,
__LINE__
,
rc
);
put_tty_driver
(
serial_driver
);
pcmcia_unregister_driver
(
&
mgslpc_driver
);
pcmcia_unregister_driver
(
&
mgslpc_driver
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment