Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: ethernet: phy: mii: simplify if all are fixed link #87628

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

maass-hamburg
Copy link
Collaborator

If all instances are fixed link, remove code that is
not needed for that.

add DT_ALL_INST_HAS_BOOL_STATUS_OKAY() macro.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
add test for DT_ALL_INST_HAS_BOOL_STATUS_OKAY() macro.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
add DT_ANY_INST_HAS_PROP_STATUS_OKAY() macro.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
@maass-hamburg maass-hamburg force-pushed the phy_mii_fixed_link branch 2 times, most recently from 69ee255 to ec38b16 Compare March 26, 2025 12:24
add test for DT_ALL_INST_HAS_PROP_STATUS_OKAY() macro.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
* @return Macro evaluates to `1,` if instance has the property,
* otherwise it evaluates to literal nothing.
*/
#define DT_ALL_INST_HAS_PROP_STATUS_OKAY__(idx, prop) \
Copy link
Collaborator

@rruuaanng rruuaanng Mar 27, 2025

Choose a reason for hiding this comment

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

Sorry. This name is truly bizarre, why add an underscore at the end?

Edit

I think we should start with the name itself, otherwise, we can't define its fundamental behavior. At least at first glance, the underscore seems to exist solely to avoid duplicate naming.

Copy link
Collaborator Author

@maass-hamburg maass-hamburg Mar 27, 2025

Choose a reason for hiding this comment

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

I just added these similar to the already existing DT_ANY_INST_HAS**. These just use a kind af a reversed logic.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @rruuaanng ; these names need to be revisited

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

IF that name should be changed, we should also do that with the already merged DT_ANY_INST_HAS_PROP_STATUS_OKAY and DT_ANY_INST_HAS_BOOL_STATUS_OKAY.

Do you have a suggestion for the change or do we want to to the change in a later PR?

*
* @return Evaluates to list of 1s (e.g: 1,1,1,) or nothing.
*/
#define DT_ALL_INST_HAS_PROP_STATUS_OKAY_(prop) \
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

* @return Macro evaluates to `1,` if instance property value is 0,
* otherwise it evaluates to literal nothing.
*/
#define DT_ALL_INST_HAS_BOOL_STATUS_OKAY__(idx, prop) \
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

*
* @return Evaluates to list of 1s (e.g: 1,1,1,) or nothing.
*/
#define DT_ALL_INST_HAS_BOOL_STATUS_OKAY_(prop) \
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

If all instances are fixed link, remove code that is
not needed for that.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
* DT_ALL_INST_HAS_PROP_STATUS_OKAY(baz) // 0
* @endcode
*/
#define DT_ALL_INST_HAS_PROP_STATUS_OKAY(prop) \
Copy link
Member

Choose a reason for hiding this comment

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

actually maybe this would be better named as DT_ALL_INST_STATUS_OKAY_HAS_PROP

@mbolivar @rruuaanng ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I also like that a bit better, but there is already a DT_ANY_INST_HAS_PROP_STATUS_OKAY with any instead of all, that is already in main and the last release, so I prefer to have it consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants