Commit 823952e5 authored by Steve French's avatar Steve French

Merge bk://linux.bkbits.net/linux-2.5

into bkbits.net:/repos/c/cifs/linux-2.5cifs
parents f27e5a2c 5a530b5a
The Linux Kernel Driver Interface
(all of your questions answered and then some)
Greg Kroah-Hartman <greg@kroah.com>
This is being written to try to explain why Linux does not have a binary
kernel interface, nor does it have a stable kernel interface. Please
realize that this article describes the _in kernel_ interfaces, not the
kernel to userspace interfaces. The kernel to userspace interface is
the one that application programs use, the syscall interface. That
interface is _very_ stable over time, and will not break. I have old
programs that were built on a pre 0.9something kernel that still works
just fine on the latest 2.6 kernel release. This interface is the one
that users and application programmers can count on being stable.
Executive Summary
-----------------
You think you want a stable kernel interface, but you really do not, and
you don't even know it. What you want is a stable running driver, and
you get that only if your driver is in the main kernel tree. You also
get lots of other good benefits if your driver is in the main kernel
tree, all of which has made Linux into such a strong, stable, and mature
operating system which is the reason you are using it in the first
place.
Intro
-----
It's only the odd person who wants to write a kernel driver that needs
to worry about the in-kernel interfaces changing. For the majority of
the world, they neither see this interface, nor do they care about it at
all.
First off, I'm not going to address _any_ legal issues about closed
source, hidden source, binary blobs, source wrappers, or any other term
that describes kernel drivers that do not have their source code
released under the GPL. Please consult a lawyer if you have any legal
questions, I'm a programmer and hence, I'm just going to be describing
the technical issues here (not to make light of the legal issues, they
are real, and you do need to be aware of them at all times.)
So, there are two main topics here, binary kernel interfaces and stable
kernel source interfaces. They both depend on each other, but we will
discuss the binary stuff first to get it out of the way.
Binary Kernel Interface
-----------------------
Assuming that we had a stable kernel source interface for the kernel, a
binary interface would naturally happen too, right? Wrong. Please
consider the following facts about the Linux kernel:
- Depending on the version of the C compiler you use, different kernel
data structures will contain different alignment of structures, and
possibly include different functions in different ways (putting
functions inline or not.) The individual function organization
isn't that important, but the different data structure padding is
very important.
- Depending on what kernel build options you select, a wide range of
different things can be assumed by the kernel:
- different structures can contain different fields
- Some functions may not be implemented at all, (i.e. some locks
compile away to nothing for non-SMP builds.)
- Parameter passing of variables from function to function can be
done in different ways (the CONFIG_REGPARM option controls
this.)
- Memory within the kernel can be aligned in different ways,
depending on the build options.
- Linux runs on a wide range of different processor architectures.
There is no way that binary drivers from one architecture will run
on another architecture properly.
Now a number of these issues can be addressed by simply compiling your
module for the exact specific kernel configuration, using the same exact
C compiler that the kernel was built with. This is sufficient if you
want to provide a module for a specific release version of a specific
Linux distribution. But multiply that single build by the number of
different Linux distributions and the number of different supported
releases of the Linux distribution and you quickly have a nightmare of
different build options on different releases. Also realize that each
Linux distribution release contains a number of different kernels, all
tuned to different hardware types (different processor types and
different options), so for even a single release you will need to create
multiple versions of your module.
Trust me, you will go insane over time if you try to support this kind
of release, I learned this the hard way a long time ago...
Stable Kernel Source Interfaces
-------------------------------
This is a much more "volatile" topic if you talk to people who try to
keep a Linux kernel driver that is not in the main kernel tree up to
date over time.
Linux kernel development is continuous and at a rapid pace, never
stopping to slow down. As such, the kernel developers find bugs in
current interfaces, or figure out a better way to do things. If they do
that, they then fix the current interfaces to work better. When they do
so, function names may change, structures may grow or shrink, and
function parameters may be reworked. If this happens, all of the
instances of where this interface is used within the kernel are fixed up
at the same time, ensuring that everything continues to work properly.
As a specific examples of this, the in-kernel USB interfaces have
undergone at least three different reworks over the lifetime of this
subsystem. These reworks were done to address a number of different
issues:
- A change from a synchronous model of data streams to an asynchronous
one. This reduced the complexity of a number of drivers and
increased the throughput of all USB drivers such that we are now
running almost all USB devices at their maximum speed possible.
- A change was made in the way data packets were allocated from the
USB core by USB drivers so that all drivers now needed to provide
more information to the USB core to fix a number of documented
deadlocks.
This is in stark contrast to a number of closed source operating systems
which have had to maintain their older USB interfaces over time. This
provides the ability for new developers to accidentally use the old
interfaces and do things in improper ways, causing the stability of the
operating system to suffer.
In both of these instances, all developers agreed that these were
important changes that needed to be made, and they were made, with
relatively little pain. If Linux had to ensure that it preserve a
stable source interface, a new interface would have been created, and
the older, broken one would have had to be maintained over time, leading
to extra work for the USB developers. Since all Linux USB developers do
their work on their own time, asking programmers to do extra work for no
gain, for free, is not a possibility.
Security issues are also a very important for Linux. When a
security issue is found, it is fixed in a very short amount of time. A
number of times this has caused internal kernel interfaces to be
reworked to prevent the security problem from occurring. When this
happens, all drivers that use the interfaces were also fixed at the
same time, ensuring that the security problem was fixed and could not
come back at some future time accidentally. If the internal interfaces
were not allowed to change, fixing this kind of security problem and
insuring that it could not happen again would not be possible.
Kernel interfaces are cleaned up over time. If there is no one using a
current interface, it is deleted. This ensures that the kernel remains
as small as possible, and that all potential interfaces are tested as
well as they can be (unused interfaces are pretty much impossible to
test for validity.)
What to do
----------
So, if you have a Linux kernel driver that is not in the main kernel
tree, what are you, a developer, supposed to do? Releasing a binary
driver for every different kernel version for every distribution is a
nightmare, and trying to keep up with an ever changing kernel interface
is also a rough job.
Simple, get your kernel driver into the main kernel tree (remember we
are talking about GPL released drivers here, if your code doesn't fall
under this category, good luck, you are on your own here, you leech
<insert link to leech comment from Andrew and Linus here>.) If your
driver is in the tree, and a kernel interface changes, it will be fixed
up by the person who did the kernel change in the first place. This
ensures that your driver is always buildable, and works over time, with
very little effort on your part.
The very good side affects of having your driver in the main kernel tree
are:
- The quality of the driver will rise as the maintenance costs (to the
original developer) will decrease.
- Other developers will add features to your driver.
- Other people will find and fix bugs in your driver.
- Other people will find tuning opportunities in your driver.
- Other people will update the driver for you when external interface
changes require it.
- The driver automatically gets shipped in all Linux distributions
without having to ask the distros to add it.
As Linux supports a larger number of different devices "out of the box"
than any other operating system, and it supports these devices on more
different processor architectures than any other operating system, this
proven type of development model must be doing something right :)
------
Thanks to Randy Dunlap, Andrew Morton, David Brownell, Hanna Linder,
Robert Love, and Nishanth Aravamudan for their review and comments on
early drafts of this paper.
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 10
EXTRAVERSION =-rc2
EXTRAVERSION =-rc3
NAME=Woozy Numbat
# *DOCUMENTATION*
......
......@@ -56,6 +56,10 @@ SECTIONS
__initramfs_start = .;
usr/built-in.o(.init.ramfs)
__initramfs_end = .;
. = ALIGN(64);
__per_cpu_start = .;
*(.data.percpu)
__per_cpu_end = .;
#ifndef CONFIG_XIP_KERNEL
__init_begin = _stext;
*(.init.data)
......
......@@ -17,7 +17,7 @@
*
* Inputs: r0 contains the address
* Outputs: r0 is the error code
* r1, r2 contains the zero-extended value
* r2, r3 contains the zero-extended value
* lr corrupted
*
* No other registers must be altered. (see include/asm-arm/uaccess.h
......@@ -32,39 +32,39 @@
.global __get_user_1
__get_user_1:
1: ldrbt r1, [r0]
1: ldrbt r2, [r0]
mov r0, #0
mov pc, lr
.global __get_user_2
__get_user_2:
2: ldrbt r1, [r0], #1
3: ldrbt r2, [r0]
2: ldrbt r2, [r0], #1
3: ldrbt r3, [r0]
#ifndef __ARMEB__
orr r1, r1, r2, lsl #8
orr r2, r2, r3, lsl #8
#else
orr r1, r2, r1, lsl #8
orr r2, r3, r2, lsl #8
#endif
mov r0, #0
mov pc, lr
.global __get_user_4
__get_user_4:
4: ldrt r1, [r0]
4: ldrt r2, [r0]
mov r0, #0
mov pc, lr
.global __get_user_8
__get_user_8:
5: ldrt r1, [r0], #4
6: ldrt r2, [r0]
5: ldrt r2, [r0], #4
6: ldrt r3, [r0]
mov r0, #0
mov pc, lr
__get_user_bad_8:
mov r2, #0
mov r3, #0
__get_user_bad:
mov r1, #0
mov r2, #0
mov r0, #-EFAULT
mov pc, lr
......
......@@ -16,7 +16,7 @@
* __put_user_X
*
* Inputs: r0 contains the address
* r1, r2 contains the value
* r2, r3 contains the value
* Outputs: r0 is the error code
* lr corrupted
*
......@@ -32,33 +32,33 @@
.global __put_user_1
__put_user_1:
1: strbt r1, [r0]
1: strbt r2, [r0]
mov r0, #0
mov pc, lr
.global __put_user_2
__put_user_2:
mov ip, r1, lsr #8
mov ip, r2, lsr #8
#ifndef __ARMEB__
2: strbt r1, [r0], #1
2: strbt r2, [r0], #1
3: strbt ip, [r0]
#else
2: strbt ip, [r0], #1
3: strbt r1, [r0]
3: strbt r2, [r0]
#endif
mov r0, #0
mov pc, lr
.global __put_user_4
__put_user_4:
4: strt r1, [r0]
4: strt r2, [r0]
mov r0, #0
mov pc, lr
.global __put_user_8
__put_user_8:
5: strt r1, [r0], #4
6: strt r2, [r0]
5: strt r2, [r0], #4
6: strt r3, [r0]
mov r0, #0
mov pc, lr
......
......@@ -37,7 +37,49 @@
#include "clock.h"
static unsigned long timer_startval;
static unsigned long timer_ticks_usec;
static unsigned long timer_usec_ticks;
#define TIMER_USEC_SHIFT 16
/* we use the shifted arithmetic to work out the ratio of timer ticks
* to usecs, as often the peripheral clock is not a nice even multiple
* of 1MHz.
*
* shift of 14 and 15 are too low for the 12MHz, 16 seems to be ok
* for the current HZ value of 200 without producing overflows.
*
* Original patch by Dimitry Andric, updated by Ben Dooks
*/
/* timer_mask_usec_ticks
*
* given a clock and divisor, make the value to pass into timer_ticks_to_usec
* to scale the ticks into usecs
*/
static inline unsigned long
timer_mask_usec_ticks(unsigned long scaler, unsigned long pclk)
{
unsigned long den = pclk / 1000;
return ((1000 << TIMER_USEC_SHIFT) * scaler + (den >> 1)) / den;
}
/* timer_ticks_to_usec
*
* convert timer ticks to usec.
*/
static inline unsigned long timer_ticks_to_usec(unsigned long ticks)
{
unsigned long res;
res = ticks * timer_usec_ticks;
res += 1 << (TIMER_USEC_SHIFT - 4); /* round up slightly */
return res >> TIMER_USEC_SHIFT;
}
/***
* Returns microsecond since last clock interrupt. Note that interrupts
......@@ -50,31 +92,31 @@ static unsigned long timer_ticks_usec;
static unsigned long s3c2410_gettimeoffset (void)
{
unsigned long tdone;
unsigned long usec;
unsigned long irqpend;
unsigned long tval;
/* work out how many ticks have gone since last timer interrupt */
tdone = timer_startval - __raw_readl(S3C2410_TCNTO(4));
tval = __raw_readl(S3C2410_TCNTO(4));
tdone = timer_startval - tval;
/* check to see if there is an interrupt pending */
irqpend = __raw_readl(S3C2410_SRCPND);
if (irqpend & SRCPND_TIMER4) {
/* re-read the timer, and try and fix up for the missed
* interrupt */
tdone = timer_startval - __raw_readl(S3C2410_TCNTO(4));
tdone += 1<<16;
}
* interrupt. Note, the interrupt may go off before the
* timer has re-loaded from wrapping.
*/
/* currently, tcnt is in 12MHz units, but this may change
* for non-bast machines...
*/
tval = __raw_readl(S3C2410_TCNTO(4));
tdone = timer_startval - tval;
usec = tdone / timer_ticks_usec;
if (tval != 0)
tdone += timer_startval;
}
return usec;
return timer_ticks_to_usec(tdone);
}
......@@ -120,8 +162,9 @@ static void s3c2410_timer_setup (void)
/* configure the system for whichever machine is in use */
if (machine_is_bast() || machine_is_vr1000()) {
timer_ticks_usec = 12; /* timer is at 12MHz */
tcnt = (timer_ticks_usec * (1000*1000)) / HZ;
/* timer is at 12MHz, scaler is 1 */
timer_usec_ticks = timer_mask_usec_ticks(1, 12000000);
tcnt = 12000000 / HZ;
tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
tcfg1 |= S3C2410_TCFG1_MUX4_TCLK1;
......@@ -129,13 +172,15 @@ static void s3c2410_timer_setup (void)
/* for the h1940 (and others), we use the pclk from the core
* to generate the timer values. since values around 50 to
* 70MHz are not values we can directly generate the timer
* value from, we need to pre-scaleand divide before using it.
* value from, we need to pre-scale and divide before using it.
*
* for instance, using 50.7MHz and dividing by 6 gives 8.45MHz
* (8.45 ticks per usec)
*/
/* this is used as default if no other timer can be found */
timer_ticks_usec = s3c24xx_pclk / (1000*1000);
timer_ticks_usec /= 6;
timer_usec_ticks = timer_mask_usec_ticks(6, s3c24xx_pclk);
tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
tcfg1 |= S3C2410_TCFG1_MUX4_DIV2;
......@@ -146,8 +191,12 @@ static void s3c2410_timer_setup (void)
tcnt = (s3c24xx_pclk / 6) / HZ;
}
printk("setup_timer tcon=%08lx, tcnt %04lx, tcfg %08lx,%08lx\n",
tcon, tcnt, tcfg0, tcfg1);
/* timers reload after counting zero, so reduce the count by 1 */
tcnt--;
printk("timer tcon=%08lx, tcnt %04lx, tcfg %08lx,%08lx, usec %08lx\n",
tcon, tcnt, tcfg0, tcfg1, timer_usec_ticks);
/* check to see if timer is within 16bit range... */
if (tcnt > 0xffff) {
......
......@@ -2,7 +2,8 @@
* arch/ia64/kernel/domain.c
* Architecture specific sched-domains builder.
*
* Copyright (C) 2004 Linus Torvalds
* Copyright (C) 2004 Jesse Barnes
* Copyright (C) 2004 Silicon Graphics, Inc.
*/
#include <linux/sched.h>
......
......@@ -103,15 +103,6 @@ extern void inherit_locked_prom_mappings(int save_p);
void __init smp_callin(void)
{
int cpuid = hard_smp_processor_id();
extern int bigkernel;
extern unsigned long kern_locked_tte_data;
if (bigkernel) {
prom_dtlb_load(sparc64_highest_locked_tlbent()-1,
kern_locked_tte_data + 0x400000, KERNBASE + 0x400000);
prom_itlb_load(sparc64_highest_locked_tlbent()-1,
kern_locked_tte_data + 0x400000, KERNBASE + 0x400000);
}
inherit_locked_prom_mappings(0);
......
......@@ -90,7 +90,9 @@ startup_continue:
sllx %g2, 32, %g2
wr %g2, 0, %tick_cmpr
/* Call OBP by hand to lock KERNBASE into i/d tlbs. */
/* Call OBP by hand to lock KERNBASE into i/d tlbs.
* We lock 2 consequetive entries if we are 'bigkernel'.
*/
mov %o0, %l0
sethi %hi(prom_entry_lock), %g2
......@@ -136,6 +138,46 @@ startup_continue:
call %o1
add %sp, (2047 + 128), %o0
sethi %hi(bigkernel), %g2
lduw [%g2 + %lo(bigkernel)], %g2
cmp %g2, 0
be,pt %icc, do_dtlb
nop
sethi %hi(call_method), %g2
or %g2, %lo(call_method), %g2
stx %g2, [%sp + 2047 + 128 + 0x00]
mov 5, %g2
stx %g2, [%sp + 2047 + 128 + 0x08]
mov 1, %g2
stx %g2, [%sp + 2047 + 128 + 0x10]
sethi %hi(itlb_load), %g2
or %g2, %lo(itlb_load), %g2
stx %g2, [%sp + 2047 + 128 + 0x18]
sethi %hi(mmu_ihandle_cache), %g2
lduw [%g2 + %lo(mmu_ihandle_cache)], %g2
stx %g2, [%sp + 2047 + 128 + 0x20]
sethi %hi(KERNBASE + 0x400000), %g2
stx %g2, [%sp + 2047 + 128 + 0x28]
sethi %hi(kern_locked_tte_data), %g2
ldx [%g2 + %lo(kern_locked_tte_data)], %g2
sethi %hi(0x400000), %g1
add %g2, %g1, %g2
stx %g2, [%sp + 2047 + 128 + 0x30]
mov 14, %g2
BRANCH_IF_ANY_CHEETAH(g1,g5,1f)
mov 62, %g2
1:
stx %g2, [%sp + 2047 + 128 + 0x38]
sethi %hi(p1275buf), %g2
or %g2, %lo(p1275buf), %g2
ldx [%g2 + 0x08], %o1
call %o1
add %sp, (2047 + 128), %o0
do_dtlb:
sethi %hi(call_method), %g2
or %g2, %lo(call_method), %g2
stx %g2, [%sp + 2047 + 128 + 0x00]
......@@ -168,6 +210,47 @@ startup_continue:
call %o1
add %sp, (2047 + 128), %o0
sethi %hi(bigkernel), %g2
lduw [%g2 + %lo(bigkernel)], %g2
cmp %g2, 0
be,pt %icc, do_unlock
nop
sethi %hi(call_method), %g2
or %g2, %lo(call_method), %g2
stx %g2, [%sp + 2047 + 128 + 0x00]
mov 5, %g2
stx %g2, [%sp + 2047 + 128 + 0x08]
mov 1, %g2
stx %g2, [%sp + 2047 + 128 + 0x10]
sethi %hi(dtlb_load), %g2
or %g2, %lo(dtlb_load), %g2
stx %g2, [%sp + 2047 + 128 + 0x18]
sethi %hi(mmu_ihandle_cache), %g2
lduw [%g2 + %lo(mmu_ihandle_cache)], %g2
stx %g2, [%sp + 2047 + 128 + 0x20]
sethi %hi(KERNBASE + 0x400000), %g2
stx %g2, [%sp + 2047 + 128 + 0x28]
sethi %hi(kern_locked_tte_data), %g2
ldx [%g2 + %lo(kern_locked_tte_data)], %g2
sethi %hi(0x400000), %g1
add %g2, %g1, %g2
stx %g2, [%sp + 2047 + 128 + 0x30]
mov 14, %g2
BRANCH_IF_ANY_CHEETAH(g1,g5,1f)
mov 62, %g2
1:
stx %g2, [%sp + 2047 + 128 + 0x38]
sethi %hi(p1275buf), %g2
or %g2, %lo(p1275buf), %g2
ldx [%g2 + 0x08], %o1
call %o1
add %sp, (2047 + 128), %o0
do_unlock:
sethi %hi(prom_entry_lock), %g2
stb %g0, [%g2 + %lo(prom_entry_lock)]
membar #StoreStore | #StoreLoad
......
......@@ -122,7 +122,7 @@ EXPORT_SYMBOL(class_simple_destroy);
* be created, showing the dev_t for the device. The pointer to the struct
* class_device will be returned from the call. Any further sysfs files that
* might be required can be created using this pointer.
* Note: the struct class_device passed to this function must have previously been
* Note: the struct class_simple passed to this function must have previously been
* created with a call to class_simple_create().
*/
struct class_device *class_simple_device_add(struct class_simple *cs, dev_t dev, struct device *device, const char *fmt, ...)
......
......@@ -584,8 +584,10 @@ static int uart_get_info(struct uart_state *state,
tmp.flags = port->flags;
tmp.xmit_fifo_size = port->fifosize;
tmp.baud_base = port->uartclk / 16;
tmp.close_delay = state->close_delay;
tmp.closing_wait = state->closing_wait;
tmp.close_delay = state->close_delay / 10;
tmp.closing_wait = state->closing_wait == USF_CLOSING_WAIT_NONE ?
ASYNC_CLOSING_WAIT_NONE :
state->closing_wait / 10;
tmp.custom_divisor = port->custom_divisor;
tmp.hub6 = port->hub6;
tmp.io_type = port->iotype;
......@@ -603,8 +605,8 @@ static int uart_set_info(struct uart_state *state,
struct serial_struct new_serial;
struct uart_port *port = state->port;
unsigned long new_port;
unsigned int change_irq, change_port, old_flags;
unsigned int old_custom_divisor;
unsigned int change_irq, change_port, old_flags, closing_wait;
unsigned int old_custom_divisor, close_delay;
int retval = 0;
if (copy_from_user(&new_serial, newinfo, sizeof(new_serial)))
......@@ -615,6 +617,9 @@ static int uart_set_info(struct uart_state *state,
new_port += (unsigned long) new_serial.port_high << HIGH_BITS_OFFSET;
new_serial.irq = irq_canonicalize(new_serial.irq);
close_delay = new_serial.close_delay * 10;
closing_wait = new_serial.closing_wait == ASYNC_CLOSING_WAIT_NONE ?
USF_CLOSING_WAIT_NONE : new_serial.closing_wait * 10;
/*
* This semaphore protects state->count. It is also
......@@ -646,8 +651,8 @@ static int uart_set_info(struct uart_state *state,
retval = -EPERM;
if (change_irq || change_port ||
(new_serial.baud_base != port->uartclk / 16) ||
(new_serial.close_delay != state->close_delay) ||
(new_serial.closing_wait != state->closing_wait) ||
(close_delay != state->close_delay) ||
(closing_wait != state->closing_wait) ||
(new_serial.xmit_fifo_size != port->fifosize) ||
(((new_serial.flags ^ old_flags) & ~UPF_USR_MASK) != 0))
goto exit;
......@@ -751,8 +756,8 @@ static int uart_set_info(struct uart_state *state,
port->flags = (port->flags & ~UPF_CHANGE_MASK) |
(new_serial.flags & UPF_CHANGE_MASK);
port->custom_divisor = new_serial.custom_divisor;
state->close_delay = new_serial.close_delay * HZ / 100;
state->closing_wait = new_serial.closing_wait * HZ / 100;
state->close_delay = close_delay;
state->closing_wait = closing_wait;
port->fifosize = new_serial.xmit_fifo_size;
if (state->info->tty)
state->info->tty->low_latency =
......@@ -1191,7 +1196,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
tty->closing = 1;
if (state->closing_wait != USF_CLOSING_WAIT_NONE)
tty_wait_until_sent(tty, state->closing_wait);
tty_wait_until_sent(tty, msecs_to_jiffies(state->closing_wait));
/*
* At this point, we stop accepting input. To do this, we
......@@ -1219,9 +1224,8 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
state->info->tty = NULL;
if (state->info->blocked_open) {
if (state->close_delay) {
msleep_interruptible(jiffies_to_msecs(state->close_delay));
}
if (state->close_delay)
msleep_interruptible(state->close_delay);
} else if (!uart_console(port)) {
uart_change_pm(state, 3);
}
......@@ -2082,8 +2086,8 @@ int uart_register_driver(struct uart_driver *drv)
for (i = 0; i < drv->nr; i++) {
struct uart_state *state = drv->state + i;
state->close_delay = 5 * HZ / 10;
state->closing_wait = 30 * HZ;
state->close_delay = 500; /* .5 seconds */
state->closing_wait = 30000; /* 30 seconds */
init_MUTEX(&state->sem);
}
......
......@@ -351,6 +351,8 @@ static int sysfs_dir_close(struct inode *inode, struct file *file)
list_del_init(&cursor->s_sibling);
up(&dentry->d_inode->i_sem);
release_sysfs_dirent(cursor);
return 0;
}
......
......@@ -108,35 +108,35 @@ extern int __get_user_4(void *);
extern int __get_user_8(void *);
extern int __get_user_bad(void);
#define __get_user_x(__r1,__p,__e,__s,__i...) \
#define __get_user_x(__r2,__p,__e,__s,__i...) \
__asm__ __volatile__ ( \
__asmeq("%0", "r0") __asmeq("%1", "r1") \
__asmeq("%0", "r0") __asmeq("%1", "r2") \
"bl __get_user_" #__s \
: "=&r" (__e), "=r" (__r1) \
: "=&r" (__e), "=r" (__r2) \
: "0" (__p) \
: __i, "cc")
#define get_user(x,p) \
({ \
const register typeof(*(p)) __user *__p asm("r0") = (p);\
register typeof(*(p)) __r1 asm("r1"); \
register typeof(*(p)) __r2 asm("r2"); \
register int __e asm("r0"); \
switch (sizeof(*(__p))) { \
case 1: \
__get_user_x(__r1, __p, __e, 1, "lr"); \
__get_user_x(__r2, __p, __e, 1, "lr"); \
break; \
case 2: \
__get_user_x(__r1, __p, __e, 2, "r2", "lr"); \
__get_user_x(__r2, __p, __e, 2, "r3", "lr"); \
break; \
case 4: \
__get_user_x(__r1, __p, __e, 4, "lr"); \
__get_user_x(__r2, __p, __e, 4, "lr"); \
break; \
case 8: \
__get_user_x(__r1, __p, __e, 8, "lr"); \
__get_user_x(__r2, __p, __e, 8, "lr"); \
break; \
default: __e = __get_user_bad(); break; \
} \
x = __r1; \
x = __r2; \
__e; \
})
......@@ -227,31 +227,31 @@ extern int __put_user_4(void *, unsigned int);
extern int __put_user_8(void *, unsigned long long);
extern int __put_user_bad(void);
#define __put_user_x(__r1,__p,__e,__s) \
#define __put_user_x(__r2,__p,__e,__s) \
__asm__ __volatile__ ( \
__asmeq("%0", "r0") __asmeq("%2", "r1") \
__asmeq("%0", "r0") __asmeq("%2", "r2") \
"bl __put_user_" #__s \
: "=&r" (__e) \
: "0" (__p), "r" (__r1) \
: "0" (__p), "r" (__r2) \
: "ip", "lr", "cc")
#define put_user(x,p) \
({ \
const register typeof(*(p)) __r1 asm("r1") = (x); \
const register typeof(*(p)) __r2 asm("r2") = (x); \
const register typeof(*(p)) __user *__p asm("r0") = (p);\
register int __e asm("r0"); \
switch (sizeof(*(__p))) { \
case 1: \
__put_user_x(__r1, __p, __e, 1); \
__put_user_x(__r2, __p, __e, 1); \
break; \
case 2: \
__put_user_x(__r1, __p, __e, 2); \
__put_user_x(__r2, __p, __e, 2); \
break; \
case 4: \
__put_user_x(__r1, __p, __e, 4); \
__put_user_x(__r2, __p, __e, 4); \
break; \
case 8: \
__put_user_x(__r1, __p, __e, 8); \
__put_user_x(__r2, __p, __e, 8); \
break; \
default: __e = __put_user_bad(); break; \
} \
......
......@@ -91,12 +91,15 @@
/* MPC52xx type numbers */
#define PORT_MPC52xx 59
/*IBM icom*/
#define PORT_ICOM 60
/* IBM icom */
#define PORT_ICOM 60
/* Samsung S3C2440 SoC */
#define PORT_S3C2440 61
/* Motorola i.MX SoC */
#define PORT_IMX 62
#ifdef __KERNEL__
#include <linux/config.h>
......@@ -241,11 +244,11 @@ struct uart_port {
* within.
*/
struct uart_state {
unsigned int close_delay;
unsigned int closing_wait;
unsigned int close_delay; /* msec */
unsigned int closing_wait; /* msec */
#define USF_CLOSING_WAIT_INF (0)
#define USF_CLOSING_WAIT_NONE (65535)
#define USF_CLOSING_WAIT_NONE (~0U)
int count;
int pm_state;
......
......@@ -205,6 +205,8 @@ void kobject_hotplug(struct kobject *kobj, enum kobject_action action)
static struct kset_hotplug_ops null_hotplug_ops;
struct kset_hotplug_ops *hotplug_ops = &null_hotplug_ops;
/* If this kobj does not belong to a kset,
try to find a parent that does. */
if (!top_kobj->kset && top_kobj->parent) {
do {
top_kobj = top_kobj->parent;
......
......@@ -785,12 +785,15 @@ int snd_card_set_dev_pm_callback(snd_card_t *card, int type,
int snd_card_pci_suspend(struct pci_dev *dev, u32 state)
{
snd_card_t *card = pci_get_drvdata(dev);
int err;
if (! card || ! card->pm_suspend)
return 0;
if (card->power_state == SNDRV_CTL_POWER_D3hot)
return 0;
/* FIXME: correct state value? */
return card->pm_suspend(card, 0);
err = card->pm_suspend(card, 0);
pci_save_state(dev);
return err;
}
int snd_card_pci_resume(struct pci_dev *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment