From patchwork Mon Aug 7 12:22:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Andrushchenko X-Patchwork-Id: 9885209 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5A68660363 for ; Mon, 7 Aug 2017 12:23:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C5582858A for ; Mon, 7 Aug 2017 12:23:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4160928671; Mon, 7 Aug 2017 12:23:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00BF92858A for ; Mon, 7 Aug 2017 12:23:18 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id DD437267230; Mon, 7 Aug 2017 14:23:11 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id B45D0267230; Mon, 7 Aug 2017 14:23:10 +0200 (CEST) Received: from mail-lf0-f65.google.com (mail-lf0-f65.google.com [209.85.215.65]) by alsa0.perex.cz (Postfix) with ESMTP id 95C2D2669F6 for ; Mon, 7 Aug 2017 14:23:06 +0200 (CEST) Received: by mail-lf0-f65.google.com with SMTP id o85so222238lff.1 for ; Mon, 07 Aug 2017 05:23:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+vA8aZGcXqu/LJ/93kX8p1EWX2NWedoUpO+c6ZhtCmE=; b=PvJ4i8iBi0I7b5kf5Hd5LNKWoL+0fmBrSz0VWpP3ifGe2DRvz+3doahBH0nxA9u/iA WxELXoSCkB6GZoDfbtucbClDY1uGn6wD4zmUB3LwyqTe2u1ZABMf3IWWtFulsZ0xV7aB A2joWQRBiGlv7bBE2m0n7tTqydKjyUnLdPAzLQQOKNEfBxEfz70DDrPq2eStNmC5IKDC pdbFxLxHvhQaU56sT+enm+f56nquDU/Rox5VfwKZncI6+c2RwnonGtkl6pRgsQAQDNux Swhv/+4liEi78cAyz9ZS6lzKpiy02monkuP3rRCmXyr3Mebs9IZ7E1cO8MBmzzwu5m9t CFGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+vA8aZGcXqu/LJ/93kX8p1EWX2NWedoUpO+c6ZhtCmE=; b=Iw8GTX3fPRU1fWFzPCN2/96pyj0Yb5rVE8A3CvOAXW5Kar1lUlq3yeVdLj2LGWfviE D4c/S0Hif6erkIfCdjbxFcfO65O6HMX8t2WPo7qyuLoab663XbdurnElPoim6ecm8VX9 uTZoHm3UviS5bRAb3BYb2U0qvz6VcoyPjC79in9CwF0CzX/IDD8tKQ3p1fpvpZUSnaj2 68jVyzuUqI43D2Z12AbhiZmb4DmhLLlhN0l4KWcfbZmRuwznNE14azFPj9WevVF2fygG U92dMk897HtAw0oZSnypDoC16vNbDewToSYpMfbUAkhVjqIrg39t7PuFuAYERtaCf8GH yeXg== X-Gm-Message-State: AHYfb5h3ONKeUu+SydiBVRhFUvNze0rj0emUOlPARjoiG5EAvGYN4WU2 afsEFr9GjE27hn3E X-Received: by 10.25.38.148 with SMTP id m142mr110403lfm.137.1502108585609; Mon, 07 Aug 2017 05:23:05 -0700 (PDT) Received: from a2k-HP-ProDesk-600-G2-SFF.kyiv.epam.com (ll-53.209.223.85.sovam.net.ua. [85.223.209.53]) by smtp.gmail.com with ESMTPSA id m143sm1031821lfm.77.2017.08.07.05.23.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Aug 2017 05:23:05 -0700 (PDT) From: Oleksandr Andrushchenko To: alsa-devel@alsa-project.org, xen-devel@lists.xen.org, linux-kernel@vger.kernel.org Date: Mon, 7 Aug 2017 15:22:47 +0300 Message-Id: <1502108577-8099-3-git-send-email-andr2000@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502108577-8099-1-git-send-email-andr2000@gmail.com> References: <1502108577-8099-1-git-send-email-andr2000@gmail.com> Cc: andr2000@gmail.com, Oleksandr Andrushchenko , tiwai@suse.com Subject: [alsa-devel] [PATCH RESEND1 02/12] ALSA: vsnd: Implement driver's probe/remove X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Oleksandr Andrushchenko Add essential driver private info structure, initialize locks and implement probe/remove of the Xen frontend driver. Signed-off-by: Oleksandr Andrushchenko --- 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 +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; }