@@ -60,15 +60,15 @@ static int ptm_fops_close(struct dfs_file *file)
6060 lwp_tty_t tp ;
6161 rt_device_t device ;
6262
63- if (file -> vnode && file -> vnode -> data )
63+ if (file -> data )
6464 {
6565 if (file -> vnode -> ref_count != 1 )
6666 {
6767 rc = 0 ;
6868 }
6969 else
7070 {
71- device = (rt_device_t )file -> vnode -> data ;
71+ device = (rt_device_t )file -> data ;
7272 tp = rt_container_of (device , struct lwp_tty , parent );
7373 rc = bsd_ptsdev_methods .fo_close (tp , rt_thread_self ());
7474 }
@@ -92,9 +92,9 @@ static ssize_t ptm_fops_read(struct dfs_file *file, void *buf, size_t count,
9292 struct lwp_tty * tp ;
9393 int oflags = file -> flags ;
9494
95- if (file -> vnode && file -> vnode -> data )
95+ if (file -> data )
9696 {
97- device = (rt_device_t )file -> vnode -> data ;
97+ device = (rt_device_t )file -> data ;
9898 tp = rt_container_of (device , struct lwp_tty , parent );
9999
100100 /* setup uio parameters */
@@ -133,9 +133,9 @@ static ssize_t ptm_fops_write(struct dfs_file *file, const void *buf,
133133 struct lwp_tty * tp ;
134134 int oflags = file -> flags ;
135135
136- if (file -> vnode && file -> vnode -> data )
136+ if (file -> data )
137137 {
138- device = (rt_device_t )file -> vnode -> data ;
138+ device = (rt_device_t )file -> data ;
139139 tp = rt_container_of (device , struct lwp_tty , parent );
140140
141141 /* setup uio parameters */
@@ -172,9 +172,9 @@ static int ptm_fops_ioctl(struct dfs_file *file, int cmd, void *arg)
172172 rt_device_t device ;
173173 rt_ubase_t cmd_normal = (unsigned int )cmd ;
174174
175- if (file -> vnode && file -> vnode -> data )
175+ if (file -> data )
176176 {
177- device = (rt_device_t )file -> vnode -> data ;
177+ device = (rt_device_t )file -> data ;
178178 tp = rt_container_of (device , struct lwp_tty , parent );
179179
180180 switch (cmd_normal )
@@ -239,9 +239,9 @@ static int ptm_fops_poll(struct dfs_file *file, struct rt_pollreq *req)
239239 rt_device_t device ;
240240 struct lwp_tty * tp ;
241241
242- if (file -> vnode && file -> vnode -> data )
242+ if (file -> data )
243243 {
244- device = (rt_device_t )file -> vnode -> data ;
244+ device = (rt_device_t )file -> data ;
245245 tp = rt_container_of (device , struct lwp_tty , parent );
246246
247247 rc = bsd_ptsdev_methods .fo_poll (tp , req , 0 , rt_thread_self ());
0 commit comments