From mboxrd@z Thu Jan 1 00:00:00 1970 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 E779EC19F2B for ; Fri, 29 Jul 2022 15:04:11 +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 0D1C21638; Fri, 29 Jul 2022 17:03:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0D1C21638 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1659107050; bh=XQhKrj3mBkmm98vaiqZCcsYovhORhaIgbJh9hVRNzwk=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=bPWkifxvqPioVhOObvtXIEo1Pgi8cIg6hv7+0omNhudgoOP9sc3FogzRck6X8SzCc G+ix7ItGIPg/E4y5hvcav/gBSOra/FJwg9kgHxtblpcsLy7HbOA2PxQFTBfMW/fJ5Q puUb6tkSSGSWSoyp1nUlAIBdm6GtIFRZdMM2LpTw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A43D7F800BD; Fri, 29 Jul 2022 17:03:19 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E1020F8049C; Fri, 29 Jul 2022 17:03:18 +0200 (CEST) Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C83EBF800BD for ; Fri, 29 Jul 2022 17:03:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C83EBF800BD Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="daLcI1iv" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 637DECE2912; Fri, 29 Jul 2022 15:03:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37BFEC433C1; Fri, 29 Jul 2022 15:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659106985; bh=XQhKrj3mBkmm98vaiqZCcsYovhORhaIgbJh9hVRNzwk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=daLcI1iv3PX39Fx76j5qPHaQB72ymYbKc6AsnVgpC4NA26mIa9NuZEgWv1+L2oido 1jyvyTg+b0AyKxgzElaxr1hjUS0RZTYC7MPhJxxrqoH9z5vPdpd6GVy8F1eF1qFOze k9GkYl1DuGNkoh7BQ9LpqbApv/HqR7wWd/Try0k8= Date: Fri, 29 Jul 2022 17:03:02 +0200 From: Greg Kroah-Hartman To: Pierre-Louis Bossart Subject: Re: [PATCH 2/5] soundwire: sysfs: cleanup the logic for creating the dp0 sysfs attributes Message-ID: References: <20220729135041.2285908-1-gregkh@linuxfoundation.org> <20220729135041.2285908-2-gregkh@linuxfoundation.org> <9365e038-2146-98f8-f989-02827f221c34@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Cc: Vinod Koul , alsa-devel@alsa-project.org, Bard Liao , linux-kernel@vger.kernel.org, Sanyog Kale 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 Fri, Jul 29, 2022 at 09:57:52AM -0500, Pierre-Louis Bossart wrote: > > > On 7/29/22 09:52, Greg Kroah-Hartman wrote: > > On Fri, Jul 29, 2022 at 09:46:26AM -0500, Pierre-Louis Bossart wrote: > >> > >> > >> On 7/29/22 08:50, Greg Kroah-Hartman wrote: > >>> There's no need to special-case the dp0 sysfs attributes, the > >>> is_visible() callback in the attribute group can handle that for us, so > >>> add that and add it to the attribute group list making the logic simpler > >>> overall. > >>> > >>> This is a step on the way to moving all of the sysfs attribute handling > >>> into the default driver core attribute group logic so that the soundwire > >>> core does not have to do any of it manually. > >>> > >>> Cc: Vinod Koul > >>> Cc: Bard Liao > >>> Cc: Pierre-Louis Bossart > >>> Cc: Sanyog Kale > >>> Cc: alsa-devel@alsa-project.org > >>> Cc: linux-kernel@vger.kernel.org > >>> Signed-off-by: Greg Kroah-Hartman > >>> --- > >>> drivers/soundwire/sysfs_slave.c | 18 ++++++++++++------ > >>> 1 file changed, 12 insertions(+), 6 deletions(-) > >>> > >>> diff --git a/drivers/soundwire/sysfs_slave.c b/drivers/soundwire/sysfs_slave.c > >>> index 83e3f6cc3250..3723333a5c2b 100644 > >>> --- a/drivers/soundwire/sysfs_slave.c > >>> +++ b/drivers/soundwire/sysfs_slave.c > >>> @@ -174,6 +174,16 @@ static ssize_t words_show(struct device *dev, > >>> } > >>> static DEVICE_ATTR_RO(words); > >>> > >>> +static umode_t dp0_is_visible(struct kobject *kobj, struct attribute *attr, > >>> + int n) > >>> +{ > >>> + struct sdw_slave *slave = dev_to_sdw_dev(kobj_to_dev(kobj)); > >>> + > >>> + if (slave->prop.dp0_prop) > >>> + return attr->mode; > >>> + return 0; > >>> +} > >> > >> This changes the results slightly by creating an empty 'dp0' directory > >> with no attributes inside. > >> > >> Before: > >> > >> [root@fedora ~]# cd /sys/bus/soundwire/devices/sdw:3:025d:0714:01 > >> [root@fedora sdw:3:025d:0714:01]# ls dp0 > >> ls: cannot access 'dp0': No such file or directory > >> > >> After: > >> [root@fedora sdw:3:025d:0714:01]# ls dp0 > > > > That should be fine, tools should just be looking for the attributes, > > not the existance of a directory, right? > > The idea what that we would only expose ports that actually exist. > That's helpful information anyone with a basic knowledge of the > SoundWire specification would understand. Is "dp0" a port? If so, why isn't it a real device? > The attributes are really details that few people/applications would > understand, and unfortunately the information reported in DSDT is more > often than not complete garbage. I don't understand what DSDT is, or how it is relevant here :( thanks, greg k-h From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EB67C00144 for ; Fri, 29 Jul 2022 15:03:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230356AbiG2PDK (ORCPT ); Fri, 29 Jul 2022 11:03:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229561AbiG2PDI (ORCPT ); Fri, 29 Jul 2022 11:03:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0300B1FE for ; Fri, 29 Jul 2022 08:03:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5077B61AC9 for ; Fri, 29 Jul 2022 15:03:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37BFEC433C1; Fri, 29 Jul 2022 15:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659106985; bh=XQhKrj3mBkmm98vaiqZCcsYovhORhaIgbJh9hVRNzwk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=daLcI1iv3PX39Fx76j5qPHaQB72ymYbKc6AsnVgpC4NA26mIa9NuZEgWv1+L2oido 1jyvyTg+b0AyKxgzElaxr1hjUS0RZTYC7MPhJxxrqoH9z5vPdpd6GVy8F1eF1qFOze k9GkYl1DuGNkoh7BQ9LpqbApv/HqR7wWd/Try0k8= Date: Fri, 29 Jul 2022 17:03:02 +0200 From: Greg Kroah-Hartman To: Pierre-Louis Bossart Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Vinod Koul , Sanyog Kale , Bard Liao Subject: Re: [PATCH 2/5] soundwire: sysfs: cleanup the logic for creating the dp0 sysfs attributes Message-ID: References: <20220729135041.2285908-1-gregkh@linuxfoundation.org> <20220729135041.2285908-2-gregkh@linuxfoundation.org> <9365e038-2146-98f8-f989-02827f221c34@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 29, 2022 at 09:57:52AM -0500, Pierre-Louis Bossart wrote: > > > On 7/29/22 09:52, Greg Kroah-Hartman wrote: > > On Fri, Jul 29, 2022 at 09:46:26AM -0500, Pierre-Louis Bossart wrote: > >> > >> > >> On 7/29/22 08:50, Greg Kroah-Hartman wrote: > >>> There's no need to special-case the dp0 sysfs attributes, the > >>> is_visible() callback in the attribute group can handle that for us, so > >>> add that and add it to the attribute group list making the logic simpler > >>> overall. > >>> > >>> This is a step on the way to moving all of the sysfs attribute handling > >>> into the default driver core attribute group logic so that the soundwire > >>> core does not have to do any of it manually. > >>> > >>> Cc: Vinod Koul > >>> Cc: Bard Liao > >>> Cc: Pierre-Louis Bossart > >>> Cc: Sanyog Kale > >>> Cc: alsa-devel@alsa-project.org > >>> Cc: linux-kernel@vger.kernel.org > >>> Signed-off-by: Greg Kroah-Hartman > >>> --- > >>> drivers/soundwire/sysfs_slave.c | 18 ++++++++++++------ > >>> 1 file changed, 12 insertions(+), 6 deletions(-) > >>> > >>> diff --git a/drivers/soundwire/sysfs_slave.c b/drivers/soundwire/sysfs_slave.c > >>> index 83e3f6cc3250..3723333a5c2b 100644 > >>> --- a/drivers/soundwire/sysfs_slave.c > >>> +++ b/drivers/soundwire/sysfs_slave.c > >>> @@ -174,6 +174,16 @@ static ssize_t words_show(struct device *dev, > >>> } > >>> static DEVICE_ATTR_RO(words); > >>> > >>> +static umode_t dp0_is_visible(struct kobject *kobj, struct attribute *attr, > >>> + int n) > >>> +{ > >>> + struct sdw_slave *slave = dev_to_sdw_dev(kobj_to_dev(kobj)); > >>> + > >>> + if (slave->prop.dp0_prop) > >>> + return attr->mode; > >>> + return 0; > >>> +} > >> > >> This changes the results slightly by creating an empty 'dp0' directory > >> with no attributes inside. > >> > >> Before: > >> > >> [root@fedora ~]# cd /sys/bus/soundwire/devices/sdw:3:025d:0714:01 > >> [root@fedora sdw:3:025d:0714:01]# ls dp0 > >> ls: cannot access 'dp0': No such file or directory > >> > >> After: > >> [root@fedora sdw:3:025d:0714:01]# ls dp0 > > > > That should be fine, tools should just be looking for the attributes, > > not the existance of a directory, right? > > The idea what that we would only expose ports that actually exist. > That's helpful information anyone with a basic knowledge of the > SoundWire specification would understand. Is "dp0" a port? If so, why isn't it a real device? > The attributes are really details that few people/applications would > understand, and unfortunately the information reported in DSDT is more > often than not complete garbage. I don't understand what DSDT is, or how it is relevant here :( thanks, greg k-h