Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 87149
b: refs/heads/master
c: 2b752ac
h: refs/heads/master
i:
  87147: 8050722
v: v3
  • Loading branch information
Linus Torvalds committed Mar 11, 2008
1 parent 5f78791 commit c74c946
Show file tree
Hide file tree
Showing 63 changed files with 2,623 additions and 799 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 15c4a4e2f1337a442fe6c66266a8829afc8ff96f
refs/heads/master: 2b752acd91ecee926483b5f64a8f8bfe06e081fb
7 changes: 5 additions & 2 deletions trunk/Documentation/lguest/lguest.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,12 @@ static void concat(char *dst, char *args[])
unsigned int i, len = 0;

for (i = 0; args[i]; i++) {
if (i) {
strcat(dst+len, " ");
len++;
}
strcpy(dst+len, args[i]);
strcat(dst+len, " ");
len += strlen(args[i]) + 1;
len += strlen(args[i]);
}
/* In case it's empty. */
dst[len] = '\0';
Expand Down
4 changes: 2 additions & 2 deletions trunk/Documentation/pci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ initialization with a pointer to a structure describing the driver


The ID table is an array of struct pci_device_id entries ending with an
all-zero entry; use of the macro DECLARE_PCI_DEVICE_TABLE is the preferred
all-zero entry; use of the macro DEFINE_PCI_DEVICE_TABLE is the preferred
method of declaring the table. Each entry consists of:

vendor,device Vendor and device ID to match (or PCI_ANY_ID)
Expand Down Expand Up @@ -193,7 +193,7 @@ Tips on when/where to use the above attributes:
o Do not mark the struct pci_driver.

o The ID table array should be marked __devinitconst; this is done
automatically if the table is declared with DECLARE_PCI_DEVICE_TABLE().
automatically if the table is declared with DEFINE_PCI_DEVICE_TABLE().

o The probe() and remove() functions should be marked __devinit
and __devexit respectively. All initialization functions
Expand Down
2 changes: 1 addition & 1 deletion trunk/Documentation/scheduler/sched-stats.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ of idleness (idle, busy, and newly idle):

/proc/<pid>/schedstat
----------------
schedstats also adds a new /proc/<pid/schedstat file to include some of
schedstats also adds a new /proc/<pid>/schedstat file to include some of
the same information on a per-process level. There are three fields in
this file correlating for that process to:
1) time spent on the cpu
Expand Down
55 changes: 22 additions & 33 deletions trunk/arch/x86/lguest/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ struct lguest_data lguest_data = {
.blocked_interrupts = { 1 }, /* Block timer interrupts */
.syscall_vec = SYSCALL_VECTOR,
};
static cycle_t clock_base;

/*G:037 async_hcall() is pretty simple: I'm quite proud of it really. We have a
* ring buffer of stored hypercalls which the Host will run though next time we
Expand Down Expand Up @@ -327,8 +326,8 @@ static void lguest_cpuid(unsigned int *ax, unsigned int *bx,
case 1: /* Basic feature request. */
/* We only allow kernel to see SSE3, CMPXCHG16B and SSSE3 */
*cx &= 0x00002201;
/* SSE, SSE2, FXSR, MMX, CMOV, CMPXCHG8B, FPU. */
*dx &= 0x07808101;
/* SSE, SSE2, FXSR, MMX, CMOV, CMPXCHG8B, TSC, FPU. */
*dx &= 0x07808111;
/* The Host can do a nice optimization if it knows that the
* kernel mappings (addresses above 0xC0000000 or whatever
* PAGE_OFFSET is set to) haven't changed. But Linux calls
Expand Down Expand Up @@ -481,7 +480,7 @@ static void lguest_set_pmd(pmd_t *pmdp, pmd_t pmdval)
{
*pmdp = pmdval;
lazy_hcall(LHCALL_SET_PMD, __pa(pmdp)&PAGE_MASK,
(__pa(pmdp)&(PAGE_SIZE-1)), 0);
(__pa(pmdp)&(PAGE_SIZE-1))/4, 0);
}

/* There are a couple of legacy places where the kernel sets a PTE, but we
Expand Down Expand Up @@ -595,19 +594,25 @@ static unsigned long lguest_get_wallclock(void)
return lguest_data.time.tv_sec;
}

/* The TSC is a Time Stamp Counter. The Host tells us what speed it runs at,
* or 0 if it's unusable as a reliable clock source. This matches what we want
* here: if we return 0 from this function, the x86 TSC clock will not register
* itself. */
static unsigned long lguest_cpu_khz(void)
{
return lguest_data.tsc_khz;
}

