RE: [PATCH] Drivers: hv: util: on deinit, don't wait the release event, if we shouldn't

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Stephen Hemminger
> Sent: Tuesday, February 28, 2017 01:02
> 
> The patch looks good. I don't  understand the exact semantics here and
> therefore have a couple of naïve questions
> 
> Is it possible device could be opened multiple times? Is reference counting
> done above?

The file can only be opened once.
When we open it for the first time, in hvt_op_open() we run
hvt->mode = HVUTIL_TRANSPORT_CHARDEV, and when we try to open it later,
the open() gets -EBUSY.
When the first fd is closed, in hvt_op_release() we run 
hvt->mode = HVUTIL_TRANSPORT_INIT, so we can re-open it successfully later.

> If device was never opened do you even have to do all the cleanup steps at
> all?

Yes, e.g. we do need the 3 cancel_*work_sync calls in hv_kvp_deinit():
the driver schedules the 3 works even if there is no daemon at all, e.g.
hv_kvp_onchannelcallback ->
    schedule_delayed_work(&kvp_host_handshake_work, ...).

Thanks,
-- Dexuan
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux