summaryrefslogtreecommitdiff
path: root/include/linux/linkmode.h
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2018-09-30 00:04:16 +0300
committerDavid S. Miller <davem@davemloft.net>2018-10-02 08:55:36 +0300
commit719655a149715f26fc4de904fe0aa83068bd5b9e (patch)
treedbdfdb37ec1f5ea39fe6f26215dbaabc6bb40d8d /include/linux/linkmode.h
parentd0939c26c53a2b2cecfbe6953858a58abb0158c7 (diff)
downloadlinux-719655a149715f26fc4de904fe0aa83068bd5b9e.tar.xz
net: phy: Replace phy driver features u32 with link_mode bitmap
This is one step in allowing phylib to make use of link_mode bitmaps, instead of u32 for supported and advertised features. Convert the phy drivers to use bitmaps to indicates the features they support. Build bitmap equivalents of the u32 values at runtime, and have the drivers point to the appropriate bitmap. These bitmaps are shared, and we don't want a driver to modify them. So mark them __ro_after_init. Within phylib, the features bitmap is currently turned back into a u32. This will be removed once the whole of phylib, and the drivers are converted to use bitmaps. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/linkmode.h')
-rw-r--r--include/linux/linkmode.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/linkmode.h b/include/linux/linkmode.h
index 014fb86c7114..22443d7fb5cd 100644
--- a/include/linux/linkmode.h
+++ b/include/linux/linkmode.h
@@ -43,6 +43,15 @@ static inline void linkmode_set_bit(int nr, volatile unsigned long *addr)
__set_bit(nr, addr);
}
+static inline void linkmode_set_bit_array(const int *array, int array_size,
+ unsigned long *addr)
+{
+ int i;
+
+ for (i = 0; i < array_size; i++)
+ linkmode_set_bit(array[i], addr);
+}
+
static inline void linkmode_clear_bit(int nr, volatile unsigned long *addr)
{
__clear_bit(nr, addr);