/* If we can't use the TSC, the kernel falls back to our "lguest_clock", where
* we read the time value given to us by the Host. */
static cycle_t lguest_clock_read(void)
{
unsigned long sec, nsec;

/* If the Host tells the TSC speed, we can trust that. */
if (lguest_data.tsc_khz)
return native_read_tsc();

/* If we can't use the TSC, we read the time value written by the Host.
* Since it's in two parts (seconds and nanoseconds), we risk reading
* it just as it's changing from 99 & 0.999999999 to 100 and 0, and
* getting 99 and 0. As Linux tends to come apart under the stress of
* time travel, we must be careful: */
/* Since the time is in two parts (seconds and nanoseconds), we risk
* reading it just as it's changing from 99 & 0.999999999 to 100 and 0,
* and getting 99 and 0. As Linux tends to come apart under the stress
* of time travel, we must be careful: */
do {
/* First we read the seconds part. */
sec = lguest_data.time.tv_sec;
Expand All @@ -622,27 +627,21 @@ static cycle_t lguest_clock_read(void)
/* Now if the seconds part has changed, try again. */
} while (unlikely(lguest_data.time.tv_sec != sec));

/* Our non-TSC clock is in real nanoseconds. */
/* Our lguest clock is in real nanoseconds. */
return sec*1000000000ULL + nsec;
}

/* This is what we tell the kernel is our clocksource. */
/* This is the fallback clocksource: lower priority than the TSC clocksource. */
static struct clocksource lguest_clock = {
.name = "lguest",
.rating = 400,
.rating = 200,
.read = lguest_clock_read,
.mask = CLOCKSOURCE_MASK(64),
.mult = 1 << 22,
.shift = 22,
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};

/* The "scheduler clock" is just our real clock, adjusted to start at zero */
static unsigned long long lguest_sched_clock(void)
{
return cyc2ns(&lguest_clock, lguest_clock_read() - clock_base);
}

/* We also need a "struct clock_event_device": Linux asks us to set it to go
* off some time in the future. Actually, James Morris figured all this out, I
* just applied the patch. */
Expand Down Expand Up @@ -712,19 +711,8 @@ static void lguest_time_init(void)
/* Set up the timer interrupt (0) to go to our simple timer routine */
set_irq_handler(0, lguest_time_irq);

/* Our clock structure looks like arch/x86/kernel/tsc_32.c if we can
* use the TSC, otherwise it's a dumb nanosecond-resolution clock.
* Either way, the "rating" is set so high that it's always chosen over
* any other clocksource. */
if (lguest_data.tsc_khz)
lguest_clock.mult = clocksource_khz2mult(lguest_data.tsc_khz,
lguest_clock.shift);
clock_base = lguest_clock_read();
clocksource_register(&lguest_clock);

/* Now we've set up our clock, we can use it as the scheduler clock */
pv_time_ops.sched_clock = lguest_sched_clock;

/* We can't set cpumask in the initializer: damn C limitations! Set it
* here and register our timer device. */
lguest_clockevent.cpumask = cpumask_of_cpu(0);
Expand Down Expand Up @@ -995,6 +983,7 @@ __init void lguest_init(void)
/* time operations */
pv_time_ops.get_wallclock = lguest_get_wallclock;
pv_time_ops.time_init = lguest_time_init;
pv_time_ops.get_cpu_khz = lguest_cpu_khz;

