hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/misc/nkio/nk_io_core.c
....@@ -13,6 +13,7 @@
1313 #include <linux/string.h>
1414 #include <linux/uaccess.h>
1515 #include <linux/device.h>
16
+#include <linux/proc_fs.h>
1617
1718 #define GPIO_FUNCTION_OUTPUT 0
1819 #define GPIO_FUNCTION_INPUT 1
....@@ -20,7 +21,7 @@
2021 #define HIGH "1"
2122 #define LOW "0"
2223
23
-static int flash_flag = 0;
24
+//static int flash_flag = 0;
2425
2526 struct ndj_gpio {
2627 int gpio_num; //gpio num
....@@ -94,7 +95,7 @@
9495 };
9596
9697 #endif
97
-static int event_flag = 0;
98
+//static int event_flag = 0;
9899 static int open_now = 0;
99100 static char* file_name = NULL;
100101
....@@ -152,26 +153,21 @@
152153 }
153154
154155
155
-static const struct file_operations gpio_ops = {
156
- .owner = THIS_MODULE,
157
- .open = gpio_open,
158
- .write = gpio_write,
159
- .read = gpio_read,
156
+static const struct proc_ops gpio_ops = {
157
+ .proc_open = gpio_open,
158
+ .proc_write = gpio_write,
159
+ .proc_read = gpio_read,
160160 };
161161
162162 static int ndj_gpio_probe(struct platform_device *pdev) {
163163 struct device_node *np = pdev->dev.of_node;
164164 struct device_node *child_np;
165
- struct device *dev = &pdev->dev;
166165 static struct proc_dir_entry *root_entry_gpio;
167166 enum of_gpio_flags gpio_flags;
168167 int ret = 0;
169168 int gpio_cnt = 0;
170169 char gpio_name_num[20];
171170 int gpio_in_cnt = 0;
172
- int cnt =0;
173
- int i=0;
174
- enum of_gpio_flags flags;
175171
176172 gpio_data = devm_kzalloc(&pdev->dev, sizeof(struct ndj_gpio_data),GFP_KERNEL);
177173 if (!gpio_data) {
....@@ -286,15 +282,15 @@
286282
287283 static int ndj_gpio_suspend(struct platform_device *pdev, pm_message_t state)
288284 {
289
- int ret;
290
- struct nk_io_pdata *pdata;
285
+// int ret;
286
+// struct nk_io_pdata *pdata;
291287 printk("nk_suspend !!!!\n");
292288 return 0;
293289 }
294290
295291 static int ndj_gpio_resume(struct platform_device *pdev)
296292 {
297
- int ret,reset_pin;
293
+// int ret,reset_pin;
298294 printk("nk_io resume !!!!\n");
299295 return 0;
300296 }
....@@ -325,4 +321,4 @@
325321
326322 module_platform_driver(ndj_gpio_driver);
327323 MODULE_LICENSE("GPL");
328
-MODULE_LICENSE("GPL");
324
+MODULE_LICENSE("GPL");