diff mbox series

[leds,v2,03/10] leds: trigger: netdev: move trigger data structure to global include dir

Message ID 20210601005155.27997-4-kabel@kernel.org (mailing list archive)
State Not Applicable
Headers show
Series Add support for offloading netdev trigger to HW + example implementation for Turris Omnia | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Marek Behún June 1, 2021, 12:51 a.m. UTC
In preparation for HW offloading of netdev trigger, move struct
led_netdev_data into global include directory, into file
linux/ledtrig-netdev.h, so that drivers wanting to offload the trigger
can see the requested settings.

Signed-off-by: Marek Behún <kabel@kernel.org>
---
 drivers/leds/trigger/ledtrig-netdev.c | 23 +-----------------
 include/linux/ledtrig-netdev.h        | 34 +++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 22 deletions(-)
 create mode 100644 include/linux/ledtrig-netdev.h
diff mbox series

Patch

diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c
index 4f6b73e3b491..9a98f9c5b8d0 100644
--- a/drivers/leds/trigger/ledtrig-netdev.c
+++ b/drivers/leds/trigger/ledtrig-netdev.c
@@ -10,17 +10,16 @@ 
 //  Copyright 2005-2006 Openedhand Ltd.
 //  Author: Richard Purdie <rpurdie@openedhand.com>
 
-#include <linux/atomic.h>
 #include <linux/ctype.h>
 #include <linux/device.h>
 #include <linux/init.h>
 #include <linux/jiffies.h>
 #include <linux/kernel.h>
 #include <linux/leds.h>
+#include <linux/ledtrig-netdev.h>
 #include <linux/list.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
-#include <linux/spinlock.h>
 #include <linux/timer.h>
 #include "../leds.h"
 
@@ -36,26 +35,6 @@ 
  *
  */
 
-struct led_netdev_data {
-	spinlock_t lock;
-
-	struct delayed_work work;
-	struct notifier_block notifier;
-
-	struct led_classdev *led_cdev;
-	struct net_device *net_dev;
-
-	char device_name[IFNAMSIZ];
-	atomic_t interval;
-	unsigned int last_activity;
-
-	unsigned long mode;
-#define NETDEV_LED_LINK	0
-#define NETDEV_LED_TX	1
-#define NETDEV_LED_RX	2
-#define NETDEV_LED_MODE_LINKUP	3
-};
-
 enum netdev_led_attr {
 	NETDEV_ATTR_LINK,
 	NETDEV_ATTR_TX,
diff --git a/include/linux/ledtrig-netdev.h b/include/linux/ledtrig-netdev.h
new file mode 100644
index 000000000000..d6be039e1247
--- /dev/null
+++ b/include/linux/ledtrig-netdev.h
@@ -0,0 +1,34 @@ 
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * LED trigger shared structures
+ */
+
+#ifndef __LINUX_LEDTRIG_NETDEV_H__
+#define __LINUX_LEDTRIG_NETDEV_H__
+
+#include <linux/atomic.h>
+#include <linux/leds.h>
+#include <linux/netdevice.h>
+#include <linux/spinlock.h>
+
+struct led_netdev_data {
+	spinlock_t lock;
+
+	struct delayed_work work;
+	struct notifier_block notifier;
+
+	struct led_classdev *led_cdev;
+	struct net_device *net_dev;
+
+	char device_name[IFNAMSIZ];
+	atomic_t interval;
+	unsigned int last_activity;
+
+	unsigned long mode;
+#define NETDEV_LED_LINK		0
+#define NETDEV_LED_TX		1
+#define NETDEV_LED_RX		2
+#define NETDEV_LED_MODE_LINKUP	3
+};
+
+#endif /* __LINUX_LEDTRIG_NETDEV_H__ */