Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1705398
| From | Oleksandr Andrushchenko <andr2000@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH RESEND 01/11] ALSA: vsnd: Implement driver's probe/remove |
| Date | 2017-08-07 14:00 +0200 |
| Message-ID | <ubORs-7Id-23@gated-at.bofh.it> (permalink) |
| References | <ubORr-7Id-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Add essential driver private info structure, initialize
locks and implement probe/remove of the Xen frontend
driver.
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
---
sound/drivers/xen-front.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/sound/drivers/xen-front.c b/sound/drivers/xen-front.c
index 61779c36cae3..8c5de7b0e7b5 100644
--- a/sound/drivers/xen-front.c
+++ b/sound/drivers/xen-front.c
@@ -26,6 +26,16 @@
#include <xen/interface/io/sndif.h>
+struct xdrv_info {
+ struct xenbus_device *xb_dev;
+ spinlock_t io_lock;
+ struct mutex mutex;
+};
+
+static void xdrv_remove_internal(struct xdrv_info *drv_info)
+{
+}
+
static void xdrv_be_on_changed(struct xenbus_device *xb_dev,
enum xenbus_state backend_state)
{
@@ -34,11 +44,28 @@ static void xdrv_be_on_changed(struct xenbus_device *xb_dev,
static int xdrv_probe(struct xenbus_device *xb_dev,
const struct xenbus_device_id *id)
{
+ struct xdrv_info *drv_info;
+
+ drv_info = devm_kzalloc(&xb_dev->dev, sizeof(*drv_info), GFP_KERNEL);
+ if (!drv_info) {
+ xenbus_dev_fatal(xb_dev, -ENOMEM, "allocating device memory");
+ return -ENOMEM;
+ }
+
+ drv_info->xb_dev = xb_dev;
+ spin_lock_init(&drv_info->io_lock);
+ mutex_init(&drv_info->mutex);
+ dev_set_drvdata(&xb_dev->dev, drv_info);
return 0;
}
static int xdrv_remove(struct xenbus_device *dev)
{
+ struct xdrv_info *drv_info = dev_get_drvdata(&dev->dev);
+
+ mutex_lock(&drv_info->mutex);
+ xdrv_remove_internal(drv_info);
+ mutex_unlock(&drv_info->mutex);
return 0;
}
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH RESEND 00/11] ALSA: vsnd: Add Xen para-virtualized frontend driver Oleksandr Andrushchenko <andr2000@gmail.com> - 2017-08-07 14:00 +0200
[PATCH RESEND 07/11] ALSA: vsnd: Initialize virtul sound card Oleksandr Andrushchenko <andr2000@gmail.com> - 2017-08-07 14:00 +0200
[PATCH RESEND 04/11] ALSA: vsnd: Implement Xen event channel handling Oleksandr Andrushchenko <andr2000@gmail.com> - 2017-08-07 14:00 +0200
[PATCH RESEND 06/11] ALSA: vsnd: Introduce ALSA virtual sound driver Oleksandr Andrushchenko <andr2000@gmail.com> - 2017-08-07 14:00 +0200
[PATCH RESEND 02/11] ALSA: vsnd: Implement Xen bus state handling Oleksandr Andrushchenko <andr2000@gmail.com> - 2017-08-07 14:00 +0200
[PATCH RESEND 01/11] ALSA: vsnd: Implement driver's probe/remove Oleksandr Andrushchenko <andr2000@gmail.com> - 2017-08-07 14:00 +0200
[PATCH RESEND 11/11] ALSA: vsnd: Introduce Kconfig option to enable Xen PV sound Oleksandr Andrushchenko <andr2000@gmail.com> - 2017-08-07 14:00 +0200
[PATCH RESEND 09/11] ALSA: vsnd: Implement ALSA PCM operations Oleksandr Andrushchenko <andr2000@gmail.com> - 2017-08-07 14:00 +0200
[PATCH RESEND 03/11] ALSA: vsnd: Read sound driver configuration from Xen store Oleksandr Andrushchenko <andr2000@gmail.com> - 2017-08-07 14:00 +0200
[PATCH RESEND 05/11] ALSA: vsnd: Implement handling of shared buffers Oleksandr Andrushchenko <andr2000@gmail.com> - 2017-08-07 14:00 +0200
[PATCH RESEND 10/11] ALSA: vsnd: Implement communication with backend Oleksandr Andrushchenko <andr2000@gmail.com> - 2017-08-07 14:00 +0200
Re: [PATCH RESEND 00/11] ALSA: vsnd: Add Xen para-virtualized frontend driver Takashi Sakamoto <o-takashi@sakamocchi.jp> - 2017-08-07 14:10 +0200
Re: [PATCH RESEND 00/11] ALSA: vsnd: Add Xen para-virtualized frontend driver Oleksandr Andrushchenko <andr2000@gmail.com> - 2017-08-07 14:20 +0200
Re: [PATCH RESEND 00/11] ALSA: vsnd: Add Xen para-virtualized frontend driver Takashi Sakamoto <o-takashi@sakamocchi.jp> - 2017-08-07 14:40 +0200
Re: [PATCH RESEND 00/11] ALSA: vsnd: Add Xen para-virtualized frontend driver Oleksandr Andrushchenko <andr2000@gmail.com> - 2017-08-07 14:40 +0200
csiph-web