Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://www.jni.nu/cris
Browse files Browse the repository at this point in the history
* 'for-linus' of git://www.jni.nu/cris:
  CRIS: Don't use mask_irq as symbol name
  CRIS: Simplify param.h by simply including <asm-generic/param.h>
  CRISv10: Whitespace fixes for hw_settings.S
  CRISv10: Trivial fixes.
  CRISv32: Fix RS485 port 4 CD Kconfig item.
  CRISv32: Remove duplicated Kconfig items.
  cris: push down BKL into some device drivers
  • Loading branch information
torvalds committed Jun 1, 2010
2 parents 2e8949f + 4150764 commit b904d71
Show file tree
Hide file tree
Showing 14 changed files with 97 additions and 90 deletions.
20 changes: 15 additions & 5 deletions arch/cris/arch-v10/drivers/ds1302.c
Expand Up @@ -19,6 +19,7 @@
#include <linux/module.h>
#include <linux/miscdevice.h>
#include <linux/delay.h>
#include <linux/smp_lock.h>
#include <linux/bcd.h>
#include <linux/capability.h>

Expand Down Expand Up @@ -238,9 +239,7 @@ static unsigned char days_in_mo[] =

/* ioctl that supports RTC_RD_TIME and RTC_SET_TIME (read and set time/date). */

static int
rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg)
static int rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
unsigned long flags;

Expand Down Expand Up @@ -354,6 +353,17 @@ rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
}
}

static long rtc_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
int ret;

lock_kernel();
ret = rtc_ioctl(file, cmd, arg);
unlock_kernel();

return ret;
}

static void
print_rtc_status(void)
{
Expand All @@ -375,8 +385,8 @@ print_rtc_status(void)
/* The various file operations we support. */

static const struct file_operations rtc_fops = {
.owner = THIS_MODULE,
.ioctl = rtc_ioctl,
.owner = THIS_MODULE,
.unlocked_ioctl = rtc_unlocked_ioctl,
};

/* Probe for the chip by writing something to its RAM and try reading it back. */
Expand Down
19 changes: 15 additions & 4 deletions arch/cris/arch-v10/drivers/pcf8563.c
Expand Up @@ -27,6 +27,7 @@
#include <linux/delay.h>
#include <linux/bcd.h>
#include <linux/mutex.h>
#include <linux/smp_lock.h>

#include <asm/uaccess.h>
#include <asm/system.h>
Expand All @@ -53,7 +54,7 @@ static DEFINE_MUTEX(rtc_lock); /* Protect state etc */
static const unsigned char days_in_month[] =
{ 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

int pcf8563_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
static long pcf8563_unlocked_ioctl(struct file *, unsigned int, unsigned long);

/* Cache VL bit value read at driver init since writing the RTC_SECOND
* register clears the VL status.
Expand All @@ -62,7 +63,7 @@ static int voltage_low;

static const struct file_operations pcf8563_fops = {
.owner = THIS_MODULE,
.ioctl = pcf8563_ioctl,
.unlocked_ioctl = pcf8563_unlocked_ioctl,
};

unsigned char
Expand Down Expand Up @@ -212,8 +213,7 @@ pcf8563_exit(void)
* ioctl calls for this driver. Why return -ENOTTY upon error? Because
* POSIX says so!
*/
int pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
static int pcf8563_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
/* Some sanity checks. */
if (_IOC_TYPE(cmd) != RTC_MAGIC)
Expand Down Expand Up @@ -339,6 +339,17 @@ int pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
return 0;
}

static long pcf8563_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
int ret;

lock_kernel();
return pcf8563_ioctl(filp, cmd, arg);
unlock_kernel();

return ret;
}

static int __init pcf8563_register(void)
{
if (pcf8563_init() < 0) {
Expand Down
8 changes: 4 additions & 4 deletions arch/cris/arch-v10/kernel/irq.c
Expand Up @@ -17,8 +17,8 @@
#include <linux/kernel.h>
#include <linux/init.h>

#define mask_irq(irq_nr) (*R_VECT_MASK_CLR = 1 << (irq_nr));
#define unmask_irq(irq_nr) (*R_VECT_MASK_SET = 1 << (irq_nr));
#define crisv10_mask_irq(irq_nr) (*R_VECT_MASK_CLR = 1 << (irq_nr));
#define crisv10_unmask_irq(irq_nr) (*R_VECT_MASK_SET = 1 << (irq_nr));

/* don't use set_int_vector, it bypasses the linux interrupt handlers. it is
* global just so that the kernel gdb can use it.
Expand Down Expand Up @@ -116,12 +116,12 @@ static unsigned int startup_crisv10_irq(unsigned int irq)

static void enable_crisv10_irq(unsigned int irq)
{
unmask_irq(irq);
crisv10_unmask_irq(irq);
}

static void disable_crisv10_irq(unsigned int irq)
{
mask_irq(irq);
crisv10_mask_irq(irq);
}

static void ack_crisv10_irq(unsigned int irq)
Expand Down
15 changes: 7 additions & 8 deletions arch/cris/arch-v10/lib/dmacopy.c
@@ -1,5 +1,4 @@
/* $Id: dmacopy.c,v 1.1 2001/12/17 13:59:27 bjornw Exp $
*
/*
* memcpy for large blocks, using memory-memory DMA channels 6 and 7 in Etrax
*/

Expand All @@ -13,11 +12,11 @@ void *dma_memcpy(void *pdst,
unsigned int pn)
{
static etrax_dma_descr indma, outdma;
D(printk("dma_memcpy %d bytes... ", pn));

D(printk(KERN_DEBUG "dma_memcpy %d bytes... ", pn));

#if 0
*R_GEN_CONFIG = genconfig_shadow =
*R_GEN_CONFIG = genconfig_shadow =
(genconfig_shadow & ~0x3c0000) |
IO_STATE(R_GEN_CONFIG, dma6, intdma7) |
IO_STATE(R_GEN_CONFIG, dma7, intdma6);
Expand All @@ -32,11 +31,11 @@ void *dma_memcpy(void *pdst,
*R_DMA_CH7_FIRST = &outdma;
*R_DMA_CH6_CMD = IO_STATE(R_DMA_CH6_CMD, cmd, start);
*R_DMA_CH7_CMD = IO_STATE(R_DMA_CH7_CMD, cmd, start);

while(*R_DMA_CH7_CMD == 1) /* wait for completion */ ;

D(printk("done\n"));
while (*R_DMA_CH7_CMD == 1)
/* wait for completion */;

D(printk(KERN_DEBUG "done\n"));
}


Expand Down
14 changes: 6 additions & 8 deletions arch/cris/arch-v10/lib/hw_settings.S
@@ -1,27 +1,25 @@
/*
* $Id: hw_settings.S,v 1.1 2001/12/17 13:59:27 bjornw Exp $
*
* This table is used by some tools to extract hardware parameters.
* The table should be included in the kernel and the decompressor.
* Don't forget to update the tools if you change this table.
*
* Copyright (C) 2001 Axis Communications AB
*
* Authors: Mikael Starvik (starvik@axis.com)
* Authors: Mikael Starvik (starvik@axis.com)
*/

#define PA_SET_VALUE ((CONFIG_ETRAX_DEF_R_PORT_PA_DIR << 8) | \
(CONFIG_ETRAX_DEF_R_PORT_PA_DATA))
#define PB_SET_VALUE ((CONFIG_ETRAX_DEF_R_PORT_PB_CONFIG << 16) | \
(CONFIG_ETRAX_DEF_R_PORT_PB_DIR << 8) | \
(CONFIG_ETRAX_DEF_R_PORT_PB_DATA))

.ascii "HW_PARAM_MAGIC" ; Magic number
.dword 0xc0004000 ; Kernel start address

; Debug port
#ifdef CONFIG_ETRAX_DEBUG_PORT0
.dword 0
.dword 0
#elif defined(CONFIG_ETRAX_DEBUG_PORT1)
.dword 1
#elif defined(CONFIG_ETRAX_DEBUG_PORT2)
Expand All @@ -30,7 +28,7 @@
.dword 3
#else
.dword 4 ; No debug
#endif
#endif

; SDRAM or EDO DRAM?
#ifdef CONFIG_ETRAX_SDRAM
Expand All @@ -39,7 +37,7 @@
.dword 0
#endif

; Register values
; Register values
.dword R_WAITSTATES
.dword CONFIG_ETRAX_DEF_R_WAITSTATES
.dword R_BUS_CONFIG
Expand All @@ -56,7 +54,7 @@
.dword CONFIG_ETRAX_DEF_R_DRAM_TIMING
#endif
.dword R_PORT_PA_SET
.dword PA_SET_VALUE
.dword PA_SET_VALUE
.dword R_PORT_PB_SET
.dword PB_SET_VALUE
.dword 0 ; No more register values
16 changes: 1 addition & 15 deletions arch/cris/arch-v32/drivers/Kconfig
Expand Up @@ -360,24 +360,10 @@ config ETRAX_SER4_DSR_BIT
string "Ser 4 DSR bit (empty = not used)"
depends on ETRAX_SERIAL_PORT4

config ETRAX_SER3_CD_BIT
config ETRAX_SER4_CD_BIT
string "Ser 4 CD bit (empty = not used)"
depends on ETRAX_SERIAL_PORT4

config ETRAX_RS485
bool "RS-485 support"
depends on ETRAXFS_SERIAL
help
Enables support for RS-485 serial communication. For a primer on
RS-485, see <http://www.hw.cz/english/docs/rs485/rs485.html>.

config ETRAX_RS485_DISABLE_RECEIVER
bool "Disable serial receiver"
depends on ETRAX_RS485
help
It is necessary to disable the serial receiver to avoid serial
loopback. Not all products are able to do this in software only.

config ETRAX_SYNCHRONOUS_SERIAL
bool "Synchronous serial-port support"
depends on ETRAX_ARCH_V32
Expand Down
22 changes: 14 additions & 8 deletions arch/cris/arch-v32/drivers/i2c.c
Expand Up @@ -649,10 +649,10 @@ i2c_release(struct inode *inode, struct file *filp)
/* Main device API. ioctl's to write or read to/from i2c registers.
*/

static int
i2c_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
static long
i2c_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
int ret;
if(_IOC_TYPE(cmd) != ETRAXI2C_IOCTYPE) {
return -ENOTTY;
}
Expand All @@ -665,17 +665,23 @@ i2c_ioctl(struct inode *inode, struct file *file,
I2C_ARGREG(arg),
I2C_ARGVALUE(arg)));

