[LEDE-DEV] [PATCH 2/7] ag71xx: add method to count ag71xx probes

Rosen Penev rosenp at gmail.com
Thu Dec 7 18:37:12 PST 2017


This patch is preparation for ag71xx usage of external, on-die
resources.  Since these resources are limited, we need to track how
many instances we have probed.

Signed-off-by: Ben Menchaca <ben.menchaca at qca.qualcomm.com>
Signed-off-by: Rosen Penev <rosenp at gmail.com
---
 target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h | 1 +
 .../ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c     | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
index f9ef17d..c39beaf 100644
--- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
+++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
@@ -172,6 +172,7 @@ struct ag71xx {
 	/* Serialises access to regs */
 	spinlock_t		lock;
 	struct napi_struct	napi;
+	unsigned int		gmac_num;
 
 	/*
 	 * From this point onwards we're not looking at per-packet fields.
diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
index 566e951..7760952 100644
--- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
+++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
@@ -13,6 +13,8 @@
 
 #include "ag71xx.h"
 
+static int ag71xx_gmac_num = 0;
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
 static inline void skb_free_frag(void *data)
 {
@@ -1301,6 +1303,7 @@ static int ag71xx_probe(struct platform_device *pdev)
 	ag->dev = dev;
 	ag->msg_enable = netif_msg_init(ag71xx_msg_level,
 					AG71XX_DEFAULT_MSG_ENABLE);
+	ag->gmac_num = ag71xx_gmac_num++;
 	spin_lock_init(&ag->lock);
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mac_base");
-- 
2.7.4




More information about the Lede-dev mailing list