Skip to content

Revert fwnode changes and add description of fwnode cases - #2655

Merged
bardliao merged 3 commits into
thesofproject:topic/sof-devfrom
bardliao:for-device-property
Jan 5, 2021
Merged

bardliao merged 3 commits into
thesofproject:topic/sof-devfrom
bardliao:for-device-property

Conversation

@bardliao

@bardliao bardliao commented Dec 23, 2020 •

Copy link
Copy Markdown
Collaborator

There are only four valid fwnode cases which are

  • primary->secondary->-ENODEV
  • primary->NULL
  • secondary->-ENODEV
  • NULL

dev->fwnode should be converted between the 4 cases above no matter
how/when set_primary_fwnode() and set_secondary_fwnode() are called.
Describe it in the code so people will keep it in mind.

Fixes: #2599

@bardliao

Copy link
Copy Markdown
Collaborator Author

@andy-shev Could you review this PR?

@andy-shev andy-shev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit message is unclear. Can you rephrase it, like "While the commit SHA ("DESCRIPTION") describes everything correct in its commit message the change it made does the opposite and original commit SHA ("DESCRIPTION") was fully correct. Thus, revert the former one here and improve documentation in the next patch". Also it misses Fixes tag.

@andy-shev andy-shev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add spaces and one dash in the list, so it will be ' --> ' to avoid potential confusion with C pointers.

@bardliao
bardliao force-pushed the for-device-property branch from d9490d8 to b6e5fa2 Compare December 24, 2020 01:24
@bardliao

Copy link
Copy Markdown
Collaborator Author

Thanks @andy-shev PR updated.

Comment thread drivers/base/core.c
dev->fwnode = fn->secondary;
if (!(parent && fn == parent->fwnode))
fn->secondary = ERR_PTR(-ENODEV);
fn->secondary = NULL;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think by "original commit SHA ("DESCRIPTION") was fully correct" something different was meant, I think @andy-shev was asking to mention the original commit that introduced the code before d5dcce0

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think by "original commit SHA ("DESCRIPTION") was fully correct" something different was meant, I think @andy-shev was asking to mention the original commit that introduced the code before d5dcce0

Thanks @lyakh for pointing it out.

While the commit d5dcce0 ("device property: Keep secondary firmware
node secondary by type")
describes everything correct in its commit message the change it made does
the opposite and original commit c15e1bd ("device property: Fix the
secondary firmware node handling in set_primary_fwnode()") was fully
correct. Thus, revert the former one here and improve documentation in
the next patch.

Fixes: d5dcce0 ("device property: Keep secondary firmware node secondary by type")
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
There are only four valid fwnode cases which are
- primary --> secondary --> -ENODEV
- primary --> NULL
- secondary --> -ENODEV
- NULL

dev->fwnode should be converted between the 4 cases above no matter
how/when set_primary_fwnode() and set_secondary_fwnode() are called.
Describe it in the code so people will keep it in mind.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
The fwnode->secondary pointer is modified by set_primary_fwnode().
We don't need to set fwnode->secondary = NULL if
commit d5dcce0 ("device property: Keep secondary firmware node
secondary by type") is reversed.

This reverts commit 03b55f5.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
@bardliao
bardliao force-pushed the for-device-property branch from b6e5fa2 to d7175bc Compare December 24, 2020 12:11
@andy-shev

Copy link
Copy Markdown

Last version looks good enough to me to be sent upstream.
Consult with Pierre and whoever else who approves this and proceed.

@bardliao

Copy link
Copy Markdown
Collaborator Author

SOFCI TEST

@bardliao

bardliao commented Jan 5, 2021

Copy link
Copy Markdown
Collaborator Author

@lyakh Does it look good to you?

@bardliao

bardliao commented Jan 5, 2021

Copy link
Copy Markdown
Collaborator Author

SOFCI TEST

@bardliao
bardliao merged commit 99fcad5 into thesofproject:topic/sof-dev Jan 5, 2021
@andy-shev

Copy link
Copy Markdown

Can you send these upstream, please?

@bardliao

bardliao commented Jan 6, 2021

Copy link
Copy Markdown
Collaborator Author

Can you send these upstream, please?

Yes, done. And I saw your Reviewed-by tag. Thanks @andy-shev

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.

[TGL][SDW][RT711] Initialization not complete, timed out in suspend-resume test

3 participants