[LinuxPPS] [PATCH 08/11] pps: Got rid of f->private_data.
George Spelvin
linux at horizon.com
Fri Feb 6 14:33:51 CET 2009
The same information is available from the inode; is performance that critical?
---
drivers/pps/pps.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
index 9f6fa02..d729946 100644
--- a/drivers/pps/pps.c
+++ b/drivers/pps/pps.c
@@ -43,7 +43,8 @@ static struct class *pps_class;
static unsigned int pps_cdev_poll(struct file *file, poll_table *wait)
{
- struct pps_device *pps = file->private_data;
+ struct pps_device *pps = container_of(file->f_dentry->d_inode->i_cdev,
+ struct pps_device, cdev);
poll_wait(file, &pps->queue, wait);
@@ -52,14 +53,16 @@ static unsigned int pps_cdev_poll(struct file *file, poll_table *wait)
static int pps_cdev_fasync(int fd, struct file *file, int on)
{
- struct pps_device *pps = file->private_data;
+ struct pps_device *pps = container_of(file->f_dentry->d_inode->i_cdev,
+ struct pps_device, cdev);
return fasync_helper(fd, file, on, &pps->async_queue);
}
static long pps_cdev_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
- struct pps_device *pps = file->private_data;
+ struct pps_device *pps = container_of(file->f_dentry->d_inode->i_cdev,
+ struct pps_device, cdev);
struct pps_kparams params;
struct pps_fdata fdata;
unsigned long ticks;
@@ -207,14 +210,13 @@ static int pps_cdev_open(struct inode *inode, struct file *file)
if (!found)
return -ENODEV;
- file->private_data = pps;
-
return 0;
}
static int pps_cdev_release(struct inode *inode, struct file *file)
{
- struct pps_device *pps = file->private_data;
+ struct pps_device *pps = container_of(inode->i_cdev,
+ struct pps_device, cdev);
/* Free the PPS source and wake up (possible) deregistration */
pps_put_source(pps);
--
1.6.0.6
More information about the LinuxPPS
mailing list