From patchwork Tue Jan 30 18:46:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 194271 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1426279dyb; Tue, 30 Jan 2024 10:47:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/7fYp49s5UXFWyA5nlzSG5Kv54FTKzpf7pPxVKDg1oYZ8v7ZrSYKqCABBEZpM6b6aDEHH X-Received: by 2002:a05:6a20:8e10:b0:19e:3094:fa4a with SMTP id y16-20020a056a208e1000b0019e3094fa4amr721748pzj.21.1706640432565; Tue, 30 Jan 2024 10:47:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706640432; cv=pass; d=google.com; s=arc-20160816; b=UadGcMHLRajLuaJu/zSaqcCrTedHOtbQ+I/bom8t9Ro7DuKJQ5kM8EWeyTiQngOTP5 6oOlrpVQkyFNccrz9Qv1oIUXZ/zIxmFeWZFRhHY1c+Fhv6gvpamLOb9z2uhvvnJG7mVU BhsrZZ2k99eFR86NkUDK4cmomwIYc2ojt10FLRB7BxyY64O5K8et/cR7HE3L4IhIOx9p 4R0kwKyBsWbaN4+gc61OEXtUpBrWadrF/kgSPsV35sii8eKusqoKavfG3sH0CquRF3GB kU2NS5v9YO4Pr13TIg0UKyIXcXn2mRyG2L5QM4eJEdGPWReZuxGcQwVuV9YjD8LkXO/D rx3g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:lines:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=LxIl2r8RX4FL5YMMjfcmzsCLI2AnCJbaayZrc6NdaBo=; fh=uOO6ymTuzdl++RJdyawGXm3DdPUMVQXqhpsBivQ1JuI=; b=vplmsL3H5I23NJLxFqKjmpbZz4UVbiuHqMeR6H6kx3+Q7TwRHIfEceXOO4OTrMtfRR VUnKpCCVbjnfvroROzShoHU08B1jj2ZFHxQ2YpS2rHatV3X9J8RUS7rQanBXojCGgxN2 YlU96KMMMuEkYC0SKktWOJBXTpB13K8GJiw43dz5HknrkPUsVFaB0Kt+V2v0Th9LKBsR KxlUIt1E8q6o6y2+VJNxy1fREXh+ZZVe64Dw1mOKN4ir2zpzW9eVFQJ0ypwWVLFuBMnS kevuDhchvseknslJMd4+5MGJ84/lCqMyR0LA3jbh+UzZs6pNNQgU1qDVbvPIxV3R5GLY xaEw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LBunFWEq; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-45131-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45131-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k70-20020a638449000000b005cdff5774ecsi7931948pgd.252.2024.01.30.10.47.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 10:47:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45131-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LBunFWEq; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-45131-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45131-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C3C95B24B9A for ; Tue, 30 Jan 2024 18:47:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E6EC6762CC; Tue, 30 Jan 2024 18:46:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="LBunFWEq" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7608778B62 for ; Tue, 30 Jan 2024 18:46:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706640394; cv=none; b=h7a3DmsYwHB4UZ9dISJUnC1Qd7J8aj6z7+FDBDE3+IcO/LqbkKrS1fEEtFwTqriXtyzLYhZ+dBqXrNG5yZxRCMLf2HjIYNZdfi0WuLutCfLIilvcKOYiA4R0TRBkVuVF454Ai+jzuJ8cAl4Ruya5/SahoDkzUTMCGFhA4gh4I2E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706640394; c=relaxed/simple; bh=BgX7RiCZm4cCtNAsSKviPBoSyj5UZj3CE7hHLX99arI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UwukCjTQCAl+4rRnUThD1rIT1O5OKVTYuI02ecQ7C7Ci+XnxLMJXzIrqMj3vd9kpd4LAD4bt6zQnWmOoFdJ3i5W8JfP3OZQSMi9raYSjELqsVG7Tv3ruQ7LbFFcEF/8q5VLTIOtZ+jBDsF042H9VOw6NqQ424Pfk/ms1ahVdfaM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LBunFWEq; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5076C433C7; Tue, 30 Jan 2024 18:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1706640393; bh=BgX7RiCZm4cCtNAsSKviPBoSyj5UZj3CE7hHLX99arI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LBunFWEqvViQi4mxRet0UjF3zVoCFqXCE7PoMJ9cUjfAKTF21EBsVpzTWv4tQLJs7 UGpW1mtNGFZKlNsUjMrsDbzkSoh3xLapa1QTLux7s/FYMhmpn4CLlJC+lAPGQkTbfK Hn5iLgqlC8n9t6Qm4biUliNLWxTvQEOndVcoriCg= From: Greg Kroah-Hartman To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, Dan Williams , Vinod Koul , Bard Liao , Pierre-Louis Bossart , Sanyog Kale , Greg Kroah-Hartman Subject: [PATCH 1/6] sysfs: Introduce a mechanism to hide static attribute_groups Date: Tue, 30 Jan 2024 10:46:27 -0800 Message-ID: <2024013028-deflator-flaring-ec62@gregkh> X-Mailer: git-send-email 2.43.0 In-Reply-To: <2024013025-spoiling-exact-ad20@gregkh> References: <2024013025-spoiling-exact-ad20@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Lines: 247 X-Developer-Signature: v=1; a=openpgp-sha256; l=10288; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=ldWPRKHJqP6LClfj3aiNEK2q3/7xLx9Q8bLbfNPTanA=; b=owGbwMvMwCRo6H6F97bub03G02pJDKk7XVj6BB4wsv1Nf3j+WGnOr363X5Fbv73/4Sefs3xG+ nolXt7YjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZiIVSTD/ErnGX9DyredPu/W zfV5kQTn7G0cOxgWLFzBtctiV6fvzugYx6y7gWL1O6btBwA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789542198233192904 X-GMAIL-MSGID: 1789542198233192904 From: Dan Williams Add a mechanism for named attribute_groups to hide their directory at sysfs_update_group() time, or otherwise skip emitting the group directory when the group is first registered. It piggybacks on is_visible() in a similar manner as SYSFS_PREALLOC, i.e. special flags in the upper bits of the returned mode. To use it, specify a symbol prefix to DEFINE_SYSFS_GROUP_VISIBLE(), and then pass that same prefix to SYSFS_GROUP_VISIBLE() when assigning the @is_visible() callback: DEFINE_SYSFS_GROUP_VISIBLE($prefix) struct attribute_group $prefix_group = { .name = $name, .is_visible = SYSFS_GROUP_VISIBLE($prefix), }; SYSFS_GROUP_VISIBLE() expects a definition of $prefix_group_visible() and $prefix_attr_visible(), where $prefix_group_visible() just returns true / false and $prefix_attr_visible() behaves as normal. The motivation for this capability is to centralize PCI device authentication in the PCI core with a named sysfs group while keeping that group hidden for devices and platforms that do not meet the requirements. In a PCI topology, most devices will not support authentication, a small subset will support just PCI CMA (Component Measurement and Authentication), a smaller subset will support PCI CMA + PCIe IDE (Link Integrity and Encryption), and only next generation server hosts will start to include a platform TSM (TEE Security Manager). Without this capability the alternatives are: * Check if all attributes are invisible and if so, hide the directory. Beyond trouble getting this to work [1], this is an ABI change for scenarios if userspace happens to depend on group visibility absent any attributes. I.e. this new capability avoids regression since it does not retroactively apply to existing cases. * Publish an empty /sys/bus/pci/devices/$pdev/tsm/ directory for all PCI devices (i.e. for the case when TSM platform support is present, but device support is absent). Unfortunate that this will be a vestigial empty directory in the vast majority of cases. * Reintroduce usage of runtime calls to sysfs_{create,remove}_group() in the PCI core. Bjorn has already indicated that he does not want to see any growth of pci_sysfs_init() [2]. * Drop the named group and simulate a directory by prefixing all TSM-related attributes with "tsm_". Unfortunate to not use the naming capability of a sysfs group as intended. In comparison, there is a small potential for regression if for some reason an @is_visible() callback had dependencies on how many times it was called. Additionally, it is no longer an error to update a group that does not have its directory already present, and it is no longer a WARN() to remove a group that was never visible. Link: https://lore.kernel.org/all/2024012321-envious-procedure-4a58@gregkh/ [1] Link: https://lore.kernel.org/linux-pci/20231019200110.GA1410324@bhelgaas/ [2] Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman --- fs/sysfs/group.c | 45 ++++++++++++++++++++++++------- include/linux/sysfs.h | 63 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 87 insertions(+), 21 deletions(-) diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index 138676463336..ccb275cdabcb 100644 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c @@ -31,6 +31,17 @@ static void remove_files(struct kernfs_node *parent, kernfs_remove_by_name(parent, (*bin_attr)->attr.name); } +static umode_t __first_visible(const struct attribute_group *grp, struct kobject *kobj) +{ + if (grp->attrs && grp->is_visible) + return grp->is_visible(kobj, grp->attrs[0], 0); + + if (grp->bin_attrs && grp->is_bin_visible) + return grp->is_bin_visible(kobj, grp->bin_attrs[0], 0); + + return 0; +} + static int create_files(struct kernfs_node *parent, struct kobject *kobj, kuid_t uid, kgid_t gid, const struct attribute_group *grp, int update) @@ -52,6 +63,7 @@ static int create_files(struct kernfs_node *parent, struct kobject *kobj, kernfs_remove_by_name(parent, (*attr)->name); if (grp->is_visible) { mode = grp->is_visible(kobj, *attr, i); + mode &= ~SYSFS_GROUP_INVISIBLE; if (!mode) continue; } @@ -81,6 +93,7 @@ static int create_files(struct kernfs_node *parent, struct kobject *kobj, (*bin_attr)->attr.name); if (grp->is_bin_visible) { mode = grp->is_bin_visible(kobj, *bin_attr, i); + mode &= ~SYSFS_GROUP_INVISIBLE; if (!mode) continue; } @@ -127,16 +140,31 @@ static int internal_create_group(struct kobject *kobj, int update, kobject_get_ownership(kobj, &uid, &gid); if (grp->name) { + umode_t mode = __first_visible(grp, kobj); + + if (mode & SYSFS_GROUP_INVISIBLE) + mode = 0; + else + mode = S_IRWXU | S_IRUGO | S_IXUGO; + if (update) { kn = kernfs_find_and_get(kobj->sd, grp->name); if (!kn) { - pr_warn("Can't update unknown attr grp name: %s/%s\n", - kobj->name, grp->name); - return -EINVAL; + pr_debug("attr grp %s/%s not created yet\n", + kobj->name, grp->name); + /* may have been invisible prior to this update */ + update = 0; + } else if (!mode) { + sysfs_remove_group(kobj, grp); + kernfs_put(kn); + return 0; } - } else { - kn = kernfs_create_dir_ns(kobj->sd, grp->name, - S_IRWXU | S_IRUGO | S_IXUGO, + } + + if (!update) { + if (!mode) + return 0; + kn = kernfs_create_dir_ns(kobj->sd, grp->name, mode, uid, gid, kobj, NULL); if (IS_ERR(kn)) { if (PTR_ERR(kn) == -EEXIST) @@ -279,9 +307,8 @@ void sysfs_remove_group(struct kobject *kobj, if (grp->name) { kn = kernfs_find_and_get(parent, grp->name); if (!kn) { - WARN(!kn, KERN_WARNING - "sysfs group '%s' not found for kobject '%s'\n", - grp->name, kobject_name(kobj)); + pr_debug("sysfs group '%s' not found for kobject '%s'\n", + grp->name, kobject_name(kobj)); return; } } else { diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index b717a70219f6..a42642b277dd 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -61,22 +61,32 @@ do { \ /** * struct attribute_group - data structure used to declare an attribute group. * @name: Optional: Attribute group name - * If specified, the attribute group will be created in - * a new subdirectory with this name. + * If specified, the attribute group will be created in a + * new subdirectory with this name. Additionally when a + * group is named, @is_visible and @is_bin_visible may + * return SYSFS_GROUP_INVISIBLE to control visibility of + * the directory itself. * @is_visible: Optional: Function to return permissions associated with an - * attribute of the group. Will be called repeatedly for each - * non-binary attribute in the group. Only read/write + * attribute of the group. Will be called repeatedly for + * each non-binary attribute in the group. Only read/write * permissions as well as SYSFS_PREALLOC are accepted. Must - * return 0 if an attribute is not visible. The returned value - * will replace static permissions defined in struct attribute. + * return 0 if an attribute is not visible. The returned + * value will replace static permissions defined in struct + * attribute. Use SYSFS_GROUP_VISIBLE() when assigning this + * callback to specify separate _group_visible() and + * _attr_visible() handlers. * @is_bin_visible: * Optional: Function to return permissions associated with a * binary attribute of the group. Will be called repeatedly * for each binary attribute in the group. Only read/write - * permissions as well as SYSFS_PREALLOC are accepted. Must - * return 0 if a binary attribute is not visible. The returned - * value will replace static permissions defined in - * struct bin_attribute. + * permissions as well as SYSFS_PREALLOC (and the + * visibility flags for named groups) are accepted. Must + * return 0 if a binary attribute is not visible. The + * returned value will replace static permissions defined + * in struct bin_attribute. If @is_visible is not set, Use + * SYSFS_GROUP_VISIBLE() when assigning this callback to + * specify separate _group_visible() and _attr_visible() + * handlers. * @attrs: Pointer to NULL terminated list of attributes. * @bin_attrs: Pointer to NULL terminated list of binary attributes. * Either attrs or bin_attrs or both must be provided. @@ -91,13 +101,42 @@ struct attribute_group { struct bin_attribute **bin_attrs; }; +#define SYSFS_PREALLOC 010000 +#define SYSFS_GROUP_INVISIBLE 020000 + +/* + * The first call to is_visible() in the create / update path may + * indicate visibility for the entire group + */ +#define DEFINE_SYSFS_GROUP_VISIBLE(name) \ + static inline umode_t sysfs_group_visible_##name( \ + struct kobject *kobj, struct attribute *attr, int n) \ + { \ + if (n == 0 && !name##_group_visible(kobj)) \ + return SYSFS_GROUP_INVISIBLE; \ + return name##_attr_visible(kobj, attr, n); \ + } + +/* + * Same as DEFINE_SYSFS_GROUP_VISIBLE, but for groups with only binary + * attributes + */ +#define DEFINE_SYSFS_BIN_GROUP_VISIBLE(name) \ + static inline umode_t sysfs_group_visible_##name( \ + struct kobject *kobj, struct bin_attribute *attr, int n) \ + { \ + if (n == 0 && !name##_group_visible(kobj)) \ + return SYSFS_GROUP_INVISIBLE; \ + return name##_attr_visible(kobj, attr, n); \ + } + +#define SYSFS_GROUP_VISIBLE(fn) sysfs_group_visible_##fn + /* * Use these macros to make defining attributes easier. * See include/linux/device.h for examples.. */ -#define SYSFS_PREALLOC 010000 - #define __ATTR(_name, _mode, _show, _store) { \ .attr = {.name = __stringify(_name), \ .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \ From patchwork Tue Jan 30 18:46:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 194272 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1426379dyb; Tue, 30 Jan 2024 10:47:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3RPN0G3pmFxduorlPfAlXPuqfK81vVMZ5vpb76DQjddtul8tSKYQrH6DI32v8tlhfFN1h X-Received: by 2002:a2e:be21:0:b0:2cc:65dd:3320 with SMTP id z33-20020a2ebe21000000b002cc65dd3320mr7738965ljq.27.1706640446017; Tue, 30 Jan 2024 10:47:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706640445; cv=pass; d=google.com; s=arc-20160816; b=qRdqE3WXcXY9dr2dAoYh0P/BxDkuYmUlBTmSBPqrOwJBKd5q2SQm3kE2aP3Q14kpj8 LbDGM6ulwOgB+WqFz05Cxcvj+nafPObmGAsWYT8Dntk+lS2MdDF7HTJk88t2CVBu84Lp zELVPEwYiNzeUkGpXY1sjFKrAm7aVz/LZya1JlEj5Ldxb7PklG5nC3opLzZHF9t8XRZs xB2Sq1VpFa2A82p8AHMDQWpDgIkHQbm7PRqjQ6e2QsZEnVOVQ+x1mEIUGmKIPw/dfXX4 YflYUFnZTxlFl6ji/ijkIPCyljdv4epJHL2hWi0f5JgaPoJ6GtkCNgGDcdUJTqETd7Q/ 5vJQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:lines:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=eyV8Fwb2dhkgzpF6N7VnmFNwcZ6ZmF03gZZsLnoU9h4=; fh=ZUcPkiVf4gvMgVDOUhavBu3WqSDJFLN7Q4rE5Smm1Ig=; b=TYINGYPmKMINo5smpM1Oz99GveiwlmT0u67u5TPX/Ikcn0kI1044lZDYQtXfWI2geG AgS4kMKsZGdEGaBHeoRJCk3FJt4BqLaEOA+tcXcJRxxPRFVB/BDTMg3oTk0VVrU0E4yH yOHtcR4MvvfzhHe8YSh9ood/NWPFU6v89dHksBT8RcTLLgVqZm0+MLceL1I2axugB676 RLXHFdmwyNasckW1S/NXJKiTw+JvajTGotlDbDdmvDrrREBW0IgyRBKzEzeAGyphk846 A6ECxLAtOG1cr2NxEHq/RO/3kWT74Yk14VVVbe9hlARNEz/8F8SBoB88h4d1PVEK+9vH +iaA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JEoAujC5; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-45133-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45133-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a89-20020a509ee2000000b0055f27dea051si1428054edf.347.2024.01.30.10.47.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 10:47:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45133-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JEoAujC5; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-45133-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45133-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 994441F25E26 for ; Tue, 30 Jan 2024 18:47:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 30AF7762EA; Tue, 30 Jan 2024 18:46:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="JEoAujC5" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8354C78B67 for ; Tue, 30 Jan 2024 18:46:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706640402; cv=none; b=eWMbpl7w5Q5GMvEgizi6lZcHrZTZRA2FPP0f/1M9CU92PY+7yPVIvqIcAOFaU3r239tkRXz3qrmu0i55j6OmcKSYU9JeCPnDwPJbYVtxRquiQy8QMgbJtLfArcf+rBRsBNIApFerIqZtVtxDSn7+gdQACJc4szVzXbz+tnEQMdc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706640402; c=relaxed/simple; bh=/Scr6QfMZ0RCV35H3B6N+LHXt3JnpeduIhhpHaToKUk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Kel272UqBhhuC8UeBZa8WpZFkwN+ORuUh0Vddq+FtzXFCvPJBeh+HR5yIfUbJgfkXSMFpiokVc6DRj97akvQr+0Xrycwm1/ewNg7dcyKiEE+gbvph1wJ4p3IdcJ4fYFjAHNucDUM+dFTmo/qFx4XWPEB53CSyLTU4DU/tLkVnrc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JEoAujC5; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8C46C433C7; Tue, 30 Jan 2024 18:46:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1706640401; bh=/Scr6QfMZ0RCV35H3B6N+LHXt3JnpeduIhhpHaToKUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JEoAujC5s2u7BS20jS5iQkeHDhaHoO14PWbNCx/yT6GTbPSKfGvmPQWHo3EAY6Oz5 qqrMzz9jvfZWiFbdRVKYJeu1QXh6S8SaVntmOj+kZGARof2B8kb7yeMLcxwflkkeAe OAkS89eEpD6BPw6c5QQPup8vAd7UvIMDmyPwLbKM= From: Greg Kroah-Hartman To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Dan Williams , Vinod Koul , Bard Liao , Pierre-Louis Bossart , Sanyog Kale Subject: [PATCH 2/6] soundwire: sysfs: move sdw_slave_dev_attr_group into the existing list of groups Date: Tue, 30 Jan 2024 10:46:28 -0800 Message-ID: <2024013029-afternoon-suitably-cb59@gregkh> X-Mailer: git-send-email 2.43.0 In-Reply-To: <2024013025-spoiling-exact-ad20@gregkh> References: <2024013025-spoiling-exact-ad20@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Lines: 61 X-Developer-Signature: v=1; a=openpgp-sha256; l=1988; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=/Scr6QfMZ0RCV35H3B6N+LHXt3JnpeduIhhpHaToKUk=; b=owGbwMvMwCRo6H6F97bub03G02pJDKk7XVjXmhzm99L80ysUunDv2iTNrm7uN7MCJ7MIXvn3f 8uCWZcPdcSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBEAuIZ5hnuTOeNfiPWvsVX /e7WpMUnV77XfsGw4PycJgOeGN6sFzc/K/YWPBXY5LUrDwA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789542212438736212 X-GMAIL-MSGID: 1789542212438736212 The sysfs logic already creates a list of groups for the device, so add the sdw_slave_dev_attr_group group to that list instead of having to do a two-step process of adding a group list and then an individual group. 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 Reviewed-by: Dan Williams --- drivers/soundwire/sysfs_slave.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/soundwire/sysfs_slave.c b/drivers/soundwire/sysfs_slave.c index 3210359cd944..83e3f6cc3250 100644 --- a/drivers/soundwire/sysfs_slave.c +++ b/drivers/soundwire/sysfs_slave.c @@ -105,7 +105,10 @@ static struct attribute *slave_attrs[] = { &dev_attr_modalias.attr, NULL, }; -ATTRIBUTE_GROUPS(slave); + +static const struct attribute_group slave_attr_group = { + .attrs = slave_attrs, +}; static struct attribute *slave_dev_attrs[] = { &dev_attr_mipi_revision.attr, @@ -190,6 +193,12 @@ static const struct attribute_group dp0_group = { .name = "dp0", }; +static const struct attribute_group *slave_groups[] = { + &slave_attr_group, + &sdw_slave_dev_attr_group, + NULL, +}; + int sdw_slave_sysfs_init(struct sdw_slave *slave) { int ret; @@ -198,10 +207,6 @@ int sdw_slave_sysfs_init(struct sdw_slave *slave) if (ret < 0) return ret; - ret = devm_device_add_group(&slave->dev, &sdw_slave_dev_attr_group); - if (ret < 0) - return ret; - if (slave->prop.dp0_prop) { ret = devm_device_add_group(&slave->dev, &dp0_group); if (ret < 0) From patchwork Tue Jan 30 18:46:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 194273 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1426442dyb; Tue, 30 Jan 2024 10:47:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IHXu/B3og4zB+Zvf/BDp1jomRg1RZSVZYj/qc+fKS5152FjxSPDScPRBpaHU2WZg3oX5Jhg X-Received: by 2002:a05:6402:14da:b0:55f:41ba:9a72 with SMTP id f26-20020a05640214da00b0055f41ba9a72mr1730689edx.35.1706640454102; Tue, 30 Jan 2024 10:47:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706640454; cv=pass; d=google.com; s=arc-20160816; b=nOeljOPfWAZ5tfuuZAARcJ7jf/QwnXsRz5eNJ8CJwjbEFwVYFFdko7ZKrr/gqCEQhx JHJ54Yrn6quFf3RY/2C/zgQpyiQhBOxa9ShNdZHFNKnNiUxRsl/tGN5qT1W0bQAt70DY QwKdfVlXEOqfeXCOH8qLA6Ih+1fAlBiPVBIZw2rZuscSOsBe4rrIt7yQj3lgqF9ssdc8 B9RfMfpbs0Btbu8fIMjc9el91Sx5A44JgJVL1+NKFLKM2xgFOrenhg2Lvxla2DZ/5h6y ZQNQyo0ZLBIYhWyFUMML4bUUKGvaoBoqlP7fl/ul/x7xYeV0OLsa/+g7/BQJlk+Igop4 zCuA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:lines:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=/MxwDnU7Qm/tFgTCygmukfYx3eJymCRnBBR4t/XpFUk=; fh=ZUcPkiVf4gvMgVDOUhavBu3WqSDJFLN7Q4rE5Smm1Ig=; b=M2T+/jJJOXgJDPvTTlfpaU1TArBwaRwPUpO48b4GfcO+yuUgzgGqwdskmJrDT5SQoU k3g8cBXEQXRfRiGnplrVMOOu+eERzNtRPscN3bjgGfmbQT+fVwUC6CBsPZHVFw7jesl4 c6ndipD2X2opz5E0LPU3aXXUtIMVZGl+slt1Qm+jAMCL7CnuReIu/PWvCP+n2gu4pwv3 QcKGATsdlZhM2SqlDh7FFGVXTee6mzhfL7FPaGlOUAJtxHqLOEUZ/KCG/1a90GNddN+L vdLMoWPZWDmpo0LDGhPQ6edar8JDDo5aNirbmTFJovrDvQi0a0hTVktT0GIiviW0s42L 5bqA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="gxE/1m3L"; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-45134-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45134-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ef6-20020a05640228c600b0055c5f4d2c6fsi4830179edb.257.2024.01.30.10.47.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 10:47:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45134-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="gxE/1m3L"; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-45134-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45134-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 800151F25513 for ; Tue, 30 Jan 2024 18:47:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CEDAB762F6; Tue, 30 Jan 2024 18:46:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="gxE/1m3L" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 306E778B62 for ; Tue, 30 Jan 2024 18:46:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706640403; cv=none; b=KjbhpmTARIXwSMs0sv7CxClw2Evz47kMsNCyoH8jobElX6LSw8pLWPlaclmqjBnmQvt3h8mkgjLnEl29Kc+XydOFQm8+WHHIIC5r0jzDqzFyjawtzdBcLVHAK5KRUy2FkDkxY76xzTr5AT11shc+bzjvKxtwph7RD7cRgz4xBoI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706640403; c=relaxed/simple; bh=+h2BNyNBH2PQ5+Cwjewz2w+MpDwd4+tscGSgxiN4bBw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ONPVfvsjeGc6tjNUm44Sdc64rNaDX3cynwhqygD/+aXxPvjUqXQyBGURCH8v8w1vO2AEmo/MpKW36jKP+KAAlula0pNDhlgv+K+L9rKLG51uaXirOZ3uTpRKzkBcv+xJh53TK1TAbSEAJ9ohoBSn2HafeEEmz/HYOiAqKBmU2PA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gxE/1m3L; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99253C43390; Tue, 30 Jan 2024 18:46:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1706640402; bh=+h2BNyNBH2PQ5+Cwjewz2w+MpDwd4+tscGSgxiN4bBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gxE/1m3LBF4/0Uug8Ja3628zL9XNu1jPKRDjIb+WoJn9bSz80+kQE1VSaK8IGV36w kY6fxwphK6yqq4kk4NJSjj89nLgrv9NOzmBSNj/AeKTgQYNP73fFIr+OMI9g4eIS2q bOWkXgSN95hGjetUpnZIgmPF5aJFt6dD6DXjrFjU= From: Greg Kroah-Hartman To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Dan Williams , Vinod Koul , Bard Liao , Pierre-Louis Bossart , Sanyog Kale Subject: [PATCH 3/6] soundwire: sysfs: cleanup the logic for creating the dp0 sysfs attributes Date: Tue, 30 Jan 2024 10:46:29 -0800 Message-ID: <2024013029-budget-mulled-5b34@gregkh> X-Mailer: git-send-email 2.43.0 In-Reply-To: <2024013025-spoiling-exact-ad20@gregkh> References: <2024013025-spoiling-exact-ad20@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Lines: 80 X-Developer-Signature: v=1; a=openpgp-sha256; l=2392; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=+h2BNyNBH2PQ5+Cwjewz2w+MpDwd4+tscGSgxiN4bBw=; b=owGbwMvMwCRo6H6F97bub03G02pJDKk7XVhfd9kz3i+ziuUsbZn91kua31/nxW6Lq/e7v0ZWH 3Hb2FLYEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABOpz2WYn5egX7lZUK/wMuuz qjcsv3dWRTbuY5jvNWNKbtb0F41zllTeZXxww81vwYR8AA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789542220539901532 X-GMAIL-MSGID: 1789542220539901532 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 Reviewed-by: Dan Williams --- drivers/soundwire/sysfs_slave.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/soundwire/sysfs_slave.c b/drivers/soundwire/sysfs_slave.c index 83e3f6cc3250..8876c7807048 100644 --- a/drivers/soundwire/sysfs_slave.c +++ b/drivers/soundwire/sysfs_slave.c @@ -184,18 +184,40 @@ static struct attribute *dp0_attrs[] = { NULL, }; +static umode_t dp0_attr_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; +} + +static bool dp0_group_visible(struct kobject *kobj) +{ + struct sdw_slave *slave = dev_to_sdw_dev(kobj_to_dev(kobj)); + + if (slave->prop.dp0_prop) + return true; + return false; +} +DEFINE_SYSFS_GROUP_VISIBLE(dp0); + /* * we don't use ATTRIBUTES_GROUP here since we want to add a subdirectory * for dp0-level properties */ static const struct attribute_group dp0_group = { .attrs = dp0_attrs, + .is_visible = SYSFS_GROUP_VISIBLE(dp0), .name = "dp0", }; static const struct attribute_group *slave_groups[] = { &slave_attr_group, &sdw_slave_dev_attr_group, + &dp0_group, NULL, }; @@ -207,12 +229,6 @@ int sdw_slave_sysfs_init(struct sdw_slave *slave) if (ret < 0) return ret; - if (slave->prop.dp0_prop) { - ret = devm_device_add_group(&slave->dev, &dp0_group); - if (ret < 0) - return ret; - } - if (slave->prop.source_ports || slave->prop.sink_ports) { ret = sdw_slave_sysfs_dpn_init(slave); if (ret < 0) From patchwork Tue Jan 30 18:46:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 194274 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1426791dyb; Tue, 30 Jan 2024 10:48:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IH43+JG6+hUxfX5JXcwf5mnLPEJRq4sZNeEUlIAbG7ojfknUASAnxqBPbnRp65zbNFy8NcZ X-Received: by 2002:a17:90a:b887:b0:292:6cc5:a881 with SMTP id o7-20020a17090ab88700b002926cc5a881mr6175384pjr.10.1706640493213; Tue, 30 Jan 2024 10:48:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706640493; cv=pass; d=google.com; s=arc-20160816; b=Y+1uGtbD/DCfG8giSt4Fv1Vm0QwML9EtJT4METUCzzjyGbY2UH+YVz6mwbS6TSsKZX GHJHbXSrfJKrTgqLWZA7Aj6LGeuK7iLhQaYSOhnLuPFm495cKkh+7mPiJN37XoCGMVEq 7PldXL/zS/pvkARrU9SCCm41QZpya4uKEGfhMUdFG35myTWYIg6JyH+EkoQuumIWXeri vcLxBDUynK11W2578Jd2807LdhpZV5X+uxzp+o3wuI8K7pEI2IhogE7/GTeRUUUEMfJ6 KUdbV+R1HQVXNFcF1Gbl+RTYmyBRGnTXo8FOv/aFtvhHK7WGnrQTIQBSLbrC8Shkx4ZQ 55Dg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:lines:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=XQOOhZyQiGq2jd1UcHJu26/sJFfHrE0NVt0yGojSft4=; fh=ZUcPkiVf4gvMgVDOUhavBu3WqSDJFLN7Q4rE5Smm1Ig=; b=ZAxC+3ochOFjk7Ocf3TlJR1HzHOOq7HIGH6CiYg9nZ/vXmKIZaq5J/YWKbb8dui4Bv 8Mnm/4s5J512l4A17b8PPxQxADM4m12QQKC2+HnZn7qf8ITKijolrZTA+MoQB18nVSmC qDW1GguGSlwuYGMWvLlJKlG+4m1TJIyEmXyxWpfxdj07RcZY/WXHVf3uxar9eFlAgDCZ Ck7ZraxnPp0tbw41XjbcfTzOMSiOt0KNFg7wLDPS4u4YH5LtuhpRSLPWTTvqyo/qF0p4 3/C/sGAjxv7jAieJr2KreQmuyVMfEEzgY1MGlnFkOBYRiyQ3cGRzpkkTCCBkF5n3teTp Q3VQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PlUdiYBw; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-45135-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45135-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y1-20020a17090322c100b001d7587f372dsi8137536plg.213.2024.01.30.10.48.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 10:48:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45135-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PlUdiYBw; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-45135-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45135-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 129E2B250E0 for ; Tue, 30 Jan 2024 18:47:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8ADA6157053; Tue, 30 Jan 2024 18:46:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="PlUdiYBw" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC42278B7A for ; Tue, 30 Jan 2024 18:46:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706640403; cv=none; b=oTb5pv6VFA58Tm5Cw1iF3m0eqmJGh903oKfGqeZNuh7HE6YZbvb5TT270mNFVzbnYJELYgGWcx4S+5dsvRj4i+6Zvfy681tbH8r9aPzb+eNqlVno75kjRZoWhmpbnRH5OEN1xAQofza/TSraKGYFryoXKgjM2ECeC+1vKcFPgGw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706640403; c=relaxed/simple; bh=zjX6COLrzX2UnAbnR13vMj+lXPKV02pQPeYFqk/O8jM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=vF1GGIvUPb67BTKtfTIenMGkjVun3ZehBKj3z6yEkbpJQS+45BNXecEYzI22T/bgpMewynv63ohcrM2Xiiw2XJposYB+HlJFHcDQGGtAGfqH5O+13sVXGmcBZaBbpmKvAd5QksC0Q/UZRaY6Wo+RFY3kv4Rv2achfE4ZgOZACMU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=PlUdiYBw; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 662CCC433B1; Tue, 30 Jan 2024 18:46:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1706640403; bh=zjX6COLrzX2UnAbnR13vMj+lXPKV02pQPeYFqk/O8jM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PlUdiYBw+1A31R3cg/zeFou3VlBY2FXsJc2k9fFlothmw0HEIqEvAYL16dRxQycAL 2Ad8G0ET9DNs45zDq2jLaVCauoMZ0P5LO07A5Kw/xmq+o8mVI+oYQcrVIjtAWENE7O 3RzcN/XIYRO3TVH3L3BrR0T0eLespWFNanVPrR7E= From: Greg Kroah-Hartman To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Dan Williams , Vinod Koul , Bard Liao , Pierre-Louis Bossart , Sanyog Kale Subject: [PATCH 4/6] soundwire: sysfs: have the driver core handle the creation of the device groups Date: Tue, 30 Jan 2024 10:46:30 -0800 Message-ID: <2024013030-worsening-rocket-a3cb@gregkh> X-Mailer: git-send-email 2.43.0 In-Reply-To: <2024013025-spoiling-exact-ad20@gregkh> References: <2024013025-spoiling-exact-ad20@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Lines: 70 X-Developer-Signature: v=1; a=openpgp-sha256; l=2734; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=zjX6COLrzX2UnAbnR13vMj+lXPKV02pQPeYFqk/O8jM=; b=owGbwMvMwCRo6H6F97bub03G02pJDKk7XdgyEnavUmgT0xffUnLtkcSzDOGKlGfCq1+f8uq5f FTmnvurjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZjIvD0M81POZVT+i332yPDM 3vv9fG8fbt8zI5lhntY6xaNLhE60zDFxWbjeedGtJx+nBwEA X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789542262033951983 X-GMAIL-MSGID: 1789542262033951983 The driver core supports the ability to handle the creation and removal of device-specific sysfs files in a race-free manner. Take advantage of that by converting this driver to use this by moving the sysfs attributes into a group and assigning the dev_groups pointer to it. 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 Reviewed-by: Dan Williams --- drivers/soundwire/bus_type.c | 1 + drivers/soundwire/sysfs_local.h | 3 +++ drivers/soundwire/sysfs_slave.c | 6 +----- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/soundwire/bus_type.c b/drivers/soundwire/bus_type.c index 9fa93bb923d7..5abe5593395a 100644 --- a/drivers/soundwire/bus_type.c +++ b/drivers/soundwire/bus_type.c @@ -221,6 +221,7 @@ int __sdw_register_driver(struct sdw_driver *drv, struct module *owner) drv->driver.probe = sdw_drv_probe; drv->driver.remove = sdw_drv_remove; drv->driver.shutdown = sdw_drv_shutdown; + drv->driver.dev_groups = sdw_attr_groups; return driver_register(&drv->driver); } diff --git a/drivers/soundwire/sysfs_local.h b/drivers/soundwire/sysfs_local.h index 7268bc24c538..3ab8658a7782 100644 --- a/drivers/soundwire/sysfs_local.h +++ b/drivers/soundwire/sysfs_local.h @@ -11,6 +11,9 @@ /* basic attributes to report status of Slave (attachment, dev_num) */ extern const struct attribute_group *sdw_slave_status_attr_groups[]; +/* attributes for all soundwire devices */ +extern const struct attribute_group *sdw_attr_groups[]; + /* additional device-managed properties reported after driver probe */ int sdw_slave_sysfs_init(struct sdw_slave *slave); int sdw_slave_sysfs_dpn_init(struct sdw_slave *slave); diff --git a/drivers/soundwire/sysfs_slave.c b/drivers/soundwire/sysfs_slave.c index 8876c7807048..3afc0dc06c98 100644 --- a/drivers/soundwire/sysfs_slave.c +++ b/drivers/soundwire/sysfs_slave.c @@ -214,7 +214,7 @@ static const struct attribute_group dp0_group = { .name = "dp0", }; -static const struct attribute_group *slave_groups[] = { +const struct attribute_group *sdw_attr_groups[] = { &slave_attr_group, &sdw_slave_dev_attr_group, &dp0_group, @@ -225,10 +225,6 @@ int sdw_slave_sysfs_init(struct sdw_slave *slave) { int ret; - ret = devm_device_add_groups(&slave->dev, slave_groups); - if (ret < 0) - return ret; - if (slave->prop.source_ports || slave->prop.sink_ports) { ret = sdw_slave_sysfs_dpn_init(slave); if (ret < 0) From patchwork Tue Jan 30 18:46:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 194275 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1426828dyb; Tue, 30 Jan 2024 10:48:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IFPNMXJ/smWSuq5yijkpfMBizd5Eyng3iXyqHkohacGlXymUo3MocrR2vqW2Pe5Io2nwEVW X-Received: by 2002:a05:6358:f481:b0:178:8ee2:6a29 with SMTP id ku1-20020a056358f48100b001788ee26a29mr62701rwb.56.1706640498407; Tue, 30 Jan 2024 10:48:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706640498; cv=pass; d=google.com; s=arc-20160816; b=aw49f9ZhEH4n9HPYKpQZxoV3NqygAe36bcJUWxXpyQ28rDmN6b/b2CuLMntF+Wd53J so9MlZ4WsM1x5taM/CxjdIjNeSWSCxsV6W2fCE7Dnv+y2urcN9lR5jU8enbr9XTkgVLw OIv1pwJr0qWRJd65CSZyJpZr7bq0sZ//SDtWN56e7TkwCBGyJcVgWEqT/uFeN5mfpA34 Q/K+PyKBgaxe1yc7TcJNRtrbppI9EiUlNvC9fW4YS8fnK+mnFOthmkVVVW+c648ceD3A q8A69y1RNRzjevj64JkmkmzxdofpX7TVwsYHtYLVI9EtuRaOQLD3GEmpsHOZ/b8wDW6J Z9aw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:lines:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=lI2NCP0xbivHUtrX2B4pitKbB0dvqjR6/cYDn7txjZ8=; fh=ZUcPkiVf4gvMgVDOUhavBu3WqSDJFLN7Q4rE5Smm1Ig=; b=jhrLv+UDwcQAZ2ZlvtnN5g+CHM4pkBCvE6ysi1JMfrpy8hMMgkxEjnYLx3K9sS/IJ0 HUDnga4piNwKVm/p1GdhcqMPHd5Zcg6/WwOXouB6vNh0NnxMe3gjEksKgiSPoAiGDLBK SYp6We9jk9dL7ItENKyfN8fRbC7wR+GBj1WC+HsbJIATjQqbT/nS/MVZ0OaivyJbaLGJ CDOu1megEFJasVd2o/paIKgtrDZ8K0cShc3pRCj+nvz96w7hKain3L6KZ4lOAKMPhCKf mpDq8BEDROXsHcJLIIDbjPbQOJwku4CRLlAyApac2kfrZ5RiC9vX9PKwzpNvGAdMCeOY n+sw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="E/anzjRI"; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-45136-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45136-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i10-20020a636d0a000000b005d778417e50si7877386pgc.587.2024.01.30.10.48.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 10:48:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45136-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="E/anzjRI"; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-45136-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45136-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0FADC28AC6C for ; Tue, 30 Jan 2024 18:47:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4453B7993E; Tue, 30 Jan 2024 18:46:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="E/anzjRI" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C61B762F1 for ; Tue, 30 Jan 2024 18:46:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706640405; cv=none; b=B/HsvXPpI/hH9YF1SchMietRTn20FP2rSBiydY4ZGdQgjOFaLVAVDhdFAlU/L5xf+0jM6WylKnWtm2R0SIz4yS8grl1gX1xIYuDH3GrrEmzs+EkYxsdJM/lTJfvK5OaaYy1fh5x/bfPo8lb7ythEF6mTHS8AfmCCHYF70rWalG0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706640405; c=relaxed/simple; bh=wEdD348a9MfphH5q9oOA68An6QVp+AVDQ4A3h9ix8BU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Bm41gDE9tyREQwDOj3L0POD/Tlh87//3/l++xej1MKr3tk4wbTppqa6doSRz/SQIvk+nzaJUSIBQb0f0HU/Foe8X0pHmr5esEZDyxIkcINtH8wQBALhDggVu6Q7ukCAFrzJ7Kdnv8i29tkr44uFXGOfYyt0yfrlCd0t+ZNILoWo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=E/anzjRI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FBE0C43394; Tue, 30 Jan 2024 18:46:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1706640404; bh=wEdD348a9MfphH5q9oOA68An6QVp+AVDQ4A3h9ix8BU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E/anzjRI6nxUAS3DddupnKyfHU+TxhTaG5TlVcxVlu+xaU2bLscMa/6VX5kG407cl Ymw16RH7RUIh3CAuq7XqoidnSiMdU+dMRgOeiuHhfPRI+/dBaDA9//5GK2GrlFxM1H Tucp3mfjk7/OxF3Ox8WFLgMf/6qkabPk1AKpifVE= From: Greg Kroah-Hartman To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Dan Williams , Vinod Koul , Bard Liao , Pierre-Louis Bossart , Sanyog Kale Subject: [PATCH 5/6] soundwire: sysfs: remove sdw_slave_sysfs_init() Date: Tue, 30 Jan 2024 10:46:31 -0800 Message-ID: <2024013030-denatured-swaddling-b047@gregkh> X-Mailer: git-send-email 2.43.0 In-Reply-To: <2024013025-spoiling-exact-ad20@gregkh> References: <2024013025-spoiling-exact-ad20@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Lines: 85 X-Developer-Signature: v=1; a=openpgp-sha256; l=3127; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=wEdD348a9MfphH5q9oOA68An6QVp+AVDQ4A3h9ix8BU=; b=owGbwMvMwCRo6H6F97bub03G02pJDKk7Xdhvzpyex5JSJ/p6auuuCX6mVm/2zdy3SlX24fYlL seUt8gu64hlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJnL/IMD/Y2PanvDTLn+ce l1Je3I5VCra8FMGwYNHNTj/200tZlUT1iuPCdP9pzFY4CQA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789542267540245142 X-GMAIL-MSGID: 1789542267540245142 Now that sdw_slave_sysfs_init() only calls sdw_slave_sysfs_dpn_init(), just do that instead and remove sdw_slave_sysfs_init() to get it out of the way to save a bit of logic and code size. 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 Reviewed-by: Dan Williams --- drivers/soundwire/bus_type.c | 4 ++-- drivers/soundwire/sysfs_local.h | 1 - drivers/soundwire/sysfs_slave.c | 13 ------------- drivers/soundwire/sysfs_slave_dpn.c | 3 +++ 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/soundwire/bus_type.c b/drivers/soundwire/bus_type.c index 5abe5593395a..6085eb8c8d85 100644 --- a/drivers/soundwire/bus_type.c +++ b/drivers/soundwire/bus_type.c @@ -126,8 +126,8 @@ static int sdw_drv_probe(struct device *dev) if (slave->prop.use_domain_irq) sdw_irq_create_mapping(slave); - /* init the sysfs as we have properties now */ - ret = sdw_slave_sysfs_init(slave); + /* init the dynamic sysfs attributes we need */ + ret = sdw_slave_sysfs_dpn_init(slave); if (ret < 0) dev_warn(dev, "Slave sysfs init failed:%d\n", ret); diff --git a/drivers/soundwire/sysfs_local.h b/drivers/soundwire/sysfs_local.h index 3ab8658a7782..fa048e112629 100644 --- a/drivers/soundwire/sysfs_local.h +++ b/drivers/soundwire/sysfs_local.h @@ -15,7 +15,6 @@ extern const struct attribute_group *sdw_slave_status_attr_groups[]; extern const struct attribute_group *sdw_attr_groups[]; /* additional device-managed properties reported after driver probe */ -int sdw_slave_sysfs_init(struct sdw_slave *slave); int sdw_slave_sysfs_dpn_init(struct sdw_slave *slave); #endif /* __SDW_SYSFS_LOCAL_H */ diff --git a/drivers/soundwire/sysfs_slave.c b/drivers/soundwire/sysfs_slave.c index 3afc0dc06c98..0eefc205f697 100644 --- a/drivers/soundwire/sysfs_slave.c +++ b/drivers/soundwire/sysfs_slave.c @@ -221,19 +221,6 @@ const struct attribute_group *sdw_attr_groups[] = { NULL, }; -int sdw_slave_sysfs_init(struct sdw_slave *slave) -{ - int ret; - - if (slave->prop.source_ports || slave->prop.sink_ports) { - ret = sdw_slave_sysfs_dpn_init(slave); - if (ret < 0) - return ret; - } - - return 0; -} - /* * the status is shown in capital letters for UNATTACHED and RESERVED * on purpose, to highligh users to the fact that these status values diff --git a/drivers/soundwire/sysfs_slave_dpn.c b/drivers/soundwire/sysfs_slave_dpn.c index c4b6543c09fd..a3fb380ee519 100644 --- a/drivers/soundwire/sysfs_slave_dpn.c +++ b/drivers/soundwire/sysfs_slave_dpn.c @@ -283,6 +283,9 @@ int sdw_slave_sysfs_dpn_init(struct sdw_slave *slave) int ret; int i; + if (!slave->prop.source_ports && !slave->prop.sink_ports) + return 0; + mask = slave->prop.source_ports; for_each_set_bit(i, &mask, 32) { ret = add_all_attributes(&slave->dev, i, 1); From patchwork Tue Jan 30 18:46:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 194276 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1427046dyb; Tue, 30 Jan 2024 10:48:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzS8zEq+N6WMV/QlZ456d3tDArFs7Dtl11FNGUkAqiZO+lrCZILlk3nV+O60ac71nCDkLK X-Received: by 2002:a17:90a:5b0b:b0:293:cf90:8730 with SMTP id o11-20020a17090a5b0b00b00293cf908730mr6073377pji.18.1706640524410; Tue, 30 Jan 2024 10:48:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706640524; cv=pass; d=google.com; s=arc-20160816; b=pXke4W1klcTJjQkpguZGqVybpEaoKFRr10IbkQ9N+2wH05vC9BMrLyu0hSLUC6Ohhf c+UunsWVgrDY4v3E90W8q0c7ogH53hKM7O+MVGApOfGnxezitGtJ3DIx80fNvxhL5nId qD7M01XUWZT10cuBWFrry04rX9mQR72dn4qKceFH1BfpFLd4T4Lz0IvgBahbCb3ffbXK rPk5ORD0gYsD1EniSiOc5IIUKGkmq6zvotN4B3Vbr0ik/h42FbGb2o6ibMq2b8MXA9hW yRq9i6ng90onQA1kFB7TIAaEIVHRJhGn+c56uh3orIiQKs4rA92VxPXSvs95tyA6tFNG PBMQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:lines:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=tKah+8+gLlI58xWYm3bbiE4YxfGliv2jaO5Qu9FoufQ=; fh=ZUcPkiVf4gvMgVDOUhavBu3WqSDJFLN7Q4rE5Smm1Ig=; b=qOYlvVb/8jGbmNzfptufBpf4BJzxt+rUNSB40cEpXgo7uDgxoG7b0lToZbgqqj3o47 bf4RzAg8DL+O6HHkvG9VPDkiNu4lcmBT+p3wFG6koqonbllNGDAFSZGesyzqsLGSBq7o mpZaY4sAiPp+PzjQek49HQnFEhERf0sOeOHcRLYH3gFh2veYdm7X8WkzSFVMXNKVYuZX f3WdYV4h7CAFOAVhB6Wh7A6NHgBy8fulOBZ/qfG1zY+iztfWrT9obht2OiPsClHFGPBD CP4j5MSCy7svRECTxaF8tnjylclrGKlkchxLmc/OyJsDftSp0SW0/QzRKao1mnHyni7y B1Ug== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="cvR/3SDG"; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-45137-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45137-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id i7-20020a17090a65c700b00290ca285344si7835900pjs.134.2024.01.30.10.48.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 10:48:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45137-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="cvR/3SDG"; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-45137-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45137-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2C94BB25585 for ; Tue, 30 Jan 2024 18:48:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F1F7A762F1; Tue, 30 Jan 2024 18:46:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="cvR/3SDG" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4AEC012BEBD for ; Tue, 30 Jan 2024 18:46:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706640406; cv=none; b=AXCoUlo8Yvo2206uSxFk/Ur+uPoY7U1bqtvFlEzZYXNi0Lg7/Gms8iS2kRVXD/wMX6kdJV0JADjXhy6DH2wObfOCa9pIQfxkitEAteKcwBRG1zF4IhGPm3Gn7QVuWKK99zc9LGQqbboPnB3LwZCrkNn8hrqzLVwE+GHnZnxeTpw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706640406; c=relaxed/simple; bh=EAByQhXyu/+Nq0/YEitbsn1bxLp9uFAhGiUot7pVcwI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dLVxHr7QLenwoU5E9QKNG+znOz3LNZ22zC3fLBpzunYW+dLx+6VQJEt3B9jyx524brlj1lmCCMKXc8NZrFkZHgBGNTQUfpn8oERZH00/LK0MHzl5QA43L/Xz+nzWk0qUlq7zoTHsW3B304gvojuGx0eo6oxOTPsLFYcWRds+hQc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cvR/3SDG; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A08DDC433B1; Tue, 30 Jan 2024 18:46:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1706640405; bh=EAByQhXyu/+Nq0/YEitbsn1bxLp9uFAhGiUot7pVcwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cvR/3SDGO4jTwkZ5iAip4p0J9YwtCR4gfiJOQ9HwN9++C/impGwuYy17Bk7FeEZon WKSLPpavHEe8u1jGIknmoYjShSFbVOiObMq9ssSXYRazX9QZlvNco91PnEPTt0sXeR tk/EuoyJMviDztCrMyCIMX4qrzbPrsCQE//z1wwI= From: Greg Kroah-Hartman To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Dan Williams , Vinod Koul , Bard Liao , Pierre-Louis Bossart , Sanyog Kale Subject: [PATCH 6/6] soundwire: sysfs: remove unneeded ATTRIBUTE_GROUPS() comments Date: Tue, 30 Jan 2024 10:46:32 -0800 Message-ID: <2024013031-tranquil-matador-a554@gregkh> X-Mailer: git-send-email 2.43.0 In-Reply-To: <2024013025-spoiling-exact-ad20@gregkh> References: <2024013025-spoiling-exact-ad20@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Lines: 43 X-Developer-Signature: v=1; a=openpgp-sha256; l=1455; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=EAByQhXyu/+Nq0/YEitbsn1bxLp9uFAhGiUot7pVcwI=; b=owGbwMvMwCRo6H6F97bub03G02pJDKk7Xdg/LmraJeW/8MSxm48mi0WrKM6cWl/kw3Jtq4FSw rbUW9P4OmJZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAi5ecZ5sd8rV52tMg7taio 0EfyyJ6VXXvD+hgWTBezWyW2vSXnLv/X/6saZFKXHT9sDwA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789542294500948027 X-GMAIL-MSGID: 1789542294500948027 Now that we manually created our own attribute group list, the outdated ATTRIBUTE_GROUPS() comments can be removed as they are not needed at all. 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 Reviewed-by: Dan Williams --- drivers/soundwire/sysfs_slave.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/soundwire/sysfs_slave.c b/drivers/soundwire/sysfs_slave.c index 0eefc205f697..f4259710dd0f 100644 --- a/drivers/soundwire/sysfs_slave.c +++ b/drivers/soundwire/sysfs_slave.c @@ -129,10 +129,6 @@ static struct attribute *slave_dev_attrs[] = { NULL, }; -/* - * we don't use ATTRIBUTES_GROUP here since we want to add a subdirectory - * for device-level properties - */ static const struct attribute_group sdw_slave_dev_attr_group = { .attrs = slave_dev_attrs, .name = "dev-properties", @@ -204,10 +200,6 @@ static bool dp0_group_visible(struct kobject *kobj) } DEFINE_SYSFS_GROUP_VISIBLE(dp0); -/* - * we don't use ATTRIBUTES_GROUP here since we want to add a subdirectory - * for dp0-level properties - */ static const struct attribute_group dp0_group = { .attrs = dp0_attrs, .is_visible = SYSFS_GROUP_VISIBLE(dp0),