From patchwork Wed Jul 27 20:22:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 9250373 X-Patchwork-Delegate: geert@linux-m68k.org 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 9474060757 for ; Wed, 27 Jul 2016 20:22:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D391212DA for ; Wed, 27 Jul 2016 20:22:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71B9724B48; Wed, 27 Jul 2016 20:22:46 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 164DD212DA for ; Wed, 27 Jul 2016 20:22:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757121AbcG0UWp (ORCPT ); Wed, 27 Jul 2016 16:22:45 -0400 Received: from mx2.suse.de ([195.135.220.15]:41348 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754303AbcG0UWp (ORCPT ); Wed, 27 Jul 2016 16:22:45 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 88C0FABBB; Wed, 27 Jul 2016 20:22:42 +0000 (UTC) Date: Wed, 27 Jul 2016 22:22:41 +0200 Message-ID: From: Takashi Iwai To: Mark Brown Cc: Vinod Koul , Kuninori Morimoto , linux-renesas-soc@vger.kernel.org, Linux-ALSA , Liam Girdwood , Simon Subject: Re: [alsa-devel] Question about struct snd_soc_dai() :: cpu_dai->codec In-Reply-To: <20160727182233.GV11806@sirena.org.uk> References: <878twpj739.wl%kuninori.morimoto.gx@renesas.com> <20160727032111.GY9681@localhost> <20160727172125.GF9681@localhost> <20160727180456.GQ11806@sirena.org.uk> <20160727182233.GV11806@sirena.org.uk> 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.5 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, 27 Jul 2016 20:22:33 +0200, Mark Brown wrote: > > On Wed, Jul 27, 2016 at 08:11:49PM +0200, Takashi Iwai wrote: > > > I'm wondering whether it's a better option to block the unbind > > behavior, either in driver base (allowing to return an error) or in > > the sound side (waiting in remove() until the sane point). > > That's certainly going to be a lot easier and part of the reason it's > never been looked at much is that (unlike USB) there's very little > reason why an ASoC sound card would ever be hotplugged - even in > development these days the normal development flow involves rebooting. Actually there is already the suppress_bind_attr flag in struct device_driver. For a simple platform driver like snd-soc-rcar, it's easy like: Then there will be no sysfs bind/unbind for this driver. (Note: totally untested: let me know if it really works.) The same technique is likely available for i2c and spi codec drivers. But it's another open question whether we should suppress the sysfs bind/unbind of these devices at all. My gut feeling is that sysfs bind/unbind are mostly useless for drivers like ASoC codecs. At least, it would be much safer to disable for now. Takashi diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 3351a701c60e..d019824927de 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1251,6 +1251,7 @@ static struct platform_driver rsnd_driver = { .driver = { .name = "rcar_sound", .of_match_table = rsnd_of_match, + .suppress_bind_attrs = true, }, .probe = rsnd_probe, .remove = rsnd_remove,