From patchwork Mon Aug 7 07:43:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Andrushchenko X-Patchwork-Id: 9884839 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 97FEC60363 for ; Mon, 7 Aug 2017 09:27:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CB1C285D1 for ; Mon, 7 Aug 2017 09:27:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 819562860A; Mon, 7 Aug 2017 09:27:57 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM, 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 C3EB1285D1 for ; Mon, 7 Aug 2017 09:27:56 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 0F4F3267048; Mon, 7 Aug 2017 11:26:55 +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 A3EA5267048; Mon, 7 Aug 2017 09:43:42 +0200 (CEST) Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by alsa0.perex.cz (Postfix) with ESMTP id 9B0D2267031 for ; Mon, 7 Aug 2017 09:43:36 +0200 (CEST) Received: by mail-lf0-f68.google.com with SMTP id y15so4855660lfd.5 for ; Mon, 07 Aug 2017 00:43:36 -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=iLssBWbIRPQSJXw+4s6Y3q05feB4jE9tA2LSTN6VnDIyCCmzmgW/S1GwwpJgNu0N2b VQK1Gb9DqeEF8KUyqR9sLjsBjWsYs1rJ2zP7ycanyLhGSfJcfzJtO18DwfeqFHz6P+Cr v0Ws9omsTud3SVohTvapafS++uDrGPpzJTLl7ab9vepeLu8QUo2z0MA4sjIzcmS9sOZT FpCz1LvE+7lGHTEkcK2kHL+sgZC9fx4dZHWTXHHNwiisnpnUj7KtR/FfP4E5HNedFgtq ARftNH0Rjt3v78QzJ0AoN8CPauuehy9amuyVGwfY7+7Rehu1O2jEL1uU+6IisuoJur0O q4Ag== 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=p8VNhTdahOW7xCv3Zlmt3b4oXblHtQY4E9cEw7wh3Lf3JT1vDKfT16G4LnFOAULsxP rFYk3hyjgFbZlQMku0SL39GrreDNhxGQ/4mFwRzOGuRbOvME6+PYgGqnWpgecp0AvSIv rlclSsV2NPQQBFcOvfhUvVsev6aCsOGk+pEH/LZ4erndfDR6wEz83TeaM56OoNwhCV3i vIRBqkY5lkmAPLMibm2mYi0zZ2EotyWwzCbWUOfRuxAyVv6UbJU6Jf5M+O2alrq2Fojb LfueZkZrEMA2PoYBj93k7dNXMq9bXkY2mLSCpO4n/htSF99WdO792Y6mzTfCXovwKmlB 9yFA== X-Gm-Message-State: AHYfb5hKytKY5rqPuVW8PHku1kkDdcLxp2n+Ig6J/zGoxg0Do07Epetd FfYi0OVZ3j0uNpEJ X-Received: by 10.46.75.9 with SMTP id y9mr3013910lja.43.1502091815578; Mon, 07 Aug 2017 00:43:35 -0700 (PDT) Received: from a2k-HP-ProDesk-600-G2-SFF.kyiv.epam.com (ll-52.209.223.85.sovam.net.ua. [85.223.209.52]) by smtp.gmail.com with ESMTPSA id f136sm399062lff.34.2017.08.07.00.43.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Aug 2017 00:43:34 -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 10:43:06 +0300 Message-Id: <1502091796-14413-2-git-send-email-andr2000@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502091796-14413-1-git-send-email-andr2000@gmail.com> References: <1502091796-14413-1-git-send-email-andr2000@gmail.com> X-Mailman-Approved-At: Mon, 07 Aug 2017 11:26:50 +0200 Cc: andr2000@gmail.com, Oleksandr Andrushchenko , tiwai@suse.com Subject: [alsa-devel] [PATCH 01/11] 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; }