forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/misc/uid_sys_stats.c
....@@ -14,7 +14,6 @@
1414 */
1515
1616 #include <linux/atomic.h>
17
-#include <linux/cpufreq_times.h>
1817 #include <linux/err.h>
1918 #include <linux/hashtable.h>
2019 #include <linux/init.h>
....@@ -137,7 +136,7 @@
137136
138137 /* next the executable file name */
139138 if (mm) {
140
- down_read(&mm->mmap_sem);
139
+ mmap_write_lock(mm);
141140 if (mm->exe_file) {
142141 char *pathname = d_path(&mm->exe_file->f_path, buf,
143142 unused_len);
....@@ -150,7 +149,7 @@
150149 unused_len--;
151150 }
152151 }
153
- up_read(&mm->mmap_sem);
152
+ mmap_write_unlock(mm);
154153 }
155154 unused_len -= len;
156155
....@@ -385,11 +384,11 @@
385384 return single_open(file, uid_cputime_show, PDE_DATA(inode));
386385 }
387386
388
-static const struct file_operations uid_cputime_fops = {
389
- .open = uid_cputime_open,
390
- .read = seq_read,
391
- .llseek = seq_lseek,
392
- .release = single_release,
387
+static const struct proc_ops uid_cputime_fops = {
388
+ .proc_open = uid_cputime_open,
389
+ .proc_read = seq_read,
390
+ .proc_lseek = seq_lseek,
391
+ .proc_release = single_release,
393392 };
394393
395394 static int uid_remove_open(struct inode *inode, struct file *file)
....@@ -404,8 +403,7 @@
404403 struct hlist_node *tmp;
405404 char uids[128];
406405 char *start_uid, *end_uid = NULL;
407
- uid_t uid_start = 0, uid_end = 0;
408
- u64 uid;
406
+ long int uid_start = 0, uid_end = 0;
409407
410408 if (count >= sizeof(uids))
411409 count = sizeof(uids) - 1;
....@@ -420,20 +418,17 @@
420418 if (!start_uid || !end_uid)
421419 return -EINVAL;
422420
423
- if (kstrtouint(start_uid, 10, &uid_start) != 0 ||
424
- kstrtouint(end_uid, 10, &uid_end) != 0) {
421
+ if (kstrtol(start_uid, 10, &uid_start) != 0 ||
422
+ kstrtol(end_uid, 10, &uid_end) != 0) {
425423 return -EINVAL;
426424 }
427425
428
- /* Also remove uids from /proc/uid_time_in_state */
429
- cpufreq_task_times_remove_uids(uid_start, uid_end);
430
-
431426 rt_mutex_lock(&uid_lock);
432427
433
- for (uid = uid_start; uid <= uid_end; uid++) {
428
+ for (; uid_start <= uid_end; uid_start++) {
434429 hash_for_each_possible_safe(hash_table, uid_entry, tmp,
435
- hash, uid) {
436
- if (uid == uid_entry->uid) {
430
+ hash, (uid_t)uid_start) {
431
+ if (uid_start == uid_entry->uid) {
437432 remove_uid_tasks(uid_entry);
438433 hash_del(&uid_entry->hash);
439434 kfree(uid_entry);
....@@ -445,10 +440,10 @@
445440 return count;
446441 }
447442
448
-static const struct file_operations uid_remove_fops = {
449
- .open = uid_remove_open,
450
- .release = single_release,
451
- .write = uid_remove_write,
443
+static const struct proc_ops uid_remove_fops = {
444
+ .proc_open = uid_remove_open,
445
+ .proc_release = single_release,
446
+ .proc_write = uid_remove_write,
452447 };
453448
454449
....@@ -564,11 +559,11 @@
564559 return single_open(file, uid_io_show, PDE_DATA(inode));
565560 }
566561
567
-static const struct file_operations uid_io_fops = {
568
- .open = uid_io_open,
569
- .read = seq_read,
570
- .llseek = seq_lseek,
571
- .release = single_release,
562
+static const struct proc_ops uid_io_fops = {
563
+ .proc_open = uid_io_open,
564
+ .proc_read = seq_read,
565
+ .proc_lseek = seq_lseek,
566
+ .proc_release = single_release,
572567 };
573568
574569 static int uid_procstat_open(struct inode *inode, struct file *file)
....@@ -621,10 +616,10 @@
621616 return count;
622617 }
623618
624
-static const struct file_operations uid_procstat_fops = {
625
- .open = uid_procstat_open,
626
- .release = single_release,
627
- .write = uid_procstat_write,
619
+static const struct proc_ops uid_procstat_fops = {
620
+ .proc_open = uid_procstat_open,
621
+ .proc_release = single_release,
622
+ .proc_write = uid_procstat_write,
628623 };
629624
630625 static int process_notifier(struct notifier_block *self,