diff options
Diffstat (limited to 'arch/x86/kernel/cpu/mcheck/mce.c')
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 362056aefeb4..2af127d4c3d1 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -1634,16 +1634,35 @@ static long mce_chrdev_ioctl(struct file *f, unsigned int cmd, | |||
1634 | } | 1634 | } |
1635 | } | 1635 | } |
1636 | 1636 | ||
1637 | /* Modified in mce-inject.c, so not static or const */ | 1637 | static ssize_t (*mce_write)(struct file *filp, const char __user *ubuf, |
1638 | struct file_operations mce_chrdev_ops = { | 1638 | size_t usize, loff_t *off); |
1639 | |||
1640 | void register_mce_write_callback(ssize_t (*fn)(struct file *filp, | ||
1641 | const char __user *ubuf, | ||
1642 | size_t usize, loff_t *off)) | ||
1643 | { | ||
1644 | mce_write = fn; | ||
1645 | } | ||
1646 | EXPORT_SYMBOL_GPL(register_mce_write_callback); | ||
1647 | |||
1648 | ssize_t mce_chrdev_write(struct file *filp, const char __user *ubuf, | ||
1649 | size_t usize, loff_t *off) | ||
1650 | { | ||
1651 | if (mce_write) | ||
1652 | return mce_write(filp, ubuf, usize, off); | ||
1653 | else | ||
1654 | return -EINVAL; | ||
1655 | } | ||
1656 | |||
1657 | static const struct file_operations mce_chrdev_ops = { | ||
1639 | .open = mce_chrdev_open, | 1658 | .open = mce_chrdev_open, |
1640 | .release = mce_chrdev_release, | 1659 | .release = mce_chrdev_release, |
1641 | .read = mce_chrdev_read, | 1660 | .read = mce_chrdev_read, |
1661 | .write = mce_chrdev_write, | ||
1642 | .poll = mce_chrdev_poll, | 1662 | .poll = mce_chrdev_poll, |
1643 | .unlocked_ioctl = mce_chrdev_ioctl, | 1663 | .unlocked_ioctl = mce_chrdev_ioctl, |
1644 | .llseek = no_llseek, | 1664 | .llseek = no_llseek, |
1645 | }; | 1665 | }; |
1646 | EXPORT_SYMBOL_GPL(mce_chrdev_ops); | ||
1647 | 1666 | ||
1648 | static struct miscdevice mce_chrdev_device = { | 1667 | static struct miscdevice mce_chrdev_device = { |
1649 | MISC_MCELOG_MINOR, | 1668 | MISC_MCELOG_MINOR, |