hv_netvsc: remove open_cnt reference count
There is only ever a single instance of network device object referencing the internal rndis object. Therefore the open_cnt atomic is not necessary. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Родитель
345ac08990
Коммит
0da6edbd3a
|
@ -823,8 +823,6 @@ struct netvsc_device {
|
||||||
u32 max_pkt; /* max number of pkt in one send, e.g. 8 */
|
u32 max_pkt; /* max number of pkt in one send, e.g. 8 */
|
||||||
u32 pkt_align; /* alignment bytes, e.g. 8 */
|
u32 pkt_align; /* alignment bytes, e.g. 8 */
|
||||||
|
|
||||||
atomic_t open_cnt;
|
|
||||||
|
|
||||||
struct netvsc_channel chan_table[VRSS_CHANNEL_MAX];
|
struct netvsc_channel chan_table[VRSS_CHANNEL_MAX];
|
||||||
|
|
||||||
struct rcu_head rcu;
|
struct rcu_head rcu;
|
||||||
|
|
|
@ -73,7 +73,7 @@ static struct netvsc_device *alloc_net_device(void)
|
||||||
|
|
||||||
init_waitqueue_head(&net_device->wait_drain);
|
init_waitqueue_head(&net_device->wait_drain);
|
||||||
net_device->destroy = false;
|
net_device->destroy = false;
|
||||||
atomic_set(&net_device->open_cnt, 0);
|
|
||||||
net_device->max_pkt = RNDIS_MAX_PKT_DEFAULT;
|
net_device->max_pkt = RNDIS_MAX_PKT_DEFAULT;
|
||||||
net_device->pkt_align = RNDIS_PKT_ALIGN_DEFAULT;
|
net_device->pkt_align = RNDIS_PKT_ALIGN_DEFAULT;
|
||||||
|
|
||||||
|
|
|
@ -1362,9 +1362,6 @@ int rndis_filter_open(struct netvsc_device *nvdev)
|
||||||
if (!nvdev)
|
if (!nvdev)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (atomic_inc_return(&nvdev->open_cnt) != 1)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return rndis_filter_open_device(nvdev->extension);
|
return rndis_filter_open_device(nvdev->extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1373,13 +1370,12 @@ int rndis_filter_close(struct netvsc_device *nvdev)
|
||||||
if (!nvdev)
|
if (!nvdev)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (atomic_dec_return(&nvdev->open_cnt) != 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return rndis_filter_close_device(nvdev->extension);
|
return rndis_filter_close_device(nvdev->extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rndis_filter_opened(const struct netvsc_device *nvdev)
|
bool rndis_filter_opened(const struct netvsc_device *nvdev)
|
||||||
{
|
{
|
||||||
return atomic_read(&nvdev->open_cnt) > 0;
|
const struct rndis_device *dev = nvdev->extension;
|
||||||
|
|
||||||
|
return dev->state == RNDIS_DEV_DATAINITIALIZED;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче