[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b36e5b42-6069-0a73-8cab-7fcfc999f3a8@linux.intel.com>
Date: Mon, 6 May 2019 11:43:51 -0500
From: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: alsa-devel@...a-project.org, tiwai@...e.de,
linux-kernel@...r.kernel.org, liam.r.girdwood@...ux.intel.com,
vkoul@...nel.org, broonie@...nel.org,
srinivas.kandagatla@...aro.org, jank@...ence.com, joe@...ches.com,
Sanyog Kale <sanyog.r.kale@...el.com>
Subject: Re: [alsa-devel] [RFC PATCH 1/7] soundwire: Add sysfs support for
master(s)
Thanks for the quick feedback Greg!
>> +static const struct attribute_group sdw_master_node_group = {
>> + .attrs = master_node_attrs,
>> +};
>> +
>> +static const struct attribute_group *sdw_master_node_groups[] = {
>> + &sdw_master_node_group,
>> + NULL
>> +};
>
> Minor nit, you can use the ATTRIBUTE_GROUPS() macro here to save you a
> few lines.
will do.
>> +
>> +static void sdw_device_release(struct device *dev)
>> +{
>> + struct sdw_master_sysfs *master = to_sdw_device(dev);
>> +
>> + kfree(master);
>> +}
>> +
>> +static struct device_type sdw_device_type = {
>> + .name = "sdw_device",
>> + .release = sdw_device_release,
>> +};
>> +
>> +int sdw_sysfs_bus_init(struct sdw_bus *bus)
>> +{
>> + struct sdw_master_sysfs *master;
>> + int err;
>> +
>> + if (bus->sysfs) {
>> + dev_err(bus->dev, "SDW sysfs is already initialized\n");
>> + return -EIO;
>> + }
>> +
>> + master = kzalloc(sizeof(*master), GFP_KERNEL);
>> + if (!master)
>> + return -ENOMEM;
>
> Why are you creating a whole new device to put all of this under? Is
> this needed? What will the sysfs tree look like when you do this? Why
> can't the "bus" device just get all of these attributes and no second
> device be created?
This is indeed my main question on this code (see cover letter) and why
I tagged the series as RFC. I find it odd to create an int-sdw.0
platform device to model the SoundWire master, and a sdw-master:0 device
whose purpose is only to expose the properties of that master. it'd be
simpler if all the properties were exposed one level up.
Vinod and Sanyog might be able to shed some light on this?
Powered by blists - more mailing lists