Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7B3DCC433F5 for ; Thu, 24 Mar 2022 10:18:22 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 94DA0177C; Thu, 24 Mar 2022 11:17:30 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 94DA0177C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1648117100; bh=6aJ4/GpfZ/uUu5duZXkh6yHeyKA0i9eeIR3gBey/Upk=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=V/epZ29+sF7DNZZWiYDjDxaESUqnMGwEAI/twA3KM5bXmc4tsaMV+vfg9anmW9aGW F3Kb7jtPHb7CzaLw3Fj99I0W+dOSMQj+tJuyB5ytNqk/+40DZROdjPm1mqmZYfuJQh 08JJvZsMAtxIWRoi8HIY0OIfjzM5jzzbPS7aVe7A= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3B985F80154; Thu, 24 Mar 2022 11:17:30 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E300AF80165; Thu, 24 Mar 2022 11:17:28 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5AB62F80139 for ; Thu, 24 Mar 2022 11:17:22 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5AB62F80139 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="uu6AEb9d"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="q9Ez/cxO" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id ED3C31F38D; Thu, 24 Mar 2022 10:17:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1648117041; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y6X25mBZAnKL3HPvxqisFXIWOKi5WoHbxa91pWyP+pQ=; b=uu6AEb9dcf2ORasfQszbFN4YU6snv/t4+6zms1bmfQ7B1HZyFSr+d8rmqxC0iQmmOOuJpr hNb0wEOY0kZGZ5D/O2KMaa+tMwUT1vRXDC7axmWvgHMR6DNQuJe8vzK/U+7ZVomr40Wtpq gTL1cehH3cOlRsL7fOxWtQkEhDKT+VQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1648117041; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y6X25mBZAnKL3HPvxqisFXIWOKi5WoHbxa91pWyP+pQ=; b=q9Ez/cxOF1VNcfrd68MYMu9Zy+RO4hlznRABhVuOwr+9urNnvYtBA5V18t83xmUa2IQ5BH QMCiYtzaO0bjhlDg== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 9793BA3B87; Thu, 24 Mar 2022 10:17:17 +0000 (UTC) Date: Thu, 24 Mar 2022 11:17:21 +0100 Message-ID: From: Takashi Iwai To: Srinivas Kandagatla Subject: Re: Conceptual bug on SoundWire probe/remove? In-Reply-To: References: 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/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: ALSA Development Mailing List , Greg Kroah-Hartman , Pierre-Louis Bossart , Takashi Iwai , Vinod Koul , Mark Brown , Bard Liao X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" On Thu, 24 Mar 2022 11:12:34 +0100, Srinivas Kandagatla wrote: > > > > On 23/03/2022 19:45, Pierre-Louis Bossart wrote: > > Hi, > > I could use feedback/guidance on a possible conceptual bug in the > > SoundWire probe and bus handling. > > > > When we probe a driver, the code does this: > > > > static int sdw_drv_probe(struct device *dev) > > { > >     struct sdw_slave *slave = dev_to_sdw_dev(dev); > >     struct sdw_driver *drv = drv_to_sdw_driver(dev->driver); > >     const struct sdw_device_id *id; > >     const char *name; > >     int ret; > > > >     /* > >      * fw description is mandatory to bind > >      */ > >     if (!dev->fwnode) > >         return -ENODEV; > > > >     if (!IS_ENABLED(CONFIG_ACPI) && !dev->of_node) > >         return -ENODEV; > > > >     id = sdw_get_device_id(slave, drv); > >     if (!id) > >         return -ENODEV; > > > >     slave->ops = drv->ops; > > may be add try_module_get(dev->driver->owner) here, which should > prevent the module from unloading in the first place. The module refcount helps only partially, unfortunately. The unbindig via sysfs is still allowed and it hits the very same problem. Takashi