net: phy: add macros for PHYID matching
authorHeiner Kallweit <hkallweit1@gmail.com>
Fri, 9 Nov 2018 23:39:14 +0000 (00:39 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 11 Nov 2018 17:44:14 +0000 (09:44 -0800)
Add macros for PHYID matching to be used in PHY driver configs.
By using these macros some boilerplate code can be avoided.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/phy.h

index 17d1f64723e48af14c93b37ae2777c2bd2d49d27..03005c65e02de1607e1e8c0928f122ae55fa5c3b 100644 (file)
@@ -651,6 +651,10 @@ struct phy_driver {
 #define PHY_ANY_ID "MATCH ANY PHY"
 #define PHY_ANY_UID 0xffffffff
 
+#define PHY_ID_MATCH_EXACT(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 0)
+#define PHY_ID_MATCH_MODEL(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 4)
+#define PHY_ID_MATCH_VENDOR(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 10)
+
 /* A Structure for boards to register fixups with the PHY Lib */
 struct phy_fixup {
        struct list_head list;