提交 18e48d7c 编写于 作者: C chenjing

fix:rewrite to make code clearer

Close #I3S5W4

Change-Id: Iba7054a8abbcc5545c783a06411312c7a1c6075e
上级 08660a71
...@@ -1351,7 +1351,8 @@ tty_usb_write_wait(void) ...@@ -1351,7 +1351,8 @@ tty_usb_write_wait(void)
static int static int
tty_usb_open(struct file *filep) tty_usb_open(struct file *filep)
{ {
struct ucom_softc *sc = (struct ucom_softc *)((struct drv_data*)filep->f_vnode->data)->priv; struct drv_data *drvData = (struct drv_data *)filep->f_vnode->data;
struct ucom_softc *sc = (struct ucom_softc *)drvData->priv;
int ret; int ret;
UCOM_MTX_LOCK(sc); UCOM_MTX_LOCK(sc);
...@@ -1369,7 +1370,8 @@ tty_usb_open(struct file *filep) ...@@ -1369,7 +1370,8 @@ tty_usb_open(struct file *filep)
static int static int
tty_usb_close(struct file *filep) tty_usb_close(struct file *filep)
{ {
struct ucom_softc *sc = (struct ucom_softc *)((struct drv_data*)filep->f_vnode->data)->priv; struct drv_data *drvData = (struct drv_data *)filep->f_vnode->data;
struct ucom_softc *sc = (struct ucom_softc *)drvData->priv;
UCOM_MTX_LOCK(sc); UCOM_MTX_LOCK(sc);
tty_usb_queue_delete(); tty_usb_queue_delete();
...@@ -1382,7 +1384,8 @@ tty_usb_close(struct file *filep) ...@@ -1382,7 +1384,8 @@ tty_usb_close(struct file *filep)
static ssize_t static ssize_t
tty_usb_read(struct file *filep, char *buffer, size_t buflen) tty_usb_read(struct file *filep, char *buffer, size_t buflen)
{ {
struct ucom_softc *sc = (struct ucom_softc *)((struct drv_data*)filep->f_vnode->data)->priv; struct drv_data *drvData = (struct drv_data *)filep->f_vnode->data;
struct ucom_softc *sc = (struct ucom_softc *)drvData->priv;
int read_len = -1; int read_len = -1;
int ret; int ret;
UCOM_MTX_LOCK(sc); UCOM_MTX_LOCK(sc);
...@@ -1440,7 +1443,8 @@ tty_usb_read(struct file *filep, char *buffer, size_t buflen) ...@@ -1440,7 +1443,8 @@ tty_usb_read(struct file *filep, char *buffer, size_t buflen)
static ssize_t static ssize_t
tty_usb_write(struct file *filep, const char *buffer, size_t buflen) tty_usb_write(struct file *filep, const char *buffer, size_t buflen)
{ {
struct ucom_softc *sc = (struct ucom_softc *)((struct drv_data*)filep->f_vnode->data)->priv; struct drv_data *drvData = (struct drv_data *)filep->f_vnode->data;
struct ucom_softc *sc = (struct ucom_softc *)drvData->priv;
tx_data_copy_in(sc, (void *)buffer, buflen); tx_data_copy_in(sc, (void *)buffer, buflen);
ucom_outwakeup(sc); ucom_outwakeup(sc);
......
...@@ -781,7 +781,8 @@ usb_fifo_close(struct usb_fifo *f, int fflags) ...@@ -781,7 +781,8 @@ usb_fifo_close(struct usb_fifo *f, int fflags)
static int static int
usb_open(struct file *filep) usb_open(struct file *filep)
{ {
struct usb_fs_privdata* pd = (struct usb_fs_privdata*)((struct drv_data*)filep->f_vnode->data)->priv; struct drv_data* drvData = (struct drv_data* )filep->f_vnode->data;
struct usb_fs_privdata* pd = (struct usb_fs_privdata* )drvData->priv;
struct usb_cdev_refdata refs; struct usb_cdev_refdata refs;
struct usb_cdev_privdata *cpd = NULL; struct usb_cdev_privdata *cpd = NULL;
int err; int err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册