Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sysctl: Remove superfluous tbl_data param from "dovec" functions

Remove superfluous tbl_data param from do_proc_douintvec{,_r,_w}
and __do_proc_do{intvec,uintvec,ulongvec_minmax}. There is no need to
pass it as it is always contained within the ctl_table struct.

Signed-off-by: Joel Granados <joel.granados@kernel.org>

+26 -35
+26 -35
kernel/sysctl.c
··· 398 398 399 399 static const char proc_wspace_sep[] = { ' ', '\t', '\n' }; 400 400 401 - static int __do_proc_dointvec(void *tbl_data, const struct ctl_table *table, 402 - int write, void *buffer, 403 - size_t *lenp, loff_t *ppos, 404 - int (*conv)(bool *negp, unsigned long *lvalp, int *valp, 405 - int write, const struct ctl_table *table)) 401 + static int __do_proc_dointvec(const struct ctl_table *table, int write, 402 + void *buffer, size_t *lenp, loff_t *ppos, 403 + int (*conv)(bool *negp, unsigned long *lvalp, 404 + int *valp, int write, 405 + const struct ctl_table *table)) 406 406 { 407 407 int *i, vleft, first = 1, err = 0; 408 408 size_t left; 409 409 char *p; 410 410 411 - if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) { 411 + if (!table->data || !table->maxlen || !*lenp || (*ppos && !write)) { 412 412 *lenp = 0; 413 413 return 0; 414 414 } 415 415 416 - i = (int *) tbl_data; 416 + i = (int *) table->data; 417 417 vleft = table->maxlen / sizeof(*i); 418 418 left = *lenp; 419 419 ··· 475 475 int (*conv)(bool *negp, unsigned long *lvalp, int *valp, 476 476 int write, const struct ctl_table *table)) 477 477 { 478 - return __do_proc_dointvec(table->data, table, write, 479 - buffer, lenp, ppos, conv); 478 + return __do_proc_dointvec(table, write, buffer, lenp, ppos, conv); 480 479 } 481 480 482 - static int do_proc_douintvec_w(unsigned int *tbl_data, 483 - const struct ctl_table *table, 484 - void *buffer, 481 + static int do_proc_douintvec_w(const struct ctl_table *table, void *buffer, 485 482 size_t *lenp, loff_t *ppos, 486 483 int (*conv)(unsigned long *lvalp, 487 484 unsigned int *valp, int write, ··· 512 515 goto out_free; 513 516 } 514 517 515 - if (conv(&lval, tbl_data, 1, table)) { 518 + if (conv(&lval, (unsigned int *) table->data, 1, table)) { 516 519 err = -EINVAL; 517 520 goto out_free; 518 521 } ··· 532 535 return err; 533 536 } 534 537 535 - static int do_proc_douintvec_r(unsigned int *tbl_data, 536 - const struct ctl_table *table, void *buffer, 538 + static int do_proc_douintvec_r(const struct ctl_table *table, void *buffer, 537 539 size_t *lenp, loff_t *ppos, 538 540 int (*conv)(unsigned long *lvalp, 539 541 unsigned int *valp, int write, ··· 544 548 545 549 left = *lenp; 546 550 547 - if (conv(&lval, tbl_data, 0, table)) { 551 + if (conv(&lval, (unsigned int *) table->data, 0, table)) { 548 552 err = -EINVAL; 549 553 goto out; 550 554 } ··· 562 566 return err; 563 567 } 564 568 565 - static int __do_proc_douintvec(void *tbl_data, const struct ctl_table *table, 566 - int write, void *buffer, 567 - size_t *lenp, loff_t *ppos, 569 + static int __do_proc_douintvec(const struct ctl_table *table, int write, 570 + void *buffer, size_t *lenp, loff_t *ppos, 568 571 int (*conv)(unsigned long *lvalp, 569 572 unsigned int *valp, int write, 570 573 const struct ctl_table *table)) 571 574 { 572 - unsigned int *i, vleft; 575 + unsigned int vleft; 573 576 574 - if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) { 577 + if (!table->data || !table->maxlen || !*lenp || (*ppos && !write)) { 575 578 *lenp = 0; 576 579 return 0; 577 580 } 578 581 579 - i = (unsigned int *) tbl_data; 580 - vleft = table->maxlen / sizeof(*i); 582 + vleft = table->maxlen / sizeof(unsigned int); 581 583 582 584 /* 583 585 * Arrays are not supported, keep this simple. *Do not* add ··· 590 596 conv = do_proc_douintvec_conv; 591 597 592 598 if (write) 593 - return do_proc_douintvec_w(i, table, buffer, lenp, ppos, 594 - conv); 595 - return do_proc_douintvec_r(i, table, buffer, lenp, ppos, conv); 599 + return do_proc_douintvec_w(table, buffer, lenp, ppos, conv); 600 + return do_proc_douintvec_r(table, buffer, lenp, ppos, conv); 596 601 } 597 602 598 603 int do_proc_douintvec(const struct ctl_table *table, int write, ··· 600 607 unsigned int *valp, int write, 601 608 const struct ctl_table *table)) 602 609 { 603 - return __do_proc_douintvec(table->data, table, write, buffer, lenp, 604 - ppos, conv); 610 + return __do_proc_douintvec(table, write, buffer, lenp, ppos, conv); 605 611 } 606 612 607 613 /** ··· 831 839 } 832 840 EXPORT_SYMBOL_GPL(proc_dou8vec_minmax); 833 841 834 - static int __do_proc_doulongvec_minmax(void *data, 835 - const struct ctl_table *table, int write, 836 - void *buffer, size_t *lenp, loff_t *ppos, 842 + static int __do_proc_doulongvec_minmax(const struct ctl_table *table, 843 + int write, void *buffer, size_t *lenp, loff_t *ppos, 837 844 unsigned long convmul, unsigned long convdiv) 838 845 { 839 846 unsigned long *i, *min, *max; ··· 840 849 size_t left; 841 850 char *p; 842 851 843 - if (!data || !table->maxlen || !*lenp || (*ppos && !write)) { 852 + if (!table->data || !table->maxlen || !*lenp || (*ppos && !write)) { 844 853 *lenp = 0; 845 854 return 0; 846 855 } 847 856 848 - i = data; 857 + i = table->data; 849 858 min = table->extra1; 850 859 max = table->extra2; 851 860 vleft = table->maxlen / sizeof(unsigned long); ··· 908 917 void *buffer, size_t *lenp, loff_t *ppos, unsigned long convmul, 909 918 unsigned long convdiv) 910 919 { 911 - return __do_proc_doulongvec_minmax(table->data, table, write, 912 - buffer, lenp, ppos, convmul, convdiv); 920 + return __do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 921 + convmul, convdiv); 913 922 } 914 923 915 924 /**