From patchwork Mon Aug 7 11:50:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Andrushchenko X-Patchwork-Id: 9885153 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 A0AFF60363 for ; Mon, 7 Aug 2017 11:53:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9324D28514 for ; Mon, 7 Aug 2017 11:53:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87FD72861F; Mon, 7 Aug 2017 11:53:25 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 41F0E28514 for ; Mon, 7 Aug 2017 11:53:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1degYi-0003w6-MS; Mon, 07 Aug 2017 11:50:56 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1degYh-0003vk-J2 for xen-devel@lists.xen.org; Mon, 07 Aug 2017 11:50:55 +0000 Received: from [85.158.139.211] by server-2.bemta-5.messagelabs.com id 42/CF-01996-E1458895; Mon, 07 Aug 2017 11:50:54 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrEIsWRWlGSWpSXmKPExsVyMfS6o65cSEe kwevJ4hZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8a1j4tYCz7xVJzefZe5gXEFdxcjF4eQwARG ick/HzKBOCwCL1kkznUfZAVxJAT6WSWmvm1h6WLkBHLiJLYda2SCsCskOmcfYgOxhQQUJb4+m 84EMWolk0TPx83sIAk2ASOJ5Td+gDWLCERIHHv8AayBWaBU4sb+OcwgtrCAp8TphUvAhrIIqE rMOT4BzOYVcJRYtHo1O8QyOYmb5zqB6jk4OAWcJFqXVkDsdZS4u3s2+wRGgQWMDKsYNYpTi8p Si3QNTfSSijLTM0pyEzNzdA0NTPVyU4uLE9NTcxKTivWS83M3MQJDiwEIdjCePe15iFGSg0lJ lDd+RVukEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQne/UEdkUKCRanpqRVpmTnAIIdJS3DwKInwZ oOkeYsLEnOLM9MhUqcY7TmuXFn3hYljw+r1QHLKge1A8tWE/9+YhFjy8vNSpcR5WYOB2gRA2j JK8+CGwqLyEqOslDAvI9CZQjwFqUW5mSWo8q8YxTkYlYR5pUGm8GTmlcDtfgV0FhPQWW8SW0H OKklESEk1MAr7P1WsDFvt7TEv6sJcvYv8SbOkK7nORl6+dWtRD+vh5m9SX6Ze+CC0aWl3Vfef xPgMffPvPwNOXw1+yNdWF+a15tbuWxVCjwo9l5/wqCi8pM3/57Ocm9ijgpiiz8rv/lxsvrFNV nrRM3Hf594BwlufLha8wlWnvK6b9ePSKWea3oRKaFp8fa/EUpyRaKjFXFScCAAZH3iRxQIAAA == X-Env-Sender: andr2000@gmail.com X-Msg-Ref: server-8.tower-206.messagelabs.com!1502106654!106035115!1 X-Originating-IP: [209.85.215.65] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15310 invoked from network); 7 Aug 2017 11:50:54 -0000 Received: from mail-lf0-f65.google.com (HELO mail-lf0-f65.google.com) (209.85.215.65) by server-8.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 7 Aug 2017 11:50:54 -0000 Received: by mail-lf0-f65.google.com with SMTP id w199so162613lff.2 for ; Mon, 07 Aug 2017 04:50:54 -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=NBao6CTU/hQBM2Nkir5+j8/DR/KXIx270EOb8PhCOi8ruFo7pjOJZOvfn8RyLhFWmi TeF3ZFsU9J+MqIa0M6E63Cwku+sRWBxibSkvbkP4rDZOVPUAstWeq7cop2qsAqwBKel6 ys6kiJ/qbRs2v8CJxPOIsmXJZ77LZyCvxXwqacEEmm3hlkjnLrro4h3xeAor6XmIDOf4 XSbhvDBTrJkaxgIz+wsBzErxH2dqANCr8ZcwzI4ZWqgV8WDyZgoSHviiBuTbJ+OIrNrg a959pKC7J4F240rYCTJm62Bw/SktCy+y1ngTjyL/ugJqBbQ+iW78H1Jnbv/lppOdfUQ8 kztA== 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=T1iTX6FjkqVFPiqXY85YQbLwEDb949ALhEbyn3yMT1N3Gb4CtkBDUO+q8sy5GdrdVr 2mi+2hWZICqy020CTa6bnKmMWeDTuPc8e/4dmvqruVBxNGncwO8vGIW1YRlhGbWPZQrz Qcmy+deg6bfpGIa8OzwGfVCTUL62AhebJHCt9cJ+T5P0T9sYAjbjw80U3y5/AyHzfXS0 4zmYksLR35FkHp/KQPvxK06ot5AZq6Ybb+4Pp3eKJJmHhUS0yEZlTJg7qqJKesTGOTpv Fb+Gt5qVa2qP6aAzhPqrWa1sa4+PJnU43BcEvz7xLnpH5GLLPsNjNvkJxqwjcAtdjIE5 VHbQ== X-Gm-Message-State: AHYfb5jldBPzU6nJ27UHWAW9LNiMuIU32MaW83M5jysvYz/faGkosMwm RlvLMRF3iG2zsA== X-Received: by 10.25.32.141 with SMTP id g135mr77735lfg.197.1502106653805; Mon, 07 Aug 2017 04:50:53 -0700 (PDT) Received: from a2k-HP-ProDesk-600-G2-SFF.kyiv.epam.com (ll-51.209.223.85.sovam.net.ua. [85.223.209.51]) by smtp.gmail.com with ESMTPSA id n88sm2844587lja.43.2017.08.07.04.50.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Aug 2017 04:50:53 -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 14:50:35 +0300 Message-Id: <1502106645-6731-2-git-send-email-andr2000@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502106645-6731-1-git-send-email-andr2000@gmail.com> References: <1502106645-6731-1-git-send-email-andr2000@gmail.com> Cc: andr2000@gmail.com, Oleksandr Andrushchenko , tiwai@suse.com, perex@perex.cz Subject: [Xen-devel] [PATCH RESEND 01/11] ALSA: vsnd: Implement driver's probe/remove X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" 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; }