return i2c_writereg(I2C_ARGSLAVE(arg),
lock_kernel();
ret = i2c_writereg(I2C_ARGSLAVE(arg),
I2C_ARGREG(arg),
I2C_ARGVALUE(arg));
unlock_kernel();
return ret;

case I2C_READREG:
{
unsigned char val;
/* read from an i2c slave */
D(printk("i2cr %d %d ",
I2C_ARGSLAVE(arg),
I2C_ARGREG(arg)));
lock_kernel();
val = i2c_readreg(I2C_ARGSLAVE(arg), I2C_ARGREG(arg));
unlock_kernel();
D(printk("= %d\n", val));
return val;
}
Expand All @@ -688,10 +694,10 @@ i2c_ioctl(struct inode *inode, struct file *file,
}

static const struct file_operations i2c_fops = {
.owner = THIS_MODULE,
.ioctl = i2c_ioctl,
.open = i2c_open,
.release = i2c_release,
.owner = THIS_MODULE,
.unlocked_ioctl = i2c_ioctl,
.open = i2c_open,
.release = i2c_release,
};

static int __init i2c_init(void)
Expand Down
21 changes: 16 additions & 5 deletions arch/cris/arch-v32/drivers/pcf8563.c
Expand Up @@ -24,6 +24,7 @@
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/ioctl.h>
#include <linux/smp_lock.h>
#include <linux/delay.h>
#include <linux/bcd.h>
#include <linux/mutex.h>
Expand All @@ -49,16 +50,16 @@ static DEFINE_MUTEX(rtc_lock); /* Protect state etc */
static const unsigned char days_in_month[] =
{ 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

int pcf8563_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
static long pcf8563_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);

/* Cache VL bit value read at driver init since writing the RTC_SECOND
* register clears the VL status.
*/
static int voltage_low;

static const struct file_operations pcf8563_fops = {
.owner = THIS_MODULE,
.ioctl = pcf8563_ioctl
.owner = THIS_MODULE,
.unlocked_ioctl = pcf8563_unlocked_ioctl,
};

unsigned char
Expand Down Expand Up @@ -208,8 +209,7 @@ pcf8563_exit(void)
* ioctl calls for this driver. Why return -ENOTTY upon error? Because
* POSIX says so!
*/
int pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
static int pcf8563_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
/* Some sanity checks. */
if (_IOC_TYPE(cmd) != RTC_MAGIC)
Expand Down Expand Up @@ -335,6 +335,17 @@ int pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
return 0;
}

static long pcf8563_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
int ret;

lock_kernel();
return pcf8563_ioctl(filp, cmd, arg);
unlock_kernel();

return ret;
}

static int __init pcf8563_register(void)
{
if (pcf8563_init() < 0) {
Expand Down
4 changes: 2 additions & 2 deletions arch/cris/arch-v32/kernel/crisksyms.c
Expand Up @@ -24,5 +24,5 @@ EXPORT_SYMBOL(crisv32_io_get_name);
EXPORT_SYMBOL(crisv32_io_get);

/* Functions masking/unmasking interrupts */
EXPORT_SYMBOL(mask_irq);
EXPORT_SYMBOL(unmask_irq);
EXPORT_SYMBOL(crisv32_mask_irq);
EXPORT_SYMBOL(crisv32_unmask_irq);

0 comments on commit b904d71

Please sign in to comment.