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: 9885099 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 C00DB60363 for ; Mon, 7 Aug 2017 11:51:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAC46285DA for ; Mon, 7 Aug 2017 11:51:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F8AA2862A; Mon, 7 Aug 2017 11:51:12 +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 E7483285DA for ; Mon, 7 Aug 2017 11:51:11 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 32EBA267198; Mon, 7 Aug 2017 13:50:58 +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 AB1A7267190; Mon, 7 Aug 2017 13:50:56 +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 D7F9D2669F6 for ; Mon, 7 Aug 2017 13:50:54 +0200 (CEST) Received: by mail-lf0-f68.google.com with SMTP id t128so157875lff.3 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=ewgoAXzNvlM62NZMDM4g6vhx6rmuu6AWy139ucD66BWkbkjx3WHYCP5KmIP1dujXhQ 9EuHkKCkAG6bA0hwgjMrysxFWzqpGFV2FgJJLFtMKxx8MB3L2r3YxHg3S0IuCO69ca59 XW/AssCiz9LMT/ha+tQXKon7A9gd1Jdylfcugwe1Kv/fheT9SmVg9JaFuHkcEvizxUQe VujChzVciJoi3KTL8HfP3owQGEZveGPCgLhtYhXX63j0eKnpf2Q+WKn0zjytMiDUSlAg VY/L+tQ3Dp6V19xM2ksDGePjWbGfnGPrI0UbjhAWy2ipTaXcyU4RmJk+bZxELg21GB4z bXig== X-Gm-Message-State: AHYfb5i+Yd+yUPzGUYT2SAs4nq0KJBrveEcFWMzLhN4ouqJRgfG4OPdM 5FRNSmH+nxKoctuD 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 Subject: [alsa-devel] [PATCH RESEND 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; }