| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * c 2001 PPC 64 Team, IBM Corp |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or |
|---|
| 5 | | - * modify it under the terms of the GNU General Public License |
|---|
| 6 | | - * as published by the Free Software Foundation; either version |
|---|
| 7 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 8 | 4 | * |
|---|
| 9 | 5 | * /proc/powerpc/rtas/firmware_flash interface |
|---|
| 10 | 6 | * |
|---|
| .. | .. |
|---|
| 523 | 519 | args_buf->status = VALIDATE_INCOMPLETE; |
|---|
| 524 | 520 | } |
|---|
| 525 | 521 | |
|---|
| 526 | | - if (!access_ok(VERIFY_READ, buf, count)) { |
|---|
| 522 | + if (!access_ok(buf, count)) { |
|---|
| 527 | 523 | rc = -EFAULT; |
|---|
| 528 | 524 | goto done; |
|---|
| 529 | 525 | } |
|---|
| .. | .. |
|---|
| 659 | 655 | const char *filename; |
|---|
| 660 | 656 | const char *rtas_call_name; |
|---|
| 661 | 657 | int *status; |
|---|
| 662 | | - const struct file_operations fops; |
|---|
| 658 | + const struct proc_ops ops; |
|---|
| 663 | 659 | }; |
|---|
| 664 | 660 | |
|---|
| 665 | 661 | static const struct rtas_flash_file rtas_flash_files[] = { |
|---|
| .. | .. |
|---|
| 667 | 663 | .filename = "powerpc/rtas/" FIRMWARE_FLASH_NAME, |
|---|
| 668 | 664 | .rtas_call_name = "ibm,update-flash-64-and-reboot", |
|---|
| 669 | 665 | .status = &rtas_update_flash_data.status, |
|---|
| 670 | | - .fops.read = rtas_flash_read_msg, |
|---|
| 671 | | - .fops.write = rtas_flash_write, |
|---|
| 672 | | - .fops.release = rtas_flash_release, |
|---|
| 673 | | - .fops.llseek = default_llseek, |
|---|
| 666 | + .ops.proc_read = rtas_flash_read_msg, |
|---|
| 667 | + .ops.proc_write = rtas_flash_write, |
|---|
| 668 | + .ops.proc_release = rtas_flash_release, |
|---|
| 669 | + .ops.proc_lseek = default_llseek, |
|---|
| 674 | 670 | }, |
|---|
| 675 | 671 | { |
|---|
| 676 | 672 | .filename = "powerpc/rtas/" FIRMWARE_UPDATE_NAME, |
|---|
| 677 | 673 | .rtas_call_name = "ibm,update-flash-64-and-reboot", |
|---|
| 678 | 674 | .status = &rtas_update_flash_data.status, |
|---|
| 679 | | - .fops.read = rtas_flash_read_num, |
|---|
| 680 | | - .fops.write = rtas_flash_write, |
|---|
| 681 | | - .fops.release = rtas_flash_release, |
|---|
| 682 | | - .fops.llseek = default_llseek, |
|---|
| 675 | + .ops.proc_read = rtas_flash_read_num, |
|---|
| 676 | + .ops.proc_write = rtas_flash_write, |
|---|
| 677 | + .ops.proc_release = rtas_flash_release, |
|---|
| 678 | + .ops.proc_lseek = default_llseek, |
|---|
| 683 | 679 | }, |
|---|
| 684 | 680 | { |
|---|
| 685 | 681 | .filename = "powerpc/rtas/" VALIDATE_FLASH_NAME, |
|---|
| 686 | 682 | .rtas_call_name = "ibm,validate-flash-image", |
|---|
| 687 | 683 | .status = &rtas_validate_flash_data.status, |
|---|
| 688 | | - .fops.read = validate_flash_read, |
|---|
| 689 | | - .fops.write = validate_flash_write, |
|---|
| 690 | | - .fops.release = validate_flash_release, |
|---|
| 691 | | - .fops.llseek = default_llseek, |
|---|
| 684 | + .ops.proc_read = validate_flash_read, |
|---|
| 685 | + .ops.proc_write = validate_flash_write, |
|---|
| 686 | + .ops.proc_release = validate_flash_release, |
|---|
| 687 | + .ops.proc_lseek = default_llseek, |
|---|
| 692 | 688 | }, |
|---|
| 693 | 689 | { |
|---|
| 694 | 690 | .filename = "powerpc/rtas/" MANAGE_FLASH_NAME, |
|---|
| 695 | 691 | .rtas_call_name = "ibm,manage-flash-image", |
|---|
| 696 | 692 | .status = &rtas_manage_flash_data.status, |
|---|
| 697 | | - .fops.read = manage_flash_read, |
|---|
| 698 | | - .fops.write = manage_flash_write, |
|---|
| 699 | | - .fops.llseek = default_llseek, |
|---|
| 693 | + .ops.proc_read = manage_flash_read, |
|---|
| 694 | + .ops.proc_write = manage_flash_write, |
|---|
| 695 | + .ops.proc_lseek = default_llseek, |
|---|
| 700 | 696 | } |
|---|
| 701 | 697 | }; |
|---|
| 702 | 698 | |
|---|
| .. | .. |
|---|
| 714 | 710 | if (!rtas_validate_flash_data.buf) |
|---|
| 715 | 711 | return -ENOMEM; |
|---|
| 716 | 712 | |
|---|
| 717 | | - flash_block_cache = kmem_cache_create("rtas_flash_cache", |
|---|
| 718 | | - RTAS_BLK_SIZE, RTAS_BLK_SIZE, 0, |
|---|
| 719 | | - NULL); |
|---|
| 713 | + flash_block_cache = kmem_cache_create_usercopy("rtas_flash_cache", |
|---|
| 714 | + RTAS_BLK_SIZE, RTAS_BLK_SIZE, |
|---|
| 715 | + 0, 0, RTAS_BLK_SIZE, NULL); |
|---|
| 720 | 716 | if (!flash_block_cache) { |
|---|
| 721 | 717 | printk(KERN_ERR "%s: failed to create block cache\n", |
|---|
| 722 | 718 | __func__); |
|---|
| .. | .. |
|---|
| 727 | 723 | const struct rtas_flash_file *f = &rtas_flash_files[i]; |
|---|
| 728 | 724 | int token; |
|---|
| 729 | 725 | |
|---|
| 730 | | - if (!proc_create(f->filename, 0600, NULL, &f->fops)) |
|---|
| 726 | + if (!proc_create(f->filename, 0600, NULL, &f->ops)) |
|---|
| 731 | 727 | goto enomem; |
|---|
| 732 | 728 | |
|---|
| 733 | 729 | /* |
|---|