Skip to content

Commit b1b11bb

Browse files
gregkhvinodkoul
authored andcommitted
soundwire: sysfs: move sdw_slave_dev_attr_group into the existing list of groups
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 <vkoul@kernel.org> Cc: Bard Liao <yung-chuan.liao@linux.intel.com> Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Cc: Sanyog Kale <sanyog.r.kale@intel.com> Cc: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Tested-By: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Link: https://lore.kernel.org/r/2024013029-afternoon-suitably-cb59@gregkh Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 4cece76 commit b1b11bb

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

drivers/soundwire/sysfs_slave.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ static struct attribute *slave_attrs[] = {
105105
&dev_attr_modalias.attr,
106106
NULL,
107107
};
108-
ATTRIBUTE_GROUPS(slave);
108+
109+
static const struct attribute_group slave_attr_group = {
110+
.attrs = slave_attrs,
111+
};
109112

110113
static struct attribute *slave_dev_attrs[] = {
111114
&dev_attr_mipi_revision.attr,
@@ -190,6 +193,12 @@ static const struct attribute_group dp0_group = {
190193
.name = "dp0",
191194
};
192195

196+
static const struct attribute_group *slave_groups[] = {
197+
&slave_attr_group,
198+
&sdw_slave_dev_attr_group,
199+
NULL,
200+
};
201+
193202
int sdw_slave_sysfs_init(struct sdw_slave *slave)
194203
{
195204
int ret;
@@ -198,10 +207,6 @@ int sdw_slave_sysfs_init(struct sdw_slave *slave)
198207
if (ret < 0)
199208
return ret;
200209

201-
ret = devm_device_add_group(&slave->dev, &sdw_slave_dev_attr_group);
202-
if (ret < 0)
203-
return ret;
204-
205210
if (slave->prop.dp0_prop) {
206211
ret = devm_device_add_group(&slave->dev, &dp0_group);
207212
if (ret < 0)

0 commit comments

Comments
 (0)