Skip to contentSkip to conversation

mdio: Export mdio.h to userland

PATCH Superseded Ben Hutchings 2 participants 7 messages Feb 29, 2012

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mdio: Export mdio.h to userland

The ID packing/unpacking functions are needed by userland and the register definitions may also be useful there.

---
 include/linux/Kbuild |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/linux/Kbuild +1 -0
index c94e717..4b0b7ed 100644
@@ -238,6 +238,7 @@ header-y += magic.h
 header-y += major.h
 header-y += map_to_7segment.h
 header-y += matroxfb.h
+header-y += mdio.h
 header-y += media.h
 header-y += mempolicy.h
 header-y += meye.h
Signature · 7 lines
1.7.7.6


-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#1 lore raw
Quoted 2 lines · Ben Hutchings

The ID packing/unpacking functions are needed by userland and the register definitions may also be useful there.

Minor issue with this: mdio_phy_id_is_c45() returns bool, and that's not defined by default. Should I add #include <stdbool.h> or change the return type to int for maximum compatibility?

Ben.

Quoted 21 lines
---
 include/linux/Kbuild |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/linux/Kbuild +1 -0
index c94e717..4b0b7ed 100644
@@ -238,6 +238,7 @@ header-y += magic.h
 header-y += major.h
 header-y += map_to_7segment.h
 header-y += matroxfb.h
+header-y += mdio.h
 header-y += media.h
 header-y += mempolicy.h
 header-y += meye.h
Signature · 1 line
1.7.7.6
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
maintainer
#2 lore raw

From: Ben Hutchings <[email protected]>
Date: Wed, 29 Feb 2012 19:12:34 +0000

Quoted 7 lines · Ben Hutchings
Quoted 2 lines

The ID packing/unpacking functions are needed by userland and the register definitions may also be useful there.

Minor issue with this: mdio_phy_id_is_c45() returns bool, and that's not defined by default. Should I add #include <stdbool.h> or change the return type to int for maximum compatibility?

I do not see any precedence for including stdbool.h in a kernel header file. And I sure as hell am not going to compromise using a correct type just to make this usable by userspace.

I think this is of dubious value, and combined with the bool complication I'm not going to apply this, sorry.

#3 lore raw
Quoted 11 lines · David Miller

From: Ben Hutchings <[email protected]>
Date: Wed, 29 Feb 2012 19:12:34 +0000

Quoted 7 lines · Ben Hutchings
Quoted 2 lines

The ID packing/unpacking functions are needed by userland and the register definitions may also be useful there.

Minor issue with this: mdio_phy_id_is_c45() returns bool, and that's not defined by default. Should I add #include <stdbool.h> or change the return type to int for maximum compatibility?

Quoted 6 lines

I do not see any precedence for including stdbool.h in a kernel header file. And I sure as hell am not going to compromise using a correct type just to make this usable by userspace.

I think this is of dubious value, and combined with the bool complication I'm not going to apply this, sorry.

Without this, userland doing clause 45 MDIO has to duplicate the ID
packing definitions. I intended to export these to userland in the
first place; that's why the header already has an #ifdef __KERNEL__. I was about to get rid of the duplicate definitions in our utilities when I realised I hadn't exported them.

Ben.

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
maintainer
#4 lore raw

From: Ben Hutchings <[email protected]>
Date: Wed, 29 Feb 2012 22:43:48 +0000

Quoted 16 lines · David Miller
Quoted 15 lines

From: Ben Hutchings <[email protected]>
Date: Wed, 29 Feb 2012 19:12:34 +0000

Quoted 7 lines · Ben Hutchings
Quoted 2 lines

The ID packing/unpacking functions are needed by userland and the register definitions may also be useful there.

Minor issue with this: mdio_phy_id_is_c45() returns bool, and that's not defined by default. Should I add #include <stdbool.h> or change the return type to int for maximum compatibility?

I do not see any precedence for including stdbool.h in a kernel header file. And I sure as hell am not going to compromise using a correct type just to make this usable by userspace.

Quoted 5 lines
Quoted 2 lines

I think this is of dubious value, and combined with the bool complication I'm not going to apply this, sorry.

Without this, userland doing clause 45 MDIO has to duplicate the ID packing definitions.

Then come up with a real solution to the bool issue.

But note that changing the bool to an int is not a solution, neither is #include <stdbool.h> unless we can reach consensus on lkml that this is OK.

#5 lore raw
Quoted 22 lines · David Miller

From: Ben Hutchings <[email protected]>
Date: Wed, 29 Feb 2012 22:43:48 +0000

Quoted 19 lines · David Miller
Quoted 17 lines

From: Ben Hutchings <[email protected]>
Date: Wed, 29 Feb 2012 19:12:34 +0000

Quoted 7 lines · Ben Hutchings
Quoted 2 lines

The ID packing/unpacking functions are needed by userland and the register definitions may also be useful there.

Minor issue with this: mdio_phy_id_is_c45() returns bool, and that's not defined by default. Should I add #include <stdbool.h> or change the return type to int for maximum compatibility?

I do not see any precedence for including stdbool.h in a kernel header file. And I sure as hell am not going to compromise using a correct type just to make this usable by userspace.

I think this is of dubious value, and combined with the bool complication I'm not going to apply this, sorry.

Quoted 8 lines
Quoted 2 lines

Without this, userland doing clause 45 MDIO has to duplicate the ID packing definitions.

Then come up with a real solution to the bool issue.

But note that changing the bool to an int is not a solution, neither is #include <stdbool.h> unless we can reach consensus on lkml that this is OK.

I could just move the mdio_phy_id_is_c45(), mdio_phy_id_prtad(), mdio_phy_id_devad() functions inside #ifdef __KERNEL__ since userland shouldn't need to unpack PHY IDs.

Ben.

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
maintainer
#6 lore raw

From: Ben Hutchings <[email protected]>
Date: Wed, 29 Feb 2012 23:09:52 +0000

Quoted 3 lines

I could just move the mdio_phy_id_is_c45(), mdio_phy_id_prtad(), mdio_phy_id_devad() functions inside #ifdef __KERNEL__ since userland shouldn't need to unpack PHY IDs.

That would work too.