/* Now is a good time to look at the implementations of these functions
* before returning to the rest of lguest_init(). */
Expand Down
10 changes: 10 additions & 0 deletions trunk/arch/x86/pci/pcbios.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ static int pci_bios_read(unsigned int seg, unsigned int bus,
"b" (bx),
"D" ((long)reg),
"S" (&pci_indirect));
/*
* Zero-extend the result beyond 8 bits, do not trust the
* BIOS having done it:
*/
*value &= 0xff;
break;
case 2:
__asm__("lcall *(%%esi); cld\n\t"
Expand All @@ -210,6 +215,11 @@ static int pci_bios_read(unsigned int seg, unsigned int bus,
"b" (bx),
"D" ((long)reg),
"S" (&pci_indirect));
/*
* Zero-extend the result beyond 16 bits, do not trust the
* BIOS having done it:
*/
*value &= 0xffff;
break;
case 4:
__asm__("lcall *(%%esi); cld\n\t"
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/base/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ u64 dma_get_required_mask(struct device *dev)
high_totalram += high_totalram - 1;
mask = (((u64)high_totalram) << 32) + 0xffffffff;
}
return mask & *dev->dma_mask;
return mask;
}
EXPORT_SYMBOL_GPL(dma_get_required_mask);
#endif
4 changes: 4 additions & 0 deletions trunk/drivers/base/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ int sysdev_class_register(struct sysdev_class * cls)
pr_debug("Registering sysdev class '%s'\n",
kobject_name(&cls->kset.kobj));
INIT_LIST_HEAD(&cls->drivers);
memset(&cls->kset.kobj, 0x00, sizeof(struct kobject));
cls->kset.kobj.parent = &system_kset->kobj;
cls->kset.kobj.ktype = &ktype_sysdev_class;
cls->kset.kobj.kset = system_kset;
Expand Down Expand Up @@ -227,6 +228,9 @@ int sysdev_register(struct sys_device * sysdev)

pr_debug("Registering sys device '%s'\n", kobject_name(&sysdev->kobj));

/* initialize the kobject to 0, in case it had previously been used */
memset(&sysdev->kobj, 0x00, sizeof(struct kobject));

/* Make sure the kset is set */
sysdev->kobj.kset = &cls->kset;

Expand Down
61 changes: 43 additions & 18 deletions trunk/drivers/char/nozomi.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,14 @@ enum card_type {
F32_8 = 8192, /* 3072 bytes downl. + 1024 bytes uplink * 2 -> 8192 */
};

/* Initialization states a card can be in */
enum card_state {
NOZOMI_STATE_UKNOWN = 0,
NOZOMI_STATE_ENABLED = 1, /* pci device enabled */
NOZOMI_STATE_ALLOCATED = 2, /* config setup done */
NOZOMI_STATE_READY = 3, /* flowcontrols received */
};

/* Two different toggle channels exist */
enum channel_type {
CH_A = 0,
Expand Down Expand Up @@ -385,6 +393,7 @@ struct nozomi {
spinlock_t spin_mutex; /* secures access to registers and tty */

unsigned int index_start;
enum card_state state;
u32 open_ttys;
};

Expand Down Expand Up @@ -686,6 +695,7 @@ static int nozomi_read_config_table(struct nozomi *dc)
dc->last_ier = dc->last_ier | CTRL_DL;
writew(dc->last_ier, dc->reg_ier);

dc->state = NOZOMI_STATE_ALLOCATED;
dev_info(&dc->pdev->dev, "Initialization OK!\n");
return 1;
}
Expand Down Expand Up @@ -944,6 +954,14 @@ static int receive_flow_control(struct nozomi *dc)
case CTRL_APP2:
port = PORT_APP2;
enable_ier = APP2_DL;
if (dc->state == NOZOMI_STATE_ALLOCATED) {
/*
* After card initialization the flow control
* received for APP2 is always the last
*/
dc->state = NOZOMI_STATE_READY;
dev_info(&dc->pdev->dev, "Device READY!\n");
}
break;
default:
dev_err(&dc->pdev->dev,
Expand Down Expand Up @@ -1366,29 +1384,29 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev,

dc->pdev = pdev;

/* Find out what card type it is */
nozomi_get_card_type(dc);

ret = pci_enable_device(dc->pdev);
if (ret) {
dev_err(&pdev->dev, "Failed to enable PCI Device\n");
goto err_free;
}

start = pci_resource_start(dc->pdev, 0);
if (start == 0) {
dev_err(&pdev->dev, "No I/O address for card detected\n");
ret = -ENODEV;
goto err_disable_device;
}

ret = pci_request_regions(dc->pdev, NOZOMI_NAME);
if (ret) {
dev_err(&pdev->dev, "I/O address 0x%04x already in use\n",
(int) /* nozomi_private.io_addr */ 0);
goto err_disable_device;
}

start = pci_resource_start(dc->pdev, 0);
if (start == 0) {
dev_err(&pdev->dev, "No I/O address for card detected\n");
ret = -ENODEV;
goto err_rel_regs;
}

/* Find out what card type it is */
nozomi_get_card_type(dc);

dc->base_addr = ioremap(start, dc->card_type);
if (!dc->base_addr) {
dev_err(&pdev->dev, "Unable to map card MMIO\n");
Expand Down Expand Up @@ -1425,6 +1443,14 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev,
dc->index_start = ndev_idx * MAX_PORT;
ndevs[ndev_idx] = dc;

pci_set_drvdata(pdev, dc);

/* Enable RESET interrupt */
dc->last_ier = RESET;
iowrite16(dc->last_ier, dc->reg_ier);

dc->state = NOZOMI_STATE_ENABLED;

for (i = 0; i < MAX_PORT; i++) {
mutex_init(&dc->port[i].tty_sem);
dc->port[i].tty_open_count = 0;
Expand All @@ -1433,12 +1459,6 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev,
&pdev->dev);
}

/* Enable RESET interrupt. */
dc->last_ier = RESET;
writew(dc->last_ier, dc->reg_ier);

pci_set_drvdata(pdev, dc);

return 0;

err_free_sbuf:
Expand Down Expand Up @@ -1553,7 +1573,7 @@ static int ntty_open(struct tty_struct *tty, struct file *file)
struct nozomi *dc = get_dc_by_tty(tty);
unsigned long flags;

if (!port || !dc)
if (!port || !dc || dc->state != NOZOMI_STATE_READY)
return -ENODEV;

if (mutex_lock_interruptible(&port->tty_sem))
Expand Down Expand Up @@ -1716,6 +1736,10 @@ static int ntty_tiocmget(struct tty_struct *tty, struct file *file)
static int ntty_tiocmset(struct tty_struct *tty, struct file *file,
unsigned int set, unsigned int clear)
{
struct nozomi *dc = get_dc_by_tty(tty);
unsigned long flags;

spin_lock_irqsave(&dc->spin_mutex, flags);
if (set & TIOCM_RTS)
set_rts(tty, 1);
else if (clear & TIOCM_RTS)
Expand All @@ -1725,6 +1749,7 @@ static int ntty_tiocmset(struct tty_struct *tty, struct file *file,
set_dtr(tty, 1);
else if (clear & TIOCM_DTR)
set_dtr(tty, 0);
spin_unlock_irqrestore(&dc->spin_mutex, flags);

return 0;
}
Expand Down Expand Up @@ -1762,7 +1787,7 @@ static int ntty_ioctl_tiocgicount(struct port *port, void __user *argp)
icount.brk = cnow.brk;
icount.buf_overrun = cnow.buf_overrun;

return copy_to_user(argp, &icount, sizeof(icount));
return copy_to_user(argp, &icount, sizeof(icount)) ? -EFAULT : 0;
}

static int ntty_ioctl(struct tty_struct *tty, struct file *file,
Expand Down
6 changes: 0 additions & 6 deletions trunk/drivers/char/riscom8.c
Original file line number Diff line number Diff line change
Expand Up @@ -1620,14 +1620,8 @@ static int __init rc_init_drivers(void)

static void rc_release_drivers(void)
{
unsigned long flags;

spin_lock_irqsave(&riscom_lock, flags);

tty_unregister_driver(riscom_driver);
put_tty_driver(riscom_driver);

spin_unlock_irqrestore(&riscom_lock, flags);
}

#ifndef MODULE
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/gpio/pca953x.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios)
gc->direction_output = pca953x_gpio_direction_output;
gc->get = pca953x_gpio_get_value;
gc->set = pca953x_gpio_set_value;
gc->can_sleep = 1;

gc->base = chip->gpio_start;
gc->ngpio = gpios;
Expand Down
Loading

0 comments on commit c74c946

Please sign in to comment.