msr.c (4ba24fef3eb3b142197135223b90ced2f319cd53) | msr.c (b25472f9b96159cc0b9b7ed449448805973cd789) |
---|---|
1/* ----------------------------------------------------------------------- * 2 * 3 * Copyright 2000-2008 H. Peter Anvin - All Rights Reserved 4 * Copyright 2009 Intel Corporation; author: H. Peter Anvin 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139, --- 31 unchanged lines hidden (view full) --- 40#include <linux/uaccess.h> 41#include <linux/gfp.h> 42 43#include <asm/processor.h> 44#include <asm/msr.h> 45 46static struct class *msr_class; 47 | 1/* ----------------------------------------------------------------------- * 2 * 3 * Copyright 2000-2008 H. Peter Anvin - All Rights Reserved 4 * Copyright 2009 Intel Corporation; author: H. Peter Anvin 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139, --- 31 unchanged lines hidden (view full) --- 40#include <linux/uaccess.h> 41#include <linux/gfp.h> 42 43#include <asm/processor.h> 44#include <asm/msr.h> 45 46static struct class *msr_class; 47 |
48static loff_t msr_seek(struct file *file, loff_t offset, int orig) 49{ 50 loff_t ret; 51 struct inode *inode = file_inode(file); 52 53 mutex_lock(&inode->i_mutex); 54 switch (orig) { 55 case SEEK_SET: 56 file->f_pos = offset; 57 ret = file->f_pos; 58 break; 59 case SEEK_CUR: 60 file->f_pos += offset; 61 ret = file->f_pos; 62 break; 63 default: 64 ret = -EINVAL; 65 } 66 mutex_unlock(&inode->i_mutex); 67 return ret; 68} 69 | |
70static ssize_t msr_read(struct file *file, char __user *buf, 71 size_t count, loff_t *ppos) 72{ 73 u32 __user *tmp = (u32 __user *) buf; 74 u32 data[2]; 75 u32 reg = *ppos; 76 int cpu = iminor(file_inode(file)); 77 int err = 0; --- 111 unchanged lines hidden (view full) --- 189 return 0; 190} 191 192/* 193 * File operations we support 194 */ 195static const struct file_operations msr_fops = { 196 .owner = THIS_MODULE, | 48static ssize_t msr_read(struct file *file, char __user *buf, 49 size_t count, loff_t *ppos) 50{ 51 u32 __user *tmp = (u32 __user *) buf; 52 u32 data[2]; 53 u32 reg = *ppos; 54 int cpu = iminor(file_inode(file)); 55 int err = 0; --- 111 unchanged lines hidden (view full) --- 167 return 0; 168} 169 170/* 171 * File operations we support 172 */ 173static const struct file_operations msr_fops = { 174 .owner = THIS_MODULE, |
197 .llseek = msr_seek, | 175 .llseek = no_seek_end_llseek, |
198 .read = msr_read, 199 .write = msr_write, 200 .open = msr_open, 201 .unlocked_ioctl = msr_ioctl, 202 .compat_ioctl = msr_ioctl, 203}; 204 205static int msr_device_create(int cpu) --- 101 unchanged lines hidden --- | 176 .read = msr_read, 177 .write = msr_write, 178 .open = msr_open, 179 .unlocked_ioctl = msr_ioctl, 180 .compat_ioctl = msr_ioctl, 181}; 182 183static int msr_device_create(int cpu) --- 101 unchanged lines hidden --- |