From patchwork Thu Aug 11 19:02:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrej Krutak X-Patchwork-Id: 9275911 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 6398A6022E for ; Thu, 11 Aug 2016 19:56:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50BA828788 for ; Thu, 11 Aug 2016 19:56:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44E352878A; Thu, 11 Aug 2016 19:56:59 +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_SIGNED, 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 7700928788 for ; Thu, 11 Aug 2016 19:56:58 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id AA6DE267EAA; Thu, 11 Aug 2016 21:56:57 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 4C463267B1C; Thu, 11 Aug 2016 21:42:10 +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 02C37267AEF; Thu, 11 Aug 2016 21:42:05 +0200 (CEST) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by alsa0.perex.cz (Postfix) with ESMTP id 6F5B8267779 for ; Thu, 11 Aug 2016 21:04:12 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id i5so933404wmg.2 for ; Thu, 11 Aug 2016 12:04:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Dzx+4IpD+0nJ9sUfesZiyUjpkHeWquyYCndEYDRKKzI=; b=X6kOKMa63J6QlIBi3KgpVbTHkaiwPhvcdpnodEoIhgvNOX5gAeNkU8QTr8TM7UYyYq UECLUthRQqW9bJBRKUhnZLRwDnLSzycCZ+4MBcOkrhhWtba5WXOrXA3zjQVJ2raEgAEn AqS0itVZtDV5rh9URlHq8iIodMdQISpU+6zjhmsj/cSIsC+RI4sjpYX2L1W6xsTyDAaS KFlt0ZnjYpFvvXdM4hKJGdnqphx+d7X6ohqYLIp5ws+EuywFTg3q4CpLrltb5pabCQPb +//LJmo9TvEK0HrejtwEYX6ei8gq5rA/p+TrIy4qg0INkYF3CyBEkxm5Yx1S34u+HEjX JqNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Dzx+4IpD+0nJ9sUfesZiyUjpkHeWquyYCndEYDRKKzI=; b=UYZ/ezNkI4nik18cvTDFmAIHVnBqBxiHbt0YxcFd7dNhkhcHUlezNvLL/GX4TbqKq8 pXmrYHF0uVPx/ppjHEnVAkpdWkCfw4ywC1LlkpWvmH/6GoPJYPhdCJAkwKgnK6KW2a2N Yj6rqr99jsSI46eMBhpaIgFQ/s2dU3sGLwFsTi3Js13Rl4dTwALHDK6ZBdmg1x66RMDJ moBcQChH6SsM3RuMPIx97McmOTfo5jIdXVf0mw/UtHHC7HCPKcG9oC9EIPn9uM2yu/rz WyCOJCEkY9MLvB/kKSPx0HEMyZT8JrNR4OBUG3RxFz0dLCalevaTXy9giD2N7LX+zlI9 MTgw== X-Gm-Message-State: AEkooutPB/IA5Mb4J/TwjErozFdiim9WottV544LE0cmtIZPVZrm0w4g1sf+R78+Nu5BTw== X-Received: by 10.28.171.214 with SMTP id u205mr10347337wme.97.1470942251930; Thu, 11 Aug 2016 12:04:11 -0700 (PDT) Received: from localhost.localdomain ([94.229.40.98]) by smtp.gmail.com with ESMTPSA id x6sm4001376wjk.26.2016.08.11.12.04.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Aug 2016 12:04:11 -0700 (PDT) From: Andrej Krutak To: alsa-devel@alsa-project.org Date: Thu, 11 Aug 2016 21:02:26 +0200 Message-Id: <1470942147-19848-15-git-send-email-dev@andree.sk> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1470942147-19848-1-git-send-email-dev@andree.sk> References: <1470942147-19848-1-git-send-email-dev@andree.sk> Cc: Andrej Krutak Subject: [alsa-devel] [PATCH 14/15] ALSA: line6: Give up hwdep spinlock temporarily during read operation 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 Without it, the code hits the 'might_sleep while atomic' debug warning. Signed-off-by: Andrej Krutak --- sound/usb/line6/driver.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c index 142e0e3..286b6e1 100644 --- a/sound/usb/line6/driver.c +++ b/sound/usb/line6/driver.c @@ -600,6 +600,10 @@ line6_hwdep_read(struct snd_hwdep *hwdep, char __user *buf, long count, goto end; } + /* Release lock while copying the stuff. Since there is only one reader, + * the data is going nowhere, so this should be safe. */ + spin_unlock(&line6->buffer_circular.read_lock); + if (copy_to_user(buf, &line6->buffer_circular.data[tail * LINE6_MESSAGE_MAXLEN], line6->buffer_circular.data_len[tail]) @@ -610,6 +614,7 @@ line6_hwdep_read(struct snd_hwdep *hwdep, char __user *buf, long count, rv = line6->buffer_circular.data_len[tail]; } + spin_lock(&line6->buffer_circular.read_lock); smp_store_release(&line6->buffer_circular.tail, (tail + 1) & (LINE6_MESSAGE_MAXCOUNT - 1));