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
Kirill Smelkov
linux
Commits
7013dfc3
Commit
7013dfc3
authored
Dec 26, 2002
by
Greg Kroah-Hartman
Committed by
Vojtech Pavlik
Dec 26, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB: use usb_get_serial_data() and usb_set_serial_data() functions.
parent
1433db3d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
48 deletions
+45
-48
drivers/usb/serial/digi_acceleport.c
drivers/usb/serial/digi_acceleport.c
+12
-13
drivers/usb/serial/io_edgeport.c
drivers/usb/serial/io_edgeport.c
+9
-9
drivers/usb/serial/io_ti.c
drivers/usb/serial/io_ti.c
+4
-4
drivers/usb/serial/keyspan.c
drivers/usb/serial/keyspan.c
+15
-16
drivers/usb/serial/visor.c
drivers/usb/serial/visor.c
+5
-6
No files found.
drivers/usb/serial/digi_acceleport.c
View file @
7013dfc3
...
...
@@ -650,7 +650,7 @@ static int digi_write_oob_command( struct usb_serial_port *port,
int
ret
=
0
;
int
len
;
struct
usb_serial_port
*
oob_port
=
(
struct
usb_serial_port
*
)((
struct
digi_serial
*
)
port
->
serial
->
private
)
->
ds_oob_port
;
struct
usb_serial_port
*
oob_port
=
(
struct
usb_serial_port
*
)((
struct
digi_serial
*
)
(
usb_get_serial_data
(
port
->
serial
))
)
->
ds_oob_port
;
struct
digi_port
*
oob_priv
=
usb_get_serial_port_data
(
oob_port
);
unsigned
long
flags
=
0
;
...
...
@@ -806,7 +806,7 @@ static int digi_set_modem_signals( struct usb_serial_port *port,
int
ret
;
struct
digi_port
*
port_priv
=
usb_get_serial_port_data
(
port
);
struct
usb_serial_port
*
oob_port
=
(
struct
usb_serial_port
*
)((
struct
digi_serial
*
)
port
->
serial
->
private
)
->
ds_oob_port
;
struct
usb_serial_port
*
oob_port
=
(
struct
usb_serial_port
*
)((
struct
digi_serial
*
)
(
usb_get_serial_data
(
port
->
serial
))
)
->
ds_oob_port
;
struct
digi_port
*
oob_priv
=
usb_get_serial_port_data
(
oob_port
);
unsigned
char
*
data
=
oob_port
->
write_urb
->
transfer_buffer
;
unsigned
long
flags
=
0
;
...
...
@@ -1353,6 +1353,7 @@ static void digi_write_bulk_callback( struct urb *urb, struct pt_regs *regs )
struct
usb_serial_port
*
port
=
(
struct
usb_serial_port
*
)
urb
->
context
;
struct
usb_serial
*
serial
;
struct
digi_port
*
priv
;
struct
digi_serial
*
serial_priv
;
int
ret
=
0
;
...
...
@@ -1365,14 +1366,13 @@ dbg( "digi_write_bulk_callback: TOP, urb->status=%d", urb->status );
return
;
}
serial
=
port
->
serial
;
if
(
serial
==
NULL
||
serial
->
private
==
NULL
)
{
if
(
serial
==
NULL
||
(
serial_priv
=
usb_get_serial_data
(
serial
))
==
NULL
)
{
err
(
"%s: serial or serial->private is NULL, status=%d"
,
__FUNCTION__
,
urb
->
status
);
return
;
}
/* handle oob callback */
if
(
priv
->
dp_port_num
==
((
struct
digi_serial
*
)(
serial
->
private
))
->
ds_oob_port_num
)
{
if
(
priv
->
dp_port_num
==
serial_priv
->
ds_oob_port_num
)
{
dbg
(
"digi_write_bulk_callback: oob callback"
);
spin_lock
(
&
priv
->
dp_port_lock
);
priv
->
dp_write_urb_in_use
=
0
;
...
...
@@ -1641,7 +1641,7 @@ static int digi_startup_device( struct usb_serial *serial )
{
int
i
,
ret
=
0
;
struct
digi_serial
*
serial_priv
=
(
struct
digi_serial
*
)
serial
->
private
;
struct
digi_serial
*
serial_priv
=
usb_get_serial_data
(
serial
)
;
struct
usb_serial_port
*
port
;
...
...
@@ -1723,8 +1723,7 @@ dbg( "digi_startup: TOP" );
}
/* allocate serial private structure */
serial_priv
=
serial
->
private
=
(
struct
digi_serial
*
)
kmalloc
(
sizeof
(
struct
digi_serial
),
serial_priv
=
(
struct
digi_serial
*
)
kmalloc
(
sizeof
(
struct
digi_serial
),
GFP_KERNEL
);
if
(
serial_priv
==
(
struct
digi_serial
*
)
0
)
{
for
(
i
=
0
;
i
<
serial
->
type
->
num_ports
+
1
;
i
++
)
...
...
@@ -1737,6 +1736,7 @@ dbg( "digi_startup: TOP" );
serial_priv
->
ds_oob_port_num
=
serial
->
type
->
num_ports
;
serial_priv
->
ds_oob_port
=
&
serial
->
port
[
serial_priv
->
ds_oob_port_num
];
serial_priv
->
ds_device_started
=
0
;
usb_set_serial_data
(
serial
,
serial_priv
);
return
(
0
);
...
...
@@ -1761,8 +1761,7 @@ dbg( "digi_shutdown: TOP, in_interrupt()=%ld", in_interrupt() );
/* number of regular ports + 1 for the out-of-band port */
for
(
i
=
0
;
i
<
serial
->
type
->
num_ports
+
1
;
i
++
)
kfree
(
usb_get_serial_port_data
(
&
serial
->
port
[
i
])
);
kfree
(
serial
->
private
);
kfree
(
usb_get_serial_data
(
serial
)
);
}
...
...
@@ -1771,6 +1770,7 @@ static void digi_read_bulk_callback( struct urb *urb, struct pt_regs *regs )
struct
usb_serial_port
*
port
=
(
struct
usb_serial_port
*
)
urb
->
context
;
struct
digi_port
*
priv
;
struct
digi_serial
*
serial_priv
;
int
ret
;
...
...
@@ -1784,7 +1784,7 @@ dbg( "digi_read_bulk_callback: TOP" );
}
if
(
port
->
serial
==
NULL
||
serial_paranoia_check
(
port
->
serial
,
__FUNCTION__
)
||
port
->
serial
->
private
==
NULL
)
{
||
(
serial_priv
=
usb_get_serial_data
(
port
->
serial
))
==
NULL
)
{
err
(
"%s: serial is bad or serial->private is NULL, status=%d"
,
__FUNCTION__
,
urb
->
status
);
return
;
}
...
...
@@ -1796,8 +1796,7 @@ dbg( "digi_read_bulk_callback: TOP" );
}
/* handle oob or inb callback, do not resubmit if error */
if
(
priv
->
dp_port_num
==
((
struct
digi_serial
*
)(
port
->
serial
->
private
))
->
ds_oob_port_num
)
{
if
(
priv
->
dp_port_num
==
serial_priv
->
ds_oob_port_num
)
{
if
(
digi_read_oob_callback
(
urb
)
!=
0
)
return
;
}
else
{
...
...
drivers/usb/serial/io_edgeport.c
View file @
7013dfc3
...
...
@@ -932,7 +932,7 @@ static void edge_bulk_out_data_callback (struct urb *urb, struct pt_regs *regs)
edge_port
->
write_in_progress
=
FALSE
;
// Check if more data needs to be sent
send_more_port_data
((
struct
edgeport_serial
*
)(
edge_port
->
port
->
serial
->
private
),
edge_port
);
send_more_port_data
((
struct
edgeport_serial
*
)(
usb_get_serial_data
(
edge_port
->
port
->
serial
)
),
edge_port
);
}
...
...
@@ -1019,7 +1019,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
/* see if we've set up our endpoint info yet (can't set it up in edge_startup
as the structures were not set up at that time.) */
serial
=
port
->
serial
;
edge_serial
=
(
struct
edgeport_serial
*
)
serial
->
private
;
edge_serial
=
usb_get_serial_data
(
serial
)
;
if
(
edge_serial
==
NULL
)
{
return
-
ENODEV
;
}
...
...
@@ -1247,7 +1247,7 @@ static void edge_close (struct usb_serial_port *port, struct file * filp)
if
(
!
serial
)
return
;
edge_serial
=
(
struct
edgeport_serial
*
)
serial
->
private
;
edge_serial
=
usb_get_serial_data
(
serial
)
;
edge_port
=
usb_get_serial_port_data
(
port
);
if
((
edge_serial
==
NULL
)
||
(
edge_port
==
NULL
))
return
;
...
...
@@ -1381,7 +1381,7 @@ static int edge_write (struct usb_serial_port *port, int from_user, const unsign
usb_serial_debug_data
(
__FILE__
,
__FUNCTION__
,
copySize
,
data
);
}
send_more_port_data
((
struct
edgeport_serial
*
)
port
->
serial
->
private
,
edge_port
);
send_more_port_data
((
struct
edgeport_serial
*
)
usb_get_serial_data
(
port
->
serial
)
,
edge_port
);
dbg
(
"%s wrote %d byte(s) TxCredits %d, Fifo %d"
,
__FUNCTION__
,
copySize
,
edge_port
->
txCredits
,
fifo
->
count
);
...
...
@@ -2489,7 +2489,7 @@ static int send_iosp_ext_cmd (struct edgeport_port *edge_port, __u8 command, __u
*****************************************************************************/
static
int
write_cmd_usb
(
struct
edgeport_port
*
edge_port
,
unsigned
char
*
buffer
,
int
length
)
{
struct
edgeport_serial
*
edge_serial
=
(
struct
edgeport_serial
*
)
edge_port
->
port
->
serial
->
private
;
struct
edgeport_serial
*
edge_serial
=
usb_get_serial_data
(
edge_port
->
port
->
serial
)
;
int
status
=
0
;
struct
urb
*
urb
;
int
timeout
;
...
...
@@ -2979,7 +2979,7 @@ static int edge_startup (struct usb_serial *serial)
}
memset
(
edge_serial
,
0
,
sizeof
(
struct
edgeport_serial
));
edge_serial
->
serial
=
serial
;
serial
->
private
=
edge_serial
;
usb_set_serial_data
(
serial
,
edge_serial
)
;
/* get the name for the device from the device */
if
(
(
i
=
get_string
(
dev
,
dev
->
descriptor
.
iManufacturer
,
&
edge_serial
->
name
[
0
]))
!=
0
)
{
...
...
@@ -3031,7 +3031,7 @@ static int edge_startup (struct usb_serial *serial)
edge_port
=
kmalloc
(
sizeof
(
struct
edgeport_port
),
GFP_KERNEL
);
if
(
edge_port
==
NULL
)
{
dev_err
(
serial
->
dev
->
dev
,
"%s - Out of memory"
,
__FUNCTION__
);
serial
->
private
=
NULL
;
usb_set_serial_data
(
serial
,
NULL
)
;
kfree
(
edge_serial
);
return
-
ENOMEM
;
}
...
...
@@ -3060,8 +3060,8 @@ static void edge_shutdown (struct usb_serial *serial)
kfree
(
usb_get_serial_port_data
(
&
serial
->
port
[
i
]));
usb_set_serial_port_data
(
&
serial
->
port
[
i
],
NULL
);
}
kfree
(
serial
->
private
);
serial
->
private
=
NULL
;
kfree
(
usb_get_serial_data
(
serial
)
);
usb_set_serial_data
(
serial
,
NULL
)
;
}
...
...
drivers/usb/serial/io_ti.c
View file @
7013dfc3
...
...
@@ -1990,7 +1990,7 @@ static void edge_close (struct usb_serial_port *port, struct file * filp)
if
(
!
serial
)
return
;
edge_serial
=
(
struct
edgeport_serial
*
)
serial
->
private
;
edge_serial
=
usb_get_serial_data
(
serial
)
;
edge_port
=
usb_get_serial_port_data
(
port
);
if
((
edge_serial
==
NULL
)
||
(
edge_port
==
NULL
))
return
;
...
...
@@ -2595,7 +2595,7 @@ static int edge_startup (struct usb_serial *serial)
}
memset
(
edge_serial
,
0
,
sizeof
(
struct
edgeport_serial
));
edge_serial
->
serial
=
serial
;
serial
->
private
=
edge_serial
;
usb_set_serial_data
(
serial
,
edge_serial
)
;
status
=
TIDownloadFirmware
(
edge_serial
);
if
(
status
)
{
...
...
@@ -2629,8 +2629,8 @@ static void edge_shutdown (struct usb_serial *serial)
kfree
(
usb_get_serial_port_data
(
&
serial
->
port
[
i
]));
usb_set_serial_port_data
(
&
serial
->
port
[
i
],
NULL
);
}
kfree
(
serial
->
private
);
serial
->
private
=
NULL
;
kfree
(
usb_get_serial_data
(
serial
)
);
usb_set_serial_data
(
serial
,
NULL
)
;
}
...
...
drivers/usb/serial/keyspan.c
View file @
7013dfc3
...
...
@@ -867,7 +867,7 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp)
int
i
,
err
;
struct
urb
*
urb
;
s_priv
=
(
struct
keyspan_serial_private
*
)(
serial
->
private
);
s_priv
=
usb_get_serial_data
(
serial
);
p_priv
=
usb_get_serial_port_data
(
port
);
d_details
=
s_priv
->
device_details
;
...
...
@@ -927,7 +927,7 @@ static void keyspan_close(struct usb_serial_port *port, struct file *filp)
return
;
dbg
(
"%s"
,
__FUNCTION__
);
s_priv
=
(
struct
keyspan_serial_private
*
)(
serial
->
private
);
s_priv
=
usb_get_serial_data
(
serial
);
p_priv
=
usb_get_serial_port_data
(
port
);
p_priv
->
rts_state
=
0
;
...
...
@@ -1139,7 +1139,7 @@ static void keyspan_setup_urbs(struct usb_serial *serial)
dbg
(
"%s"
,
__FUNCTION__
);
s_priv
=
(
struct
keyspan_serial_private
*
)(
serial
->
private
);
s_priv
=
usb_get_serial_data
(
serial
);
d_details
=
s_priv
->
device_details
;
/* Setup values for the various callback routines */
...
...
@@ -1375,7 +1375,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
dbg
(
"%s reset=%d"
,
__FUNCTION__
,
reset_port
);
s_priv
=
(
struct
keyspan_serial_private
*
)(
serial
->
private
);
s_priv
=
usb_get_serial_data
(
serial
);
p_priv
=
usb_get_serial_port_data
(
port
);
d_details
=
s_priv
->
device_details
;
device_port
=
port
->
number
-
port
->
serial
->
minor
;
...
...
@@ -1530,7 +1530,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial,
dbg
(
"%s"
,
__FUNCTION__
);
s_priv
=
(
struct
keyspan_serial_private
*
)(
serial
->
private
);
s_priv
=
usb_get_serial_data
(
serial
);
p_priv
=
usb_get_serial_port_data
(
port
);
d_details
=
s_priv
->
device_details
;
device_port
=
port
->
number
-
port
->
serial
->
minor
;
...
...
@@ -1655,7 +1655,7 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial,
dbg
(
"%s"
,
__FUNCTION__
);
s_priv
=
(
struct
keyspan_serial_private
*
)(
serial
->
private
);
s_priv
=
usb_get_serial_data
(
serial
);
p_priv
=
usb_get_serial_port_data
(
port
);
d_details
=
s_priv
->
device_details
;
...
...
@@ -1815,7 +1815,7 @@ static void keyspan_send_setup(struct usb_serial_port *port, int reset_port)
dbg
(
"%s"
,
__FUNCTION__
);
s_priv
=
(
struct
keyspan_serial_private
*
)(
serial
->
private
);
s_priv
=
usb_get_serial_data
(
serial
);
d_details
=
s_priv
->
device_details
;
switch
(
d_details
->
msg_format
)
{
...
...
@@ -1852,16 +1852,15 @@ static int keyspan_startup (struct usb_serial *serial)
}
/* Setup private data for serial driver */
serial
->
private
=
kmalloc
(
sizeof
(
struct
keyspan_serial_private
),
GFP_KERNEL
);
if
(
!
serial
->
private
)
{
s_priv
=
kmalloc
(
sizeof
(
struct
keyspan_serial_private
),
GFP_KERNEL
);
if
(
!
s_priv
)
{
dbg
(
"%s - kmalloc for keyspan_serial_private failed."
,
__FUNCTION__
);
return
(
1
)
;
return
-
ENOMEM
;
}
memset
(
s
erial
->
private
,
0
,
sizeof
(
struct
keyspan_serial_private
));
memset
(
s
_priv
,
0
,
sizeof
(
struct
keyspan_serial_private
));
s_priv
=
(
struct
keyspan_serial_private
*
)(
serial
->
private
);
s_priv
->
device_details
=
d_details
;
usb_set_serial_data
(
serial
,
s_priv
);
/* Now setup per port private data */
for
(
i
=
0
;
i
<
serial
->
num_ports
;
i
++
)
{
...
...
@@ -1895,7 +1894,7 @@ static void keyspan_shutdown (struct usb_serial *serial)
dbg
(
"%s"
,
__FUNCTION__
);
s_priv
=
(
struct
keyspan_serial_private
*
)(
serial
->
private
);
s_priv
=
usb_get_serial_data
(
serial
);
/* Stop reading/writing urbs */
stop_urb
(
s_priv
->
instat_urb
);
...
...
@@ -1932,7 +1931,7 @@ static void keyspan_shutdown (struct usb_serial *serial)
}
/* dbg("Freeing serial->private."); */
kfree
(
s
erial
->
private
);
kfree
(
s
_priv
);
/* dbg("Freeing port->private."); */
/* Now free per port private data */
...
...
drivers/usb/serial/visor.c
View file @
7013dfc3
...
...
@@ -654,7 +654,7 @@ static int visor_probe (struct usb_serial *serial)
dev_info
(
*
dev
,
"%s: port %d, is for %s use
\n
"
,
serial
->
type
->
name
,
connection_info
->
connections
[
i
].
port
,
string
);
/* save off our num_ports info so that we can use it in the calc_num_ports call */
serial
->
private
=
(
void
*
)(
long
)
num_ports
;
usb_set_serial_data
(
serial
,
(
void
*
)(
long
)
num_ports
)
;
}
}
...
...
@@ -697,12 +697,11 @@ static int visor_probe (struct usb_serial *serial)
static
int
visor_calc_num_ports
(
struct
usb_serial
*
serial
)
{
int
num_ports
=
0
;
int
num_ports
=
(
int
)(
long
)(
usb_get_serial_data
(
serial
));
if
(
num_ports
)
usb_set_serial_data
(
serial
,
NULL
);
if
(
serial
->
private
)
{
num_ports
=
(
int
)(
long
)
serial
->
private
;
serial
->
private
=
NULL
;
}
return
num_ports
;
}
...
...
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