Skip to content

Conversation

@keyonjie
Copy link

All sof_pci_priv, sof_acpi_priv and sof_spi_priv are exactly same
structs, here unify them and put it to sof-priv.h.

Signed-off-by: Keyon Jie [email protected]

All sof_pci_priv, sof_acpi_priv and sof_spi_priv are exactly same
structs, here unify them and put it to sof-priv.h.

Signed-off-by: Keyon Jie <[email protected]>
@keyonjie
Copy link
Author

@ranj063 please help review.

@ranj063
Copy link
Collaborator

ranj063 commented Jul 13, 2018

@keyonjie , looks good to me. This is also needed for acquiring the sof device in the snd_sof_suspend/resume methods too.

@plbossart
Copy link
Member

Humm, good point but it's probably worth waiting for @lgirdwood 's feedback. There are odd things in the code such as

priv->sof_pdata = sof_pdata;
sof_pdata->spi = spi;
sof_pdata->dev = dev;

which probably never compiled, so we should do the right thing and make an educated decision here based on the need for differentiation between different types of devices.

@lgirdwood
Copy link
Member

Probably no need to store spi since it can be referenced by cointainer_of(dev) ?

@keyonjie
Copy link
Author

@plbossart good finding, "sof_pdata->spi" won't compile, that should be another fix. As @lgirdwood mentioned, we can use container_of to retrieve all pci_dev/platform_device/spi_device from sof_pdata->dev.

@plbossart can you merge this firstly, then I will add another patch(remove pci_dev/platform_device/spi_dev) to fix the spi compiling issue on top of it.

We had pointers for parent device of snd_sof_pdata, pci for pci_dev,
pdev for platform_device, and spi for spi_device (intended to but not
added yet). All of these can be retrieved from parent dev via
container_of(), so they are actually superfluous.

Here remove these pointers to kinds of parent devices, add an enum
sof_device_type and simplify the initialization of snd_sof_dev->parent
correspondingly.

Signed-off-by: Keyon Jie <[email protected]>
@plbossart plbossart merged commit 9b33dfa into thesofproject:topic/sof-dev Jul 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants