From patchwork Sun Jan 11 20:36:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 5607001 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9F594C058D for ; Sun, 11 Jan 2015 20:36:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AB7E720634 for ; Sun, 11 Jan 2015 20:36:39 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 486D020627 for ; Sun, 11 Jan 2015 20:36:38 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id D51E6260555; Sun, 11 Jan 2015 21:36:36 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 0B23F2604D3; Sun, 11 Jan 2015 21:36:30 +0100 (CET) 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 675532604E9; Sun, 11 Jan 2015 21:36:27 +0100 (CET) Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 88CE92604D0 for ; Sun, 11 Jan 2015 21:36:20 +0100 (CET) Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4C1CBAB09; Sun, 11 Jan 2015 20:36:20 +0000 (UTC) Date: Sun, 11 Jan 2015 21:36:20 +0100 Message-ID: From: Takashi Iwai To: Pavel Hofman In-Reply-To: <54B2B992.7000909@ivitera.com> References: <54B28174.7060008@ivitera.com> <54B2B992.7000909@ivitera.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.4 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: alsa-devel Subject: Re: [alsa-devel] ESI Juli@ crash with external clock switch - patch 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP At Sun, 11 Jan 2015 18:57:38 +0100, Pavel Hofman wrote: > > Hi Takashi, > > Dne 11.1.2015 v 16:52 Takashi Iwai napsal(a): > > Does the patch below work instead? > > Thanks a lot for your Sunday response. Unfortunately this patch does not > help, again stuck in the flush_delayed work call - see stack trace below. OK, then this should be cancel_delayed_work_sync() instead, I suppose. The revised patch (also for ak4113.c) below. > > The reason it appears only on > > Juli@ is that juli@ is the only board using this function. > > I see, snd_ak4113_reinit of ak4113.c is never called, only > ak4113_init_regs. Perhaps Juli should not touch the workqueue in > ak4114_reinit and only initialize the regs in similar manner to ak4113? No, it's just quartet driver doesn't handle it properly :) > But then should we restart the workqueue in juli_resume or just reinit > ak4114 regs? Quartet does not have the resume functionality implemented > at all yet. It doesn't matter much because PM doesn't work with Quartet. But the juli.c also should be improved regarding PM. It should stop the workq at suspend. Also, it'd be preferable to have some control start/stop this background work, e.g. via a control element. Otherwise your machine will be constantly loaded unnecessarily. I'll prepare a fix patch to these later. Takashi diff --git a/sound/i2c/other/ak4113.c b/sound/i2c/other/ak4113.c index 1a3a6fa27158..5465506032fd 100644 --- a/sound/i2c/other/ak4113.c +++ b/sound/i2c/other/ak4113.c @@ -141,7 +141,7 @@ void snd_ak4113_reinit(struct ak4113 *chip) { chip->init = 1; mb(); - flush_delayed_work(&chip->work); + cancel_delayed_work_sync(&chip->work); ak4113_init_regs(chip); /* bring up statistics / event queing */ chip->init = 0; @@ -632,8 +632,8 @@ static void ak4113_stats(struct work_struct *work) { struct ak4113 *chip = container_of(work, struct ak4113, work.work); - if (!chip->init) + if (!chip->init) { snd_ak4113_check_rate_and_errors(chip, chip->check_flags); - - schedule_delayed_work(&chip->work, HZ / 10); + schedule_delayed_work(&chip->work, HZ / 10); + } } diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c index c7f56339415d..801ea4692339 100644 --- a/sound/i2c/other/ak4114.c +++ b/sound/i2c/other/ak4114.c @@ -154,7 +154,7 @@ void snd_ak4114_reinit(struct ak4114 *chip) { chip->init = 1; mb(); - flush_delayed_work(&chip->work); + cancel_delayed_work_sync(&chip->work); ak4114_init_regs(chip); /* bring up statistics / event queing */ chip->init = 0; @@ -612,10 +612,10 @@ static void ak4114_stats(struct work_struct *work) { struct ak4114 *chip = container_of(work, struct ak4114, work.work); - if (!chip->init) + if (!chip->init) { snd_ak4114_check_rate_and_errors(chip, chip->check_flags); - - schedule_delayed_work(&chip->work, HZ / 10); + schedule_delayed_work(&chip->work, HZ / 10); + } } EXPORT_SYMBOL(snd_ak4114_create);