- Timestamp:
- 05/08/14 01:24:05 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ksyslog/trunk/ksyslog.c
r269 r270 22 22 static struct socket *ksyslog_rcv_sk = NULL; 23 23 24 static struct delayed_work __percpu *ksyslog_work = NULL;24 static struct delayed_work ksyslog_work; 25 25 static struct workqueue_struct *ksyslog_wq = NULL; 26 26 … … 297 297 298 298 static void 299 ksyslog_work_register_cpu(int cpu, struct delayed_work *work, unsigned long timer)300 {301 queue_delayed_work_on(cpu, ksyslog_wq, work, timer * HZ / 1000);302 }303 304 static void305 299 ksyslog_work_register(unsigned long timer) 306 300 { 307 int cpu; 308 309 for_each_possible_cpu(cpu) 310 ksyslog_work_register_cpu(cpu, per_cpu_ptr(ksyslog_work, cpu), timer); 301 queue_delayed_work(ksyslog_wq, &ksyslog_work, timer * HZ / 1000); 311 302 } 312 303 … … 314 305 ksyslog_work_unregister(void) 315 306 { 316 int cpu; 317 318 for_each_possible_cpu(cpu) 319 cancel_delayed_work_sync(per_cpu_ptr(ksyslog_work, cpu)); 307 cancel_delayed_work_sync(&ksyslog_work); 320 308 } 321 309 … … 360 348 361 349 out: 362 ksyslog_work_register_cpu(smp_processor_id(), 363 per_cpu_ptr(ksyslog_work, smp_processor_id()), 364 ksyslog_flush_interval); 350 ksyslog_work_register(ksyslog_flush_interval); 365 351 } 366 352 … … 631 617 ksyslog_rcv_sk = NULL; 632 618 633 if (ksyslog_w ork) {619 if (ksyslog_wq) { 634 620 ksyslog_work_unregister(); 635 free_percpu(ksyslog_work);636 }637 ksyslog_work = NULL;638 639 if (ksyslog_wq)640 621 destroy_workqueue(ksyslog_wq); 622 } 641 623 ksyslog_wq = NULL; 642 624 … … 654 636 ksyslog_init(void) 655 637 { 656 int cpu,err;638 int err; 657 639 struct sockaddr_in sin; 658 640 … … 674 656 } 675 657 676 ksyslog_work = alloc_percpu(struct delayed_work); 677 if (!ksyslog_work) { 678 pr_err("ksyslog: alloc_percpu(ksyslog_work) failed\n"); 679 err = -ENOMEM; 680 goto err; 681 } 682 for_each_possible_cpu(cpu) 683 INIT_DELAYED_WORK(per_cpu_ptr(ksyslog_work, cpu), ksyslog_work_handler); 658 INIT_DELAYED_WORK(&ksyslog_work, ksyslog_work_handler); 684 659 685 660 err = sock_create(AF_INET, SOCK_DGRAM, 0, &ksyslog_rcv_sk);
Note: See TracChangeset
for help on using the changeset viewer.