diff options
author | Stephen Hemminger <stephen@networkplumber.org> | 2018-01-09 12:57:32 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-01-10 17:40:53 +0100 |
commit | ca3cda6fcf1e922213a0cc58e708ffb999151db3 (patch) | |
tree | 9c05b3efcc9058c9e26116711e034253996dea6b /drivers/uio | |
parent | 06028d15177a1b406b7b075ea47c6a352732f23a (diff) | |
download | linux-ca3cda6fcf1e922213a0cc58e708ffb999151db3.tar.bz2 |
uio_hv_generic: add rescind support
When host rescinds the device, the UIO driver will clear the interrupt
state and notify application. The read (or write) on the interrupt FD
will then fail with -EIO. This is simpler than adding lots extra uevent
stuff inside UIO.
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/uio')
-rw-r--r-- | drivers/uio/uio_hv_generic.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c index ee6d862ef4bd..8c6b04a26c47 100644 --- a/drivers/uio/uio_hv_generic.c +++ b/drivers/uio/uio_hv_generic.c @@ -103,6 +103,23 @@ static void hv_uio_channel_cb(void *context) uio_event_notify(&pdata->info); } +/* + * Callback from vmbus_event when channel is rescinded. + */ +static void hv_uio_rescind(struct vmbus_channel *channel) +{ + struct hv_device *hv_dev = channel->primary_channel->device_obj; + struct hv_uio_private_data *pdata = hv_get_drvdata(hv_dev); + + /* + * Turn off the interrupt file handle + * Next read for event will return -EIO + */ + pdata->info.irq = 0; + + /* Wake up reader */ + uio_event_notify(&pdata->info); +} static void hv_uio_cleanup(struct hv_device *dev, struct hv_uio_private_data *pdata) @@ -218,6 +235,8 @@ hv_uio_probe(struct hv_device *dev, goto fail_close; } + vmbus_set_chn_rescind_callback(dev->channel, hv_uio_rescind); + hv_set_drvdata(dev, pdata); return 0; |