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 85022C00144 for ; Fri, 29 Jul 2022 14:53: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 5A7901632; Fri, 29 Jul 2022 16:52:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5A7901632 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1659106389; bh=F3R+IOAPEQcMnDp1+HJeg+EseSWL8jzg1ZzFD/TqHPU=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=J+UcUXARJDJxieqRtKJZyfwob2JBBsxGarYIbGjrtbKVgNyNypEFbYlhUWVKTLVnp wilNq99CRebgVWZaqBjzZOwRIQ1Jp8m91XNOp6/h3mvSoAmXPfsfkBS+6gusrxtE8u 08pKb8h4ln+3Ne6AJXSMhx9pZiwP+30ZXieHT6lM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E0C38F80430; Fri, 29 Jul 2022 16:52:18 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 245A7F8049C; Fri, 29 Jul 2022 16:52:18 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 580B4F8015B for ; Fri, 29 Jul 2022 16:52:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 580B4F8015B Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="jx8RM2gZ" 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 2395D6194D; Fri, 29 Jul 2022 14:52:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 099A1C433D6; Fri, 29 Jul 2022 14:52:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659106329; bh=F3R+IOAPEQcMnDp1+HJeg+EseSWL8jzg1ZzFD/TqHPU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jx8RM2gZ0DRSCk7nSuPoQxG+jpm3VnWYi6IsuXN62pdo5x/bDUpQ0n/Z8sFwRNuLP tO56S+uBmc5IAjpYCdRGQWSxe0PxLpYSABHXnr65omm4BltMbQzIu9+1SJjdkWh3Lp 3VPyYUk84A3A+HUQtcDIg1K4OBRMSMoXopRWibcI= Date: Fri, 29 Jul 2022 16:52:05 +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: <9365e038-2146-98f8-f989-02827f221c34@linux.intel.com> 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: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? 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 05A0DC00144 for ; Fri, 29 Jul 2022 14:52:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237233AbiG2OwO (ORCPT ); Fri, 29 Jul 2022 10:52:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235283AbiG2OwM (ORCPT ); Fri, 29 Jul 2022 10:52:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 401936D574 for ; Fri, 29 Jul 2022 07:52:12 -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 ams.source.kernel.org (Postfix) with ESMTPS id EC329B82816 for ; Fri, 29 Jul 2022 14:52:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 099A1C433D6; Fri, 29 Jul 2022 14:52:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659106329; bh=F3R+IOAPEQcMnDp1+HJeg+EseSWL8jzg1ZzFD/TqHPU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jx8RM2gZ0DRSCk7nSuPoQxG+jpm3VnWYi6IsuXN62pdo5x/bDUpQ0n/Z8sFwRNuLP tO56S+uBmc5IAjpYCdRGQWSxe0PxLpYSABHXnr65omm4BltMbQzIu9+1SJjdkWh3Lp 3VPyYUk84A3A+HUQtcDIg1K4OBRMSMoXopRWibcI= Date: Fri, 29 Jul 2022 16:52:05 +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: <9365e038-2146-98f8-f989-02827f221c34@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? thanks, greg k-h