Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5792bf64 authored by Steven J. Hill's avatar Steven J. Hill Committed by Ralf Baechle
Browse files

MIPS: APRP: Code formatting clean-ups.



Clean-up code according to the 'checkpatch.pl' script.

Signed-off-by: default avatarSteven J. Hill <Steven.Hill@imgtec.com>
Reviewed-by: default avatarQais Yousef <Qais.Yousef@imgtec.com>
Patchwork: http://patchwork.linux-mips.org/patch/6097/


Reviewed-by: default avatarJohn Crispin <blogic@openwrt.org>
parent 1336113a
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -1950,7 +1950,6 @@ config MIPS_VPE_LOADER_TOM
	  you to ensure the amount you put in the option and the space your
	  you to ensure the amount you put in the option and the space your
	  program requires is less or equal to the amount physically present.
	  program requires is less or equal to the amount physically present.


# this should possibly be in drivers/char, but it is rather cpu related. Hmmm
config MIPS_VPE_APSP_API
config MIPS_VPE_APSP_API
	bool "Enable support for AP/SP API (RTLX)"
	bool "Enable support for AP/SP API (RTLX)"
	depends on MIPS_VPE_LOADER
	depends on MIPS_VPE_LOADER
+10 −5
Original line number Original line Diff line number Diff line
/*
/*
 * Amon support
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (C) 2013 Imagination Technologies Ltd.
 *
 * Arbitrary Monitor Support (AMON)
 */
 */

int amon_cpu_avail(int cpu);
int amon_cpu_avail(int);
int amon_cpu_start(int cpu, unsigned long pc, unsigned long sp,
int amon_cpu_start(int, unsigned long, unsigned long,
		   unsigned long gp, unsigned long a0);
		   unsigned long, unsigned long);
+4 −1
Original line number Original line Diff line number Diff line
/*
/*
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (C) 2004, 2005 MIPS Technologies, Inc.  All rights reserved.
 * Copyright (C) 2004, 2005 MIPS Technologies, Inc.  All rights reserved.
 * Copyright (C) 2013 Imagination Technologies Ltd.
 * Copyright (C) 2013 Imagination Technologies Ltd.
 */
 */

#ifndef __ASM_RTLX_H_
#ifndef __ASM_RTLX_H_
#define __ASM_RTLX_H_
#define __ASM_RTLX_H_


+4 −15
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (C) 2005 MIPS Technologies, Inc.  All rights reserved.
 * This file is subject to the terms and conditions of the GNU General Public
 * Copyright (C) 2013 Imagination Technologies Ltd.
 * License.  See the file "COPYING" in the main directory of this archive
 *
 *  This program is free software; you can distribute it and/or modify it
 *  under the terms of the GNU General Public License (Version 2) as
 *  published by the Free Software Foundation.
 *
 *  This program is distributed in the hope it will be useful, but WITHOUT
 *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 * for more details.
 *
 *
 *  You should have received a copy of the GNU General Public License along
 * Copyright (C) 2005 MIPS Technologies, Inc.  All rights reserved.
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 * Copyright (C) 2013 Imagination Technologies Ltd.
 *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
 *
 */
 */

#ifndef _ASM_VPE_H
#ifndef _ASM_VPE_H
#define _ASM_VPE_H
#define _ASM_VPE_H


+52 −79
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (C) 2005 MIPS Technologies, Inc.  All rights reserved.
 * This file is subject to the terms and conditions of the GNU General Public
 * Copyright (C) 2005, 06 Ralf Baechle (ralf@linux-mips.org)
 * License.  See the file "COPYING" in the main directory of this archive
 *
 *  This program is free software; you can distribute it and/or modify it
 *  under the terms of the GNU General Public License (Version 2) as
 *  published by the Free Software Foundation.
 *
 *  This program is distributed in the hope it will be useful, but WITHOUT
 *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 * for more details.
 *
 *
 *  You should have received a copy of the GNU General Public License along
 * Copyright (C) 2005 MIPS Technologies, Inc.  All rights reserved.
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 * Copyright (C) 2005, 06 Ralf Baechle (ralf@linux-mips.org)
 *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
 * Copyright (C) 2013 Imagination Technologies Ltd.
 *
 */
 */

#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <asm/uaccess.h>
#include <linux/list.h>
#include <linux/vmalloc.h>
#include <linux/elf.h>
#include <linux/seq_file.h>
#include <linux/syscalls.h>
#include <linux/syscalls.h>
#include <linux/moduleloader.h>
#include <linux/moduleloader.h>
#include <linux/interrupt.h>
#include <linux/atomic.h>
#include <linux/poll.h>
#include <linux/sched.h>
#include <linux/wait.h>
#include <asm/mipsmtregs.h>
#include <asm/mipsmtregs.h>
#include <asm/mips_mt.h>
#include <asm/mips_mt.h>
#include <asm/cacheflush.h>
#include <linux/atomic.h>
#include <asm/cpu.h>
#include <asm/processor.h>
#include <asm/processor.h>
#include <asm/vpe.h>
#include <asm/rtlx.h>
#include <asm/rtlx.h>
#include <asm/setup.h>
#include <asm/setup.h>
#include <asm/vpe.h>


static int sp_stopping;
static int sp_stopping;
struct rtlx_info *rtlx;
struct rtlx_info *rtlx;
@@ -53,22 +30,22 @@ static void __used dump_rtlx(void)
{
{
	int i;
	int i;


	printk("id 0x%lx state %d\n", rtlx->id, rtlx->state);
	pr_info("id 0x%lx state %d\n", rtlx->id, rtlx->state);


	for (i = 0; i < RTLX_CHANNELS; i++) {
	for (i = 0; i < RTLX_CHANNELS; i++) {
		struct rtlx_channel *chan = &rtlx->channel[i];
		struct rtlx_channel *chan = &rtlx->channel[i];


		printk(" rt_state %d lx_state %d buffer_size %d\n",
		pr_info(" rt_state %d lx_state %d buffer_size %d\n",
			chan->rt_state, chan->lx_state, chan->buffer_size);
			chan->rt_state, chan->lx_state, chan->buffer_size);


		printk(" rt_read %d rt_write %d\n",
		pr_info(" rt_read %d rt_write %d\n",
			chan->rt_read, chan->rt_write);
			chan->rt_read, chan->rt_write);


		printk(" lx_read %d lx_write %d\n",
		pr_info(" lx_read %d lx_write %d\n",
			chan->lx_read, chan->lx_write);
			chan->lx_read, chan->lx_write);


		printk(" rt_buffer <%s>\n", chan->rt_buffer);
		pr_info(" rt_buffer <%s>\n", chan->rt_buffer);
		printk(" lx_buffer <%s>\n", chan->lx_buffer);
		pr_info(" lx_buffer <%s>\n", chan->lx_buffer);
	}
	}
}
}


@@ -76,8 +53,7 @@ static void __used dump_rtlx(void)
static int rtlx_init(struct rtlx_info *rtlxi)
static int rtlx_init(struct rtlx_info *rtlxi)
{
{
	if (rtlxi->id != RTLX_ID) {
	if (rtlxi->id != RTLX_ID) {
		printk(KERN_ERR "no valid RTLX id at 0x%p 0x%lx\n",
		pr_err("no valid RTLX id at 0x%p 0x%lx\n", rtlxi, rtlxi->id);
			rtlxi, rtlxi->id);
		return -ENOEXEC;
		return -ENOEXEC;
	}
	}


@@ -118,28 +94,27 @@ int rtlx_open(int index, int can_sleep)
	int ret = 0;
	int ret = 0;


	if (index >= RTLX_CHANNELS) {
	if (index >= RTLX_CHANNELS) {
		printk(KERN_DEBUG "rtlx_open index out of range\n");
		pr_debug(KERN_DEBUG "rtlx_open index out of range\n");
		return -ENOSYS;
		return -ENOSYS;
	}
	}


	if (atomic_inc_return(&channel_wqs[index].in_open) > 1) {
	if (atomic_inc_return(&channel_wqs[index].in_open) > 1) {
		printk(KERN_DEBUG "rtlx_open channel %d already opened\n",
		pr_debug(KERN_DEBUG "rtlx_open channel %d already opened\n", index);
		       index);
		ret = -EBUSY;
		ret = -EBUSY;
		goto out_fail;
		goto out_fail;
	}
	}


	if (rtlx == NULL) {
	if (rtlx == NULL) {
		if( (p = vpe_get_shared(tclimit)) == NULL) {
		p = vpe_get_shared(aprp_cpu_index());
		if (p == NULL) {
			if (can_sleep) {
			if (can_sleep) {
				ret = __wait_event_interruptible(
				ret = __wait_event_interruptible(
					channel_wqs[index].lx_queue,
					channel_wqs[index].lx_queue,
					(p = vpe_get_shared(tclimit)));
					(p = vpe_get_shared(aprp_cpu_index())));
				if (ret)
				if (ret)
					goto out_fail;
					goto out_fail;
			} else {
			} else {
			printk(KERN_DEBUG "No SP program loaded, and device "
				pr_debug("No SP program loaded, and device opened with O_NONBLOCK\n");
					"opened with O_NONBLOCK\n");
				ret = -ENOSYS;
				ret = -ENOSYS;
				goto out_fail;
				goto out_fail;
			}
			}
@@ -164,24 +139,24 @@ int rtlx_open(int index, int can_sleep)
					ret = -ERESTARTSYS;
					ret = -ERESTARTSYS;
					goto out_fail;
					goto out_fail;
				}
				}
				finish_wait(&channel_wqs[index].lx_queue, &wait);
				finish_wait(&channel_wqs[index].lx_queue,
					    &wait);
			} else {
			} else {
				pr_err(" *vpe_get_shared is NULL. "
				pr_err(" *vpe_get_shared is NULL. Has an SP program been loaded?\n");
				       "Has an SP program been loaded?\n");
				ret = -ENOSYS;
				ret = -ENOSYS;
				goto out_fail;
				goto out_fail;
			}
			}
		}
		}


		if ((unsigned int)*p < KSEG0) {
		if ((unsigned int)*p < KSEG0) {
			printk(KERN_WARNING "vpe_get_shared returned an "
			pr_warn("vpe_get_shared returned an invalid pointer maybe an error code %d\n",
			       "invalid pointer maybe an error code %d\n",
				(int)*p);
				(int)*p);
			ret = -ENOSYS;
			ret = -ENOSYS;
			goto out_fail;
			goto out_fail;
		}
		}


		if ((ret = rtlx_init(*p)) < 0)
		ret = rtlx_init(*p);
		if (ret < 0)
			goto out_ret;
			goto out_ret;
	}
	}


@@ -312,7 +287,7 @@ ssize_t rtlx_write(int index, const void __user *buffer, size_t count)
	size_t fl;
	size_t fl;


	if (rtlx == NULL)
	if (rtlx == NULL)
		return(-ENOSYS);
		return -ENOSYS;


	rt = &rtlx->channel[index];
	rt = &rtlx->channel[index];


@@ -321,7 +296,7 @@ ssize_t rtlx_write(int index, const void __user *buffer, size_t count)
	rt_read = rt->rt_read;
	rt_read = rt->rt_read;


	/* total number of bytes to copy */
	/* total number of bytes to copy */
	count = min(count, (size_t)write_spacefree(rt_read, rt->rt_write,
	count = min_t(size_t, count, write_spacefree(rt_read, rt->rt_write,
						     rt->buffer_size));
						     rt->buffer_size));


	/* first bit from write pointer to the end of the buffer, or count */
	/* first bit from write pointer to the end of the buffer, or count */
@@ -332,9 +307,8 @@ ssize_t rtlx_write(int index, const void __user *buffer, size_t count)
		goto out;
		goto out;


	/* if there's any left copy to the beginning of the buffer */
	/* if there's any left copy to the beginning of the buffer */
	if (count - fl) {
	if (count - fl)
		failed = copy_from_user(rt->rt_buffer, buffer + fl, count - fl);
		failed = copy_from_user(rt->rt_buffer, buffer + fl, count - fl);
	}


out:
out:
	count -= failed;
	count -= failed;
@@ -388,9 +362,8 @@ static ssize_t file_read(struct file *file, char __user * buffer, size_t count,
	int minor = iminor(file_inode(file));
	int minor = iminor(file_inode(file));


	/* data available? */
	/* data available? */
	if (!rtlx_read_poll(minor, (file->f_flags & O_NONBLOCK) ? 0 : 1)) {
	if (!rtlx_read_poll(minor, (file->f_flags & O_NONBLOCK) ? 0 : 1))
		return 0;	// -EAGAIN makes cat whinge
		return 0;	/* -EAGAIN makes 'cat' whine */
	}


	return rtlx_read(minor, buffer, count);
	return rtlx_read(minor, buffer, count);
}
}
Loading