summaryrefslogtreecommitdiff
path: root/drivers/gpu/pvr/services4/srvkm/env/linux/proc.c
diff options
context:
space:
mode:
authorWengang Wu <wgw@motorola.com>2014-02-28 15:53:58 -0600
committerJames Wylder <jwylder@motorola.com>2014-03-05 17:47:30 -0600
commitee86015f25945065a190de6bf8a00ed974ad8db8 (patch)
treebbce234883f563a459dfd1f642dba39e839be3b3 /drivers/gpu/pvr/services4/srvkm/env/linux/proc.c
parent9324804a1754c81b55b24e37e87707c9151a3afb (diff)
downloadolio-linux-3.10-ee86015f25945065a190de6bf8a00ed974ad8db8.tar.xz
olio-linux-3.10-ee86015f25945065a190de6bf8a00ed974ad8db8.zip
IKXCLOCK-343 Initial TI SGX Android OpenGL support
Added Makefile/Kconfig for kernel build-in driver Added OMAP3630 support for TI SGX DDK Fixed issue about newer kernel 3.10 Change-Id: I8b415bacb784e9dfb1967f669476d6d63898f331
Diffstat (limited to 'drivers/gpu/pvr/services4/srvkm/env/linux/proc.c')
-rw-r--r--drivers/gpu/pvr/services4/srvkm/env/linux/proc.c108
1 files changed, 108 insertions, 0 deletions
diff --git a/drivers/gpu/pvr/services4/srvkm/env/linux/proc.c b/drivers/gpu/pvr/services4/srvkm/env/linux/proc.c
index 7307257e09c..4a6e2fedc42 100644
--- a/drivers/gpu/pvr/services4/srvkm/env/linux/proc.c
+++ b/drivers/gpu/pvr/services4/srvkm/env/linux/proc.c
@@ -93,6 +93,18 @@ static struct file_operations pvr_proc_operations =
.release = seq_release,
};
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
+static ssize_t pvr_proc_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos);
+static struct file_operations pvr_read_proc_operations =
+{
+ .open = pvr_proc_open,
+ .read = pvr_proc_read,
+ .write = pvr_proc_write,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
+#endif
+
static struct seq_operations pvr_proc_seq_operations =
{
.start = pvr_proc_seq_start,
@@ -251,10 +263,15 @@ static IMG_INT pvr_proc_open(struct inode *inode,struct file *file)
IMG_INT ret = seq_open(file, &pvr_proc_seq_operations);
struct seq_file *seq = (struct seq_file*)file->private_data;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
struct proc_dir_entry* pvr_proc_entry = PDE(inode);
/* Add pointer to handlers to seq_file structure */
seq->private = pvr_proc_entry->data;
+#else
+ PVR_PROC_SEQ_HANDLERS *data = (PVR_PROC_SEQ_HANDLERS *)PDE_DATA(inode);
+ seq->private = data;
+#endif
return ret;
}
@@ -273,6 +290,7 @@ static ssize_t pvr_proc_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
{
struct inode *inode = file->f_path.dentry->d_inode;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
struct proc_dir_entry * dp;
PVR_UNREFERENCED_PARAMETER(ppos);
@@ -282,6 +300,13 @@ static ssize_t pvr_proc_write(struct file *file, const char __user *buffer,
return -EIO;
return dp->write_proc(file, buffer, count, dp->data);
+#else
+ PVR_PROC_SEQ_HANDLERS *data = (PVR_PROC_SEQ_HANDLERS *)PDE_DATA(inode);
+ PVR_UNREFERENCED_PARAMETER(ppos);
+ if (!data->write_proc)
+ return -EIO;
+ return data->write_proc(file, buffer, count, data);
+#endif
}
@@ -452,6 +477,7 @@ static struct proc_dir_entry* CreateProcEntryInDirSeq(
mode |= S_IWUSR;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
file=create_proc_entry(name, mode, pdir);
if (file)
@@ -479,6 +505,26 @@ static struct proc_dir_entry* CreateProcEntryInDirSeq(
return file;
}
}
+#else
+ /* Pass the handlers */
+ {
+ PVR_PROC_SEQ_HANDLERS *seq_handlers;
+ seq_handlers = (PVR_PROC_SEQ_HANDLERS *)kmalloc(sizeof(PVR_PROC_SEQ_HANDLERS), GFP_KERNEL);
+ if (seq_handlers)
+ {
+ seq_handlers->next = next_handler;
+ seq_handlers->show = show_handler;
+ seq_handlers->off2element = off2element_handler;
+ seq_handlers->startstop = startstop_handler;
+ seq_handlers->data = data;
+ seq_handlers->write_proc = whandler;
+ file = proc_create_data(name, mode, pdir, &pvr_proc_operations,seq_handlers);
+ if (file)
+ return file;
+ kfree(seq_handlers);
+ }
+ }
+#endif
PVR_DPF((PVR_DBG_ERROR, "CreateProcEntryInDirSeq: cannot make proc entry /proc/%s/%s: no memory", PVRProcDirRoot, name));
return NULL;
@@ -652,6 +698,7 @@ struct proc_dir_entry* CreatePerProcessProcEntrySeq (
if (!psPerProc->psProcDir)
{
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
IMG_CHAR dirname_buffer[256];
IMG_CHAR dirname[256];
IMG_INT ret;
@@ -666,6 +713,12 @@ struct proc_dir_entry* CreatePerProcessProcEntrySeq (
ret = snprintf(dirname, sizeof(dirname), "%u-%s", ui32PID, proc_basename);
PVR_DPF((PVR_DBG_MESSAGE, "Creating a new process entry for %s with ID %u\n", proc_basename, ui32PID));
+#else
+ IMG_CHAR dirname[16];
+ IMG_INT ret;
+
+ ret = snprintf(dirname, sizeof(dirname), "%u", ui32PID);
+#endif
if (ret <=0 || ret >= (IMG_INT)sizeof(dirname))
{
@@ -705,6 +758,7 @@ struct proc_dir_entry* CreatePerProcessProcEntrySeq (
*****************************************************************************/
IMG_VOID RemoveProcEntrySeq( struct proc_dir_entry* proc_entry )
{
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
if (dir)
{
void* data = proc_entry->data ;
@@ -715,6 +769,7 @@ IMG_VOID RemoveProcEntrySeq( struct proc_dir_entry* proc_entry )
kfree( data );
}
+#endif
}
/*!
@@ -738,6 +793,7 @@ IMG_VOID RemovePerProcessProcEntrySeq(struct proc_dir_entry* proc_entry)
PVRSRV_ENV_PER_PROCESS_DATA *psPerProc;
psPerProc = LinuxTerminatingProcessPrivateData();
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
if (!psPerProc)
{
psPerProc = PVRSRVFindPerProcessPrivateData();
@@ -758,6 +814,7 @@ IMG_VOID RemovePerProcessProcEntrySeq(struct proc_dir_entry* proc_entry)
if(data)
kfree( data );
}
+#endif
}
/*!
@@ -796,6 +853,7 @@ IMG_VOID RemovePerProcessProcEntrySeq(struct proc_dir_entry* proc_entry)
@Return : length of string written to page
*****************************************************************************/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
static IMG_INT pvr_read_proc(IMG_CHAR *page, IMG_CHAR **start, off_t off,
IMG_INT count, IMG_INT *eof, IMG_VOID *data)
{
@@ -820,6 +878,18 @@ static IMG_INT pvr_read_proc(IMG_CHAR *page, IMG_CHAR **start, off_t off,
return len;
}
+#else
+static ssize_t pvr_proc_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
+{
+ struct inode *inode = file->f_path.dentry->d_inode;
+ PVR_PROC_SEQ_HANDLERS *data = (PVR_PROC_SEQ_HANDLERS *)PDE_DATA(inode);
+ PVR_UNREFERENCED_PARAMETER(ppos);
+ if (!data->read_proc)
+ return -EIO;
+ return -EIO;
+
+}
+#endif
/*!
@@ -847,6 +917,9 @@ static IMG_INT CreateProcEntryInDir(struct proc_dir_entry *pdir, const IMG_CHAR
{
struct proc_dir_entry * file;
mode_t mode;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
+ PVR_PROC_SEQ_HANDLERS *handlers;
+#endif
if (!pdir)
{
@@ -867,6 +940,7 @@ static IMG_INT CreateProcEntryInDir(struct proc_dir_entry *pdir, const IMG_CHAR
mode |= S_IWUSR;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
file = create_proc_entry(name, mode, pdir);
if (file)
@@ -884,6 +958,23 @@ static IMG_INT CreateProcEntryInDir(struct proc_dir_entry *pdir, const IMG_CHAR
}
PVR_DPF((PVR_DBG_ERROR, "CreateProcEntry: cannot create proc entry %s in %s", name, pdir->name));
+#else
+ handlers = (PVR_PROC_SEQ_HANDLERS *)kmalloc(sizeof(PVR_PROC_SEQ_HANDLERS), GFP_KERNEL);
+ if (handlers)
+ {
+ handlers->data = data;
+ handlers->read_proc = rhandler;
+ handlers->write_proc = whandler;
+ file = proc_create_data(name, mode, pdir, &pvr_read_proc_operations, handlers);
+ if (file)
+ {
+ PVR_DPF((PVR_DBG_MESSAGE, "Created proc entry %s in %s", name, "?" /*pdir->name*/));
+ return 0;
+ }
+ kfree (handlers);
+ }
+ PVR_DPF((PVR_DBG_ERROR, "CreateProcEntry: cannot create proc entry %s in %s", name, "?" /*pdir->name*/));
+#endif
return -ENOMEM;
}
@@ -1018,6 +1109,7 @@ IMG_INT CreateProcReadEntry(const IMG_CHAR * name, pvr_read_proc_t handler)
return -ENOMEM;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
/* PRQA S 0307 1 */ /* ignore warning about casting to different pointer type */
file = create_proc_read_entry (name, S_IFREG | S_IRUGO, dir, pvr_read_proc, (IMG_VOID *)handler);
@@ -1028,6 +1120,12 @@ IMG_INT CreateProcReadEntry(const IMG_CHAR * name, pvr_read_proc_t handler)
#endif
return 0;
}
+#else
+ /* use file_ops pointing to pvr_read_proc */
+ file = proc_create_data(name, S_IFREG | S_IRUGO, dir, &pvr_read_proc_operations, handler);
+ if (file)
+ return 0;
+#endif
PVR_DPF((PVR_DBG_ERROR, "CreateProcReadEntry: cannot make proc entry /proc/%s/%s: no memory", PVRProcDirRoot, name));
@@ -1124,7 +1222,9 @@ IMG_VOID RemoveProcEntry(const IMG_CHAR * name)
{
if (dir)
{
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
remove_proc_entry(name, dir);
+#endif
PVR_DPF((PVR_DBG_MESSAGE, "Removing /proc/%s/%s", PVRProcDirRoot, name));
}
}
@@ -1162,9 +1262,11 @@ IMG_VOID RemovePerProcessProcEntry(const IMG_CHAR *name)
if (psPerProc->psProcDir)
{
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
remove_proc_entry(name, psPerProc->psProcDir);
PVR_DPF((PVR_DBG_MESSAGE, "Removing proc entry %s from %s", name, psPerProc->psProcDir->name));
+#endif
}
}
@@ -1187,6 +1289,7 @@ IMG_VOID RemovePerProcessProcDir(PVRSRV_ENV_PER_PROCESS_DATA *psPerProc)
{
if (psPerProc->psProcDir)
{
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
while (psPerProc->psProcDir->subdir)
{
PVR_DPF((PVR_DBG_WARNING, "Belatedly removing /proc/%s/%s/%s", PVRProcDirRoot, psPerProc->psProcDir->name, psPerProc->psProcDir->subdir->name));
@@ -1194,6 +1297,7 @@ IMG_VOID RemovePerProcessProcDir(PVRSRV_ENV_PER_PROCESS_DATA *psPerProc)
RemoveProcEntry(psPerProc->psProcDir->subdir->name);
}
RemoveProcEntry(psPerProc->psProcDir->name);
+#endif
}
}
@@ -1214,6 +1318,7 @@ IMG_VOID RemovePerProcessProcDir(PVRSRV_ENV_PER_PROCESS_DATA *psPerProc)
*****************************************************************************/
IMG_VOID RemoveProcEntries(IMG_VOID)
{
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
#ifdef DEBUG
RemoveProcEntrySeq( g_pProcDebugLevel );
#ifdef PVR_MANUAL_POWER_CONTROL
@@ -1233,6 +1338,9 @@ IMG_VOID RemoveProcEntries(IMG_VOID)
}
remove_proc_entry(PVRProcDirRoot, NULL);
+#else
+ proc_remove(dir);
+#endif
}
/*****************************************************************************