Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp323996imn; Fri, 29 Jul 2022 08:01:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tRzoVfLDBS1oTuNcYGAeuOFisqQqyFzxzE/vVcSAFskQIPyndVWsYvadWwMPnxcirHMSXb X-Received: by 2002:a65:6811:0:b0:415:b0c1:9dc3 with SMTP id l17-20020a656811000000b00415b0c19dc3mr3278515pgt.405.1659106860265; Fri, 29 Jul 2022 08:01:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659106860; cv=none; d=google.com; s=arc-20160816; b=1KKj+4boF+/9PEN5B/WidpWiVS2RgwokJecEVTm6Rj17aGOz8BtiYy/9S4D+sNMwoK wwQJZV46AohlqMtRHX7cRgvF+PVYLvNw/udvpBQTukIpzD8lIeNJZbRM3TJLlvCcXmfl wTEykQ6dh60Xztx827NGB8pB/qV1zAJ6A5lOIQR87fgXo7o6wQhaMzlO4s6r0ye2eHtE aedrow5sI4AbSEqpQ9TL1Q/9+K8lZPEOwavsl7BeDzNYYp8pofsAJRJ+3+u4x+vMY2UI psqqiq9r1cxDi709rB5RuG10QroeUWbAqyzeNvXZHtlWVMDcVtclCZLxCGU/iNzw8O+u V2Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=T+qufmvq8X3d2Vz4lYDWrn7j1sGiIz+PQT5qT2XwRow=; b=J07HlSskycwRgqs3pbmKyuJcKxxrNV31wwXuWifVzOmDZkMhLCW66vZ5Zl1dCXx98t IA18H7gAb5NSiOMYER6VZIQn+hlBALlvGH3YEOhj5TGoEGnroIA1EBNi1hdOxopBU1AX rYPqi5qufGUx9eLsxN6OdO0ORk8U3Vyui5J/C1Z2FkRL0yqLjwWaYXOwc2yi2tA2Ky9h G26jDtQLIcfbtVlAcySDQqWwsVOdj8o7ochETI4DROy6v1hQBlcIwY+meKI1Angn65Am yuQF0eVhCAdMlV+tfu7UdIVz8Cuo6uswNuPmLuCWOjPVS8gXswAd9ff3ODGMsMAyrsCE jxlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jx8RM2gZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i10-20020a636d0a000000b0041ab2b8bb33si4447106pgc.245.2022.07.29.08.00.44; Fri, 29 Jul 2022 08:01:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jx8RM2gZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237217AbiG2OwO (ORCPT + 99 others); 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> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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