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.

drm/v3d: Add some local variables in queries/extensions

Add some local variables to make the code a bit less verbose, with the
main benefit being pulling some lines to under 80 columns wide.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Reviewed-by: Maíra Canal <mcanal@igalia.com>
Signed-off-by: Maíra Canal <mcanal@igalia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240711135340.84617-12-tursulin@igalia.com

authored by

Tvrtko Ursulin and committed by
Maíra Canal
c48abf09 96bc9049

+49 -39
+49 -39
drivers/gpu/drm/v3d/v3d_submit.c
··· 452 452 { 453 453 u32 __user *offsets, *syncs; 454 454 struct drm_v3d_timestamp_query timestamp; 455 + struct v3d_timestamp_query_info *query_info = &job->timestamp_query; 455 456 unsigned int i; 456 457 int err; 457 458 ··· 474 473 475 474 job->job_type = V3D_CPU_JOB_TYPE_TIMESTAMP_QUERY; 476 475 477 - job->timestamp_query.queries = kvmalloc_array(timestamp.count, 478 - sizeof(struct v3d_timestamp_query), 479 - GFP_KERNEL); 480 - if (!job->timestamp_query.queries) 476 + query_info->queries = kvmalloc_array(timestamp.count, 477 + sizeof(struct v3d_timestamp_query), 478 + GFP_KERNEL); 479 + if (!query_info->queries) 481 480 return -ENOMEM; 482 481 483 482 offsets = u64_to_user_ptr(timestamp.offsets); ··· 491 490 goto error; 492 491 } 493 492 494 - job->timestamp_query.queries[i].offset = offset; 493 + query_info->queries[i].offset = offset; 495 494 496 495 if (get_user(sync, syncs++)) { 497 496 err = -EFAULT; 498 497 goto error; 499 498 } 500 499 501 - job->timestamp_query.queries[i].syncobj = drm_syncobj_find(file_priv, sync); 502 - if (!job->timestamp_query.queries[i].syncobj) { 500 + query_info->queries[i].syncobj = drm_syncobj_find(file_priv, 501 + sync); 502 + if (!query_info->queries[i].syncobj) { 503 503 err = -ENOENT; 504 504 goto error; 505 505 } 506 506 } 507 - job->timestamp_query.count = timestamp.count; 507 + query_info->count = timestamp.count; 508 508 509 509 return 0; 510 510 ··· 521 519 { 522 520 u32 __user *syncs; 523 521 struct drm_v3d_reset_timestamp_query reset; 522 + struct v3d_timestamp_query_info *query_info = &job->timestamp_query; 524 523 unsigned int i; 525 524 int err; 526 525 ··· 540 537 541 538 job->job_type = V3D_CPU_JOB_TYPE_RESET_TIMESTAMP_QUERY; 542 539 543 - job->timestamp_query.queries = kvmalloc_array(reset.count, 544 - sizeof(struct v3d_timestamp_query), 545 - GFP_KERNEL); 546 - if (!job->timestamp_query.queries) 540 + query_info->queries = kvmalloc_array(reset.count, 541 + sizeof(struct v3d_timestamp_query), 542 + GFP_KERNEL); 543 + if (!query_info->queries) 547 544 return -ENOMEM; 548 545 549 546 syncs = u64_to_user_ptr(reset.syncs); ··· 551 548 for (i = 0; i < reset.count; i++) { 552 549 u32 sync; 553 550 554 - job->timestamp_query.queries[i].offset = reset.offset + 8 * i; 551 + query_info->queries[i].offset = reset.offset + 8 * i; 555 552 556 553 if (get_user(sync, syncs++)) { 557 554 err = -EFAULT; 558 555 goto error; 559 556 } 560 557 561 - job->timestamp_query.queries[i].syncobj = drm_syncobj_find(file_priv, sync); 562 - if (!job->timestamp_query.queries[i].syncobj) { 558 + query_info->queries[i].syncobj = drm_syncobj_find(file_priv, 559 + sync); 560 + if (!query_info->queries[i].syncobj) { 563 561 err = -ENOENT; 564 562 goto error; 565 563 } 566 564 } 567 - job->timestamp_query.count = reset.count; 565 + query_info->count = reset.count; 568 566 569 567 return 0; 570 568 ··· 582 578 { 583 579 u32 __user *offsets, *syncs; 584 580 struct drm_v3d_copy_timestamp_query copy; 581 + struct v3d_timestamp_query_info *query_info = &job->timestamp_query; 585 582 unsigned int i; 586 583 int err; 587 584 ··· 604 599 605 600 job->job_type = V3D_CPU_JOB_TYPE_COPY_TIMESTAMP_QUERY; 606 601 607 - job->timestamp_query.queries = kvmalloc_array(copy.count, 608 - sizeof(struct v3d_timestamp_query), 609 - GFP_KERNEL); 610 - if (!job->timestamp_query.queries) 602 + query_info->queries = kvmalloc_array(copy.count, 603 + sizeof(struct v3d_timestamp_query), 604 + GFP_KERNEL); 605 + if (!query_info->queries) 611 606 return -ENOMEM; 612 607 613 608 offsets = u64_to_user_ptr(copy.offsets); ··· 621 616 goto error; 622 617 } 623 618 624 - job->timestamp_query.queries[i].offset = offset; 619 + query_info->queries[i].offset = offset; 625 620 626 621 if (get_user(sync, syncs++)) { 627 622 err = -EFAULT; 628 623 goto error; 629 624 } 630 625 631 - job->timestamp_query.queries[i].syncobj = drm_syncobj_find(file_priv, sync); 632 - if (!job->timestamp_query.queries[i].syncobj) { 626 + query_info->queries[i].syncobj = drm_syncobj_find(file_priv, 627 + sync); 628 + if (!query_info->queries[i].syncobj) { 633 629 err = -ENOENT; 634 630 goto error; 635 631 } 636 632 } 637 - job->timestamp_query.count = copy.count; 633 + query_info->count = copy.count; 638 634 639 635 job->copy.do_64bit = copy.do_64bit; 640 636 job->copy.do_partial = copy.do_partial; ··· 718 712 struct drm_v3d_extension __user *ext, 719 713 struct v3d_cpu_job *job) 720 714 { 715 + struct v3d_performance_query_info *query_info = &job->performance_query; 721 716 struct drm_v3d_reset_performance_query reset; 722 717 int err; 723 718 ··· 737 730 738 731 job->job_type = V3D_CPU_JOB_TYPE_RESET_PERFORMANCE_QUERY; 739 732 740 - job->performance_query.queries = kvmalloc_array(reset.count, 741 - sizeof(struct v3d_performance_query), 742 - GFP_KERNEL); 743 - if (!job->performance_query.queries) 733 + query_info->queries = 734 + kvmalloc_array(reset.count, 735 + sizeof(struct v3d_performance_query), 736 + GFP_KERNEL); 737 + if (!query_info->queries) 744 738 return -ENOMEM; 745 739 746 - err = v3d_copy_query_info(&job->performance_query, 740 + err = v3d_copy_query_info(query_info, 747 741 reset.count, 748 742 reset.nperfmons, 749 743 u64_to_user_ptr(reset.syncs), ··· 753 745 if (err) 754 746 return err; 755 747 756 - job->performance_query.count = reset.count; 757 - job->performance_query.nperfmons = reset.nperfmons; 748 + query_info->count = reset.count; 749 + query_info->nperfmons = reset.nperfmons; 758 750 759 751 return 0; 760 752 } ··· 764 756 struct drm_v3d_extension __user *ext, 765 757 struct v3d_cpu_job *job) 766 758 { 759 + struct v3d_performance_query_info *query_info = &job->performance_query; 767 760 struct drm_v3d_copy_performance_query copy; 768 761 int err; 769 762 ··· 786 777 787 778 job->job_type = V3D_CPU_JOB_TYPE_COPY_PERFORMANCE_QUERY; 788 779 789 - job->performance_query.queries = kvmalloc_array(copy.count, 790 - sizeof(struct v3d_performance_query), 791 - GFP_KERNEL); 792 - if (!job->performance_query.queries) 780 + query_info->queries = 781 + kvmalloc_array(copy.count, 782 + sizeof(struct v3d_performance_query), 783 + GFP_KERNEL); 784 + if (!query_info->queries) 793 785 return -ENOMEM; 794 786 795 - err = v3d_copy_query_info(&job->performance_query, 787 + err = v3d_copy_query_info(query_info, 796 788 copy.count, 797 789 copy.nperfmons, 798 790 u64_to_user_ptr(copy.syncs), ··· 802 792 if (err) 803 793 return err; 804 794 805 - job->performance_query.count = copy.count; 806 - job->performance_query.nperfmons = copy.nperfmons; 807 - job->performance_query.ncounters = copy.ncounters; 795 + query_info->count = copy.count; 796 + query_info->nperfmons = copy.nperfmons; 797 + query_info->ncounters = copy.ncounters; 808 798 809 799 job->copy.do_64bit = copy.do_64bit; 810 800 job->copy.do_partial = copy.do_partial;