Commit dbd43d08 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge branch 'master' of /home/greg/linux/git/torvalds-2.6/

parents c34c07d6 9f737633
...@@ -211,9 +211,8 @@ Controls the kernel's behaviour when an oops or BUG is encountered. ...@@ -211,9 +211,8 @@ Controls the kernel's behaviour when an oops or BUG is encountered.
0: try to continue operation 0: try to continue operation
1: delay a few seconds (to give klogd time to record the oops output) and 1: panic immediatly. If the `panic' sysctl is also non-zero then the
then panic. If the `panic' sysctl is also non-zero then the machine will machine will be rebooted.
be rebooted.
============================================================== ==============================================================
......
...@@ -2648,6 +2648,14 @@ M: dbrownell@users.sourceforge.net ...@@ -2648,6 +2648,14 @@ M: dbrownell@users.sourceforge.net
L: spi-devel-general@lists.sourceforge.net L: spi-devel-general@lists.sourceforge.net
S: Maintained S: Maintained
STABLE BRANCH:
P: Greg Kroah-Hartman
M: greg@kroah.com
P: Chris Wright
M: chrisw@sous-sol.org
L: stable@kernel.org
S: Maintained
TPM DEVICE DRIVER TPM DEVICE DRIVER
P: Kylene Hall P: Kylene Hall
M: kjhall@us.ibm.com M: kjhall@us.ibm.com
......
VERSION = 2 VERSION = 2
PATCHLEVEL = 6 PATCHLEVEL = 6
SUBLEVEL = 18 SUBLEVEL = 18
EXTRAVERSION = -rc3 EXTRAVERSION = -rc4
NAME=Crazed Snow-Weasel NAME=Crazed Snow-Weasel
# *DOCUMENTATION* # *DOCUMENTATION*
......
...@@ -421,18 +421,22 @@ static struct miscdevice sq_dev = { ...@@ -421,18 +421,22 @@ static struct miscdevice sq_dev = {
static int __init sq_api_init(void) static int __init sq_api_init(void)
{ {
int ret;
printk(KERN_NOTICE "sq: Registering store queue API.\n"); printk(KERN_NOTICE "sq: Registering store queue API.\n");
#ifdef CONFIG_PROC_FS
create_proc_read_entry("sq_mapping", 0, 0, sq_mapping_read_proc, 0); create_proc_read_entry("sq_mapping", 0, 0, sq_mapping_read_proc, 0);
#endif
return misc_register(&sq_dev); ret = misc_register(&sq_dev);
if (ret)
remove_proc_entry("sq_mapping", NULL);
return ret;
} }
static void __exit sq_api_exit(void) static void __exit sq_api_exit(void)
{ {
misc_deregister(&sq_dev); misc_deregister(&sq_dev);
remove_proc_entry("sq_mapping", NULL);
} }
module_init(sq_api_init); module_init(sq_api_init);
......
...@@ -203,7 +203,7 @@ int __cpuinit init_smp_flush(void) ...@@ -203,7 +203,7 @@ int __cpuinit init_smp_flush(void)
{ {
int i; int i;
for_each_cpu_mask(i, cpu_possible_map) { for_each_cpu_mask(i, cpu_possible_map) {
spin_lock_init(&per_cpu(flush_state.tlbstate_lock, i)); spin_lock_init(&per_cpu(flush_state, i).tlbstate_lock);
} }
return 0; return 0;
} }
......
...@@ -129,11 +129,15 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) ...@@ -129,11 +129,15 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
struct acpi_memory_info *info, *n; struct acpi_memory_info *info, *n;
if (!list_empty(&mem_device->res_list))
return 0;
status = acpi_walk_resources(mem_device->device->handle, METHOD_NAME__CRS, status = acpi_walk_resources(mem_device->device->handle, METHOD_NAME__CRS,
acpi_memory_get_resource, mem_device); acpi_memory_get_resource, mem_device);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
list_for_each_entry_safe(info, n, &mem_device->res_list, list) list_for_each_entry_safe(info, n, &mem_device->res_list, list)
kfree(info); kfree(info);
INIT_LIST_HEAD(&mem_device->res_list);
return -EINVAL; return -EINVAL;
} }
...@@ -230,17 +234,10 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) ...@@ -230,17 +234,10 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
* (i.e. memory-hot-remove function) * (i.e. memory-hot-remove function)
*/ */
list_for_each_entry(info, &mem_device->res_list, list) { list_for_each_entry(info, &mem_device->res_list, list) {
u64 start_pfn, end_pfn; if (info->enabled) { /* just sanity check...*/
start_pfn = info->start_addr >> PAGE_SHIFT;
end_pfn = (info->start_addr + info->length - 1) >> PAGE_SHIFT;
if (pfn_valid(start_pfn) || pfn_valid(end_pfn)) {
/* already enabled. try next area */
num_enabled++; num_enabled++;
continue; continue;
} }
result = add_memory(node, info->start_addr, info->length); result = add_memory(node, info->start_addr, info->length);
if (result) if (result)
continue; continue;
......
...@@ -311,7 +311,8 @@ static void hvsi_recv_control(struct hvsi_struct *hp, uint8_t *packet, ...@@ -311,7 +311,8 @@ static void hvsi_recv_control(struct hvsi_struct *hp, uint8_t *packet,
/* CD went away; no more connection */ /* CD went away; no more connection */
pr_debug("hvsi%i: CD dropped\n", hp->index); pr_debug("hvsi%i: CD dropped\n", hp->index);
hp->mctrl &= TIOCM_CD; hp->mctrl &= TIOCM_CD;
if (!(hp->tty->flags & CLOCAL)) /* If userland hasn't done an open(2) yet, hp->tty is NULL. */
if (hp->tty && !(hp->tty->flags & CLOCAL))
*to_hangup = hp->tty; *to_hangup = hp->tty;
} }
break; break;
...@@ -986,10 +987,7 @@ static void hvsi_write_worker(void *arg) ...@@ -986,10 +987,7 @@ static void hvsi_write_worker(void *arg)
start_j = 0; start_j = 0;
#endif /* DEBUG */ #endif /* DEBUG */
wake_up_all(&hp->emptyq); wake_up_all(&hp->emptyq);
if (test_bit(TTY_DO_WRITE_WAKEUP, &hp->tty->flags) tty_wakeup(hp->tty);
&& hp->tty->ldisc.write_wakeup)
hp->tty->ldisc.write_wakeup(hp->tty);
wake_up_interruptible(&hp->tty->write_wait);
} }
out: out:
......
...@@ -25,12 +25,12 @@ ...@@ -25,12 +25,12 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/random.h> #include <linux/random.h>
#include <linux/clk.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/device.h> #include <linux/platform_device.h>
#include <linux/hw_random.h> #include <linux/hw_random.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/hardware/clock.h>
#define RNG_OUT_REG 0x00 /* Output register */ #define RNG_OUT_REG 0x00 /* Output register */
#define RNG_STAT_REG 0x04 /* Status register #define RNG_STAT_REG 0x04 /* Status register
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
static void __iomem *rng_base; static void __iomem *rng_base;
static struct clk *rng_ick; static struct clk *rng_ick;
static struct device *rng_dev; static struct platform_device *rng_dev;
static u32 omap_rng_read_reg(int reg) static u32 omap_rng_read_reg(int reg)
{ {
...@@ -83,9 +83,8 @@ static struct hwrng omap_rng_ops = { ...@@ -83,9 +83,8 @@ static struct hwrng omap_rng_ops = {
.data_read = omap_rng_data_read, .data_read = omap_rng_data_read,
}; };
static int __init omap_rng_probe(struct device *dev) static int __init omap_rng_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct resource *res, *mem; struct resource *res, *mem;
int ret; int ret;
...@@ -98,13 +97,11 @@ static int __init omap_rng_probe(struct device *dev) ...@@ -98,13 +97,11 @@ static int __init omap_rng_probe(struct device *dev)
if (cpu_is_omap24xx()) { if (cpu_is_omap24xx()) {
rng_ick = clk_get(NULL, "rng_ick"); rng_ick = clk_get(NULL, "rng_ick");
if (IS_ERR(rng_ick)) { if (IS_ERR(rng_ick)) {
dev_err(dev, "Could not get rng_ick\n"); dev_err(&pdev->dev, "Could not get rng_ick\n");
ret = PTR_ERR(rng_ick); ret = PTR_ERR(rng_ick);
return ret; return ret;
} } else
else { clk_enable(rng_ick);
clk_use(rng_ick);
}
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
...@@ -117,7 +114,7 @@ static int __init omap_rng_probe(struct device *dev) ...@@ -117,7 +114,7 @@ static int __init omap_rng_probe(struct device *dev)
if (mem == NULL) if (mem == NULL)
return -EBUSY; return -EBUSY;
dev_set_drvdata(dev, mem); dev_set_drvdata(&pdev->dev, mem);
rng_base = (u32 __iomem *)io_p2v(res->start); rng_base = (u32 __iomem *)io_p2v(res->start);
ret = hwrng_register(&omap_rng_ops); ret = hwrng_register(&omap_rng_ops);
...@@ -127,25 +124,25 @@ static int __init omap_rng_probe(struct device *dev) ...@@ -127,25 +124,25 @@ static int __init omap_rng_probe(struct device *dev)
return ret; return ret;
} }
dev_info(dev, "OMAP Random Number Generator ver. %02x\n", dev_info(&pdev->dev, "OMAP Random Number Generator ver. %02x\n",
omap_rng_read_reg(RNG_REV_REG)); omap_rng_read_reg(RNG_REV_REG));
omap_rng_write_reg(RNG_MASK_REG, 0x1); omap_rng_write_reg(RNG_MASK_REG, 0x1);
rng_dev = dev; rng_dev = pdev;
return 0; return 0;
} }
static int __exit omap_rng_remove(struct device *dev) static int __exit omap_rng_remove(struct platform_device *pdev)
{ {
struct resource *mem = dev_get_drvdata(dev); struct resource *mem = dev_get_drvdata(&pdev->dev);
hwrng_unregister(&omap_rng_ops); hwrng_unregister(&omap_rng_ops);
omap_rng_write_reg(RNG_MASK_REG, 0x0); omap_rng_write_reg(RNG_MASK_REG, 0x0);
if (cpu_is_omap24xx()) { if (cpu_is_omap24xx()) {
clk_unuse(rng_ick); clk_disable(rng_ick);
clk_put(rng_ick); clk_put(rng_ick);
} }
...@@ -157,18 +154,16 @@ static int __exit omap_rng_remove(struct device *dev) ...@@ -157,18 +154,16 @@ static int __exit omap_rng_remove(struct device *dev)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int omap_rng_suspend(struct device *dev, pm_message_t message, u32 level) static int omap_rng_suspend(struct platform_device *pdev, pm_message_t message)
{ {
omap_rng_write_reg(RNG_MASK_REG, 0x0); omap_rng_write_reg(RNG_MASK_REG, 0x0);
return 0; return 0;
} }
static int omap_rng_resume(struct device *dev, pm_message_t message, u32 level) static int omap_rng_resume(struct platform_device *pdev)
{ {
omap_rng_write_reg(RNG_MASK_REG, 0x1); omap_rng_write_reg(RNG_MASK_REG, 0x1);
return 0;
return 1;
} }
#else #else
...@@ -179,9 +174,11 @@ static int omap_rng_resume(struct device *dev, pm_message_t message, u32 level) ...@@ -179,9 +174,11 @@ static int omap_rng_resume(struct device *dev, pm_message_t message, u32 level)
#endif #endif
static struct device_driver omap_rng_driver = { static struct platform_driver omap_rng_driver = {
.driver = {
.name = "omap_rng", .name = "omap_rng",
.bus = &platform_bus_type, .owner = THIS_MODULE,
},
.probe = omap_rng_probe, .probe = omap_rng_probe,
.remove = __exit_p(omap_rng_remove), .remove = __exit_p(omap_rng_remove),
.suspend = omap_rng_suspend, .suspend = omap_rng_suspend,
...@@ -193,12 +190,12 @@ static int __init omap_rng_init(void) ...@@ -193,12 +190,12 @@ static int __init omap_rng_init(void)
if (!cpu_is_omap16xx() && !cpu_is_omap24xx()) if (!cpu_is_omap16xx() && !cpu_is_omap24xx())
return -ENODEV; return -ENODEV;
return driver_register(&omap_rng_driver); return platform_driver_register(&omap_rng_driver);
} }
static void __exit omap_rng_exit(void) static void __exit omap_rng_exit(void)
{ {
driver_unregister(&omap_rng_driver); platform_driver_unregister(&omap_rng_driver);
} }
module_init(omap_rng_init); module_init(omap_rng_init);
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/rcupdate.h> #include <linux/rcupdate.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/kobject.h> #include <linux/kobject.h>
#include <linux/platform_device.h>
#define EDAC_MC_LABEL_LEN 31 #define EDAC_MC_LABEL_LEN 31
#define MC_PROC_NAME_MAX_LEN 7 #define MC_PROC_NAME_MAX_LEN 7
......
...@@ -232,7 +232,7 @@ static void scx200_acb_poll(struct scx200_acb_iface *iface) ...@@ -232,7 +232,7 @@ static void scx200_acb_poll(struct scx200_acb_iface *iface)
unsigned long timeout; unsigned long timeout;
timeout = jiffies + POLL_TIMEOUT; timeout = jiffies + POLL_TIMEOUT;
while (time_before(jiffies, timeout)) { while (1) {
status = inb(ACBST); status = inb(ACBST);
/* Reset the status register to avoid the hang */ /* Reset the status register to avoid the hang */
...@@ -242,7 +242,10 @@ static void scx200_acb_poll(struct scx200_acb_iface *iface) ...@@ -242,7 +242,10 @@ static void scx200_acb_poll(struct scx200_acb_iface *iface)
scx200_acb_machine(iface, status); scx200_acb_machine(iface, status);
return; return;
} }
yield(); if (time_after(jiffies, timeout))
break;
cpu_relax();
cond_resched();
} }
dev_err(&iface->adapter.dev, "timeout in state %s\n", dev_err(&iface->adapter.dev, "timeout in state %s\n",
......
...@@ -2515,6 +2515,9 @@ static int sbp2scsi_slave_configure(struct scsi_device *sdev) ...@@ -2515,6 +2515,9 @@ static int sbp2scsi_slave_configure(struct scsi_device *sdev)
sdev->skip_ms_page_8 = 1; sdev->skip_ms_page_8 = 1;
if (scsi_id->workarounds & SBP2_WORKAROUND_FIX_CAPACITY) if (scsi_id->workarounds & SBP2_WORKAROUND_FIX_CAPACITY)
sdev->fix_capacity = 1; sdev->fix_capacity = 1;
if (scsi_id->ne->guid_vendor_id == 0x0010b9 && /* Maxtor's OUI */
(sdev->type == TYPE_DISK || sdev->type == TYPE_RBC))
sdev->allow_restart = 1;
return 0; return 0;
} }
......
...@@ -256,7 +256,6 @@ typedef struct ...@@ -256,7 +256,6 @@ typedef struct
#define NO_ORDER_CHECK_MASK 0x00000010 #define NO_ORDER_CHECK_MASK 0x00000010
#define LOW_CHANNEL_MASK 0x00000020 #define LOW_CHANNEL_MASK 0x00000020
#define NO_HSCX30_MASK 0x00000040 #define NO_HSCX30_MASK 0x00000040
#define MODE_MASK 0x00000080
#define SET_BOARD 0x00001000 #define SET_BOARD 0x00001000
#define SET_CRC4 0x00030000 #define SET_CRC4 0x00030000
#define SET_L1_TRISTATE 0x00040000 #define SET_L1_TRISTATE 0x00040000
......
...@@ -162,7 +162,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) ...@@ -162,7 +162,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
goto out; goto out;
} }
min_spacing = mddev->array_size; min_spacing = conf->array_size;
sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *)); sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *));
/* min_spacing is the minimum spacing that will fit the hash /* min_spacing is the minimum spacing that will fit the hash
...@@ -171,7 +171,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) ...@@ -171,7 +171,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
* that is larger than min_spacing as use the size of that as * that is larger than min_spacing as use the size of that as
* the actual spacing * the actual spacing
*/ */
conf->hash_spacing = mddev->array_size; conf->hash_spacing = conf->array_size;
for (i=0; i < cnt-1 ; i++) { for (i=0; i < cnt-1 ; i++) {
sector_t sz = 0; sector_t sz = 0;
int j; int j;
...@@ -228,7 +228,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) ...@@ -228,7 +228,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
curr_offset = 0; curr_offset = 0;
i = 0; i = 0;
for (curr_offset = 0; for (curr_offset = 0;
curr_offset < mddev->array_size; curr_offset < conf->array_size;
curr_offset += conf->hash_spacing) { curr_offset += conf->hash_spacing) {
while (i < mddev->raid_disks-1 && while (i < mddev->raid_disks-1 &&
......
...@@ -173,6 +173,9 @@ pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table, ...@@ -173,6 +173,9 @@ pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table,
return; return;
} }
if (p->producer_consumer == ACPI_PRODUCER)
return;
if (p->resource_type == ACPI_MEMORY_RANGE) if (p->resource_type == ACPI_MEMORY_RANGE)
pnpacpi_parse_allocated_memresource(res_table, pnpacpi_parse_allocated_memresource(res_table,
p->minimum, p->address_length); p->minimum, p->address_length);
...@@ -252,9 +255,14 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, ...@@ -252,9 +255,14 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
break; break;
case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
if (res->data.ext_address64.producer_consumer == ACPI_PRODUCER)
return AE_OK;
break; break;
case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
if (res->data.extended_irq.producer_consumer == ACPI_PRODUCER)
return AE_OK;
for (i = 0; i < res->data.extended_irq.interrupt_count; i++) { for (i = 0; i < res->data.extended_irq.interrupt_count; i++) {
pnpacpi_parse_allocated_irqresource(res_table, pnpacpi_parse_allocated_irqresource(res_table,
res->data.extended_irq.interrupts[i], res->data.extended_irq.interrupts[i],
......
...@@ -1913,9 +1913,6 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i ...@@ -1913,9 +1913,6 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i
u8 chip_rev; u8 chip_rev;
u32 dac; u32 dac;
if (!par->vram_size) /* may have already been probed */
par->vram_size = aty_ld_le32(CONFIG_MEMSIZE) & 0x03FFFFFF;
/* Get the chip revision */ /* Get the chip revision */
chip_rev = (aty_ld_le32(CONFIG_CNTL) >> 16) & 0x1F; chip_rev = (aty_ld_le32(CONFIG_CNTL) >> 16) & 0x1F;
...@@ -2028,9 +2025,6 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i ...@@ -2028,9 +2025,6 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i
aty128_init_engine(par); aty128_init_engine(par);
if (register_framebuffer(info) < 0)
return 0;
par->pm_reg = pci_find_capability(pdev, PCI_CAP_ID_PM); par->pm_reg = pci_find_capability(pdev, PCI_CAP_ID_PM);
par->pdev = pdev; par->pdev = pdev;
par->asleep = 0; par->asleep = 0;
...@@ -2040,6 +2034,9 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i ...@@ -2040,6 +2034,9 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i
aty128_bl_init(par); aty128_bl_init(par);
#endif #endif
if (register_framebuffer(info) < 0)
return 0;
printk(KERN_INFO "fb%d: %s frame buffer device on %s\n", printk(KERN_INFO "fb%d: %s frame buffer device on %s\n",
info->node, info->fix.id, video_card); info->node, info->fix.id, video_card);
...@@ -2089,7 +2086,6 @@ static int __devinit aty128_probe(struct pci_dev *pdev, const struct pci_device_ ...@@ -2089,7 +2086,6 @@ static int __devinit aty128_probe(struct pci_dev *pdev, const struct pci_device_
par = info->par; par = info->par;
info->pseudo_palette = par->pseudo_palette; info->pseudo_palette = par->pseudo_palette;
info->fix = aty128fb_fix;
/* Virtualize mmio region */ /* Virtualize mmio region */
info->fix.mmio_start = reg_addr; info->fix.mmio_start = reg_addr;
......
...@@ -164,20 +164,16 @@ int au1100fb_setmode(struct au1100fb_device *fbdev) ...@@ -164,20 +164,16 @@ int au1100fb_setmode(struct au1100fb_device *fbdev)
} }
info->screen_size = info->fix.line_length * info->var.yres_virtual; info->screen_size = info->fix.line_length * info->var.yres_virtual;
info->var.rotate = ((fbdev->panel->control_base&LCD_CONTROL_SM_MASK) \
>> LCD_CONTROL_SM_BIT) * 90;
/* Determine BPP mode and format */ /* Determine BPP mode and format */
fbdev->regs->lcd_control = fbdev->panel->control_base | fbdev->regs->lcd_control = fbdev->panel->control_base;
((info->var.rotate/90) << LCD_CONTROL_SM_BIT);
fbdev->regs->lcd_intenable = 0;
fbdev->regs->lcd_intstatus = 0;
fbdev->regs->lcd_horztiming = fbdev->panel->horztiming; fbdev->regs->lcd_horztiming = fbdev->panel->horztiming;
fbdev->regs->lcd_verttiming = fbdev->panel->verttiming; fbdev->regs->lcd_verttiming = fbdev->panel->verttiming;
fbdev->regs->lcd_clkcontrol = fbdev->panel->clkcontrol_base; fbdev->regs->lcd_clkcontrol = fbdev->panel->clkcontrol_base;
fbdev->regs->lcd_intenable = 0;
fbdev->regs->lcd_intstatus = 0;
fbdev->regs->lcd_dmaaddr0 = LCD_DMA_SA_N(fbdev->fb_phys); fbdev->regs->lcd_dmaaddr0 = LCD_DMA_SA_N(fbdev->fb_phys);
if (panel_is_dual(fbdev->panel)) { if (panel_is_dual(fbdev->panel)) {
...@@ -206,6 +202,8 @@ int au1100fb_setmode(struct au1100fb_device *fbdev) ...@@ -206,6 +202,8 @@ int au1100fb_setmode(struct au1100fb_device *fbdev)
/* Resume controller */ /* Resume controller */
fbdev->regs->lcd_control |= LCD_CONTROL_GO; fbdev->regs->lcd_control |= LCD_CONTROL_GO;
mdelay(10);
au1100fb_fb_blank(VESA_NO_BLANKING, info);
return 0; return 0;
} }
......
...@@ -512,7 +512,11 @@ befs_utf2nls(struct super_block *sb, const char *in, ...@@ -512,7 +512,11 @@ befs_utf2nls(struct super_block *sb, const char *in,
wchar_t uni; wchar_t uni;
int unilen, utflen; int unilen, utflen;
char *result; char *result;
int maxlen = in_len; /* The utf8->nls conversion can't make more chars */ /* The utf8->nls conversion won't make the final nls string bigger
* than the utf one, but if the string is pure ascii they'll have the
* same width and an extra char is needed to save the additional \0
*/
int maxlen = in_len + 1;
befs_debug(sb, "---> utf2nls()"); befs_debug(sb, "---> utf2nls()");
...@@ -588,7 +592,10 @@ befs_nls2utf(struct super_block *sb, const char *in, ...@@ -588,7 +592,10 @@ befs_nls2utf(struct super_block *sb, const char *in,
wchar_t uni; wchar_t uni;
int unilen, utflen; int unilen, utflen;
char *result; char *result;
int maxlen = 3 * in_len; /* There're nls characters that will translate to 3-chars-wide UTF-8
* characters, a additional byte is needed to save the final \0
* in special cases */
int maxlen = (3 * in_len) + 1;
befs_debug(sb, "---> nls2utf()\n"); befs_debug(sb, "---> nls2utf()\n");
......
...@@ -48,8 +48,8 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp) ...@@ -48,8 +48,8 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
return 0; return 0;
} }
reiserfs_write_lock(inode->i_sb);
mutex_lock(&inode->i_mutex); mutex_lock(&inode->i_mutex);
reiserfs_write_lock(inode->i_sb);
/* freeing preallocation only involves relogging blocks that /* freeing preallocation only involves relogging blocks that
* are already in the current transaction. preallocation gets * are already in the current transaction. preallocation gets
* freed at the end of each transaction, so it is impossible for * freed at the end of each transaction, so it is impossible for
......
...@@ -39,14 +39,10 @@ void reiserfs_delete_inode(struct inode *inode) ...@@ -39,14 +39,10 @@ void reiserfs_delete_inode(struct inode *inode)
/* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */ /* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */
if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */ if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */
mutex_lock(&inode->i_mutex);
reiserfs_delete_xattrs(inode); reiserfs_delete_xattrs(inode);
if (journal_begin(&th, inode->i_sb, jbegin_count)) { if (journal_begin(&th, inode->i_sb, jbegin_count))
mutex_unlock(&inode->i_mutex);
goto out; goto out;
}
reiserfs_update_inode_transaction(inode); reiserfs_update_inode_transaction(inode);
err = reiserfs_delete_object(&th, inode); err = reiserfs_delete_object(&th, inode);
...@@ -57,12 +53,8 @@ void reiserfs_delete_inode(struct inode *inode) ...@@ -57,12 +53,8 @@ void reiserfs_delete_inode(struct inode *inode)
if (!err) if (!err)
DQUOT_FREE_INODE(inode); DQUOT_FREE_INODE(inode);
if (journal_end(&th, inode->i_sb, jbegin_count)) { if (journal_end(&th, inode->i_sb, jbegin_count))
mutex_unlock(&inode->i_mutex);
goto out; goto out;
}
mutex_unlock(&inode->i_mutex);
/* check return value from reiserfs_delete_object after /* check return value from reiserfs_delete_object after
* ending the transaction * ending the transaction
...@@ -2348,6 +2340,7 @@ static int reiserfs_write_full_page(struct page *page, ...@@ -2348,6 +2340,7 @@ static int reiserfs_write_full_page(struct page *page,
unsigned long end_index = inode->i_size >> PAGE_CACHE_SHIFT; unsigned long end_index = inode->i_size >> PAGE_CACHE_SHIFT;
int error = 0; int error = 0;
unsigned long block; unsigned long block;
sector_t last_block;
struct buffer_head *head, *bh; struct buffer_head *head, *bh;
int partial = 0; int partial = 0;
int nr = 0; int nr = 0;
...@@ -2395,10 +2388,19 @@ static int reiserfs_write_full_page(struct page *page, ...@@ -2395,10 +2388,19 @@ static int reiserfs_write_full_page(struct page *page,
} }
bh = head; bh = head;
block = page->index << (PAGE_CACHE_SHIFT - s->s_blocksize_bits); block = page->index << (PAGE_CACHE_SHIFT - s->s_blocksize_bits);
last_block = (i_size_read(inode) - 1) >> inode->i_blkbits;
/* first map all the buffers, logging any direct items we find */ /* first map all the buffers, logging any direct items we find */
do { do {
if ((checked || buffer_dirty(bh)) && (!buffer_mapped(bh) || if (block > last_block) {
(buffer_mapped(bh) /*
* This can happen when the block size is less than
* the page size. The corresponding bytes in the page
* were zero filled above
*/
clear_buffer_dirty(bh);
set_buffer_uptodate(bh);
} else if ((checked || buffer_dirty(bh)) &&
(!buffer_mapped(bh) || (buffer_mapped(bh)
&& bh->b_blocknr == && bh->b_blocknr ==
0))) { 0))) {
/* not mapped yet, or it points to a direct item, search /* not mapped yet, or it points to a direct item, search
......
...@@ -116,12 +116,12 @@ static int reiserfs_unpack(struct inode *inode, struct file *filp) ...@@ -116,12 +116,12 @@ static int reiserfs_unpack(struct inode *inode, struct file *filp)
if (REISERFS_I(inode)->i_flags & i_nopack_mask) { if (REISERFS_I(inode)->i_flags & i_nopack_mask) {
return 0; return 0;
} }
reiserfs_write_lock(inode->i_sb);
/* we need to make sure nobody is changing the file size beneath /* we need to make sure nobody is changing the file size beneath
** us ** us
*/ */
mutex_lock(&inode->i_mutex); mutex_lock(&inode->i_mutex);
reiserfs_write_lock(inode->i_sb);
write_from = inode->i_size & (blocksize - 1); write_from = inode->i_size & (blocksize - 1);
/* if we are on a block boundary, we are already unpacked. */ /* if we are on a block boundary, we are already unpacked. */
......
...@@ -75,6 +75,12 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err) ...@@ -75,6 +75,12 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err)
} }
*err = -ENOSPC; *err = -ENOSPC;
UDF_I_UNIQUE(inode) = 0;
UDF_I_LENEXTENTS(inode) = 0;
UDF_I_NEXT_ALLOC_BLOCK(inode) = 0;
UDF_I_NEXT_ALLOC_GOAL(inode) = 0;
UDF_I_STRAT4096(inode) = 0;
block = udf_new_block(dir->i_sb, NULL, UDF_I_LOCATION(dir).partitionReferenceNum, block = udf_new_block(dir->i_sb, NULL, UDF_I_LOCATION(dir).partitionReferenceNum,
start, err); start, err);
if (*err) if (*err)
...@@ -84,11 +90,6 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err) ...@@ -84,11 +90,6 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err)
} }
mutex_lock(&sbi->s_alloc_mutex); mutex_lock(&sbi->s_alloc_mutex);
UDF_I_UNIQUE(inode) = 0;
UDF_I_LENEXTENTS(inode) = 0;
UDF_I_NEXT_ALLOC_BLOCK(inode) = 0;
UDF_I_NEXT_ALLOC_GOAL(inode) = 0;
UDF_I_STRAT4096(inode) = 0;
if (UDF_SB_LVIDBH(sb)) if (UDF_SB_LVIDBH(sb))
{ {
struct logicalVolHeaderDesc *lvhd; struct logicalVolHeaderDesc *lvhd;
......
...@@ -248,7 +248,7 @@ static void ufs_change_blocknr(struct inode *inode, unsigned int baseblk, ...@@ -248,7 +248,7 @@ static void ufs_change_blocknr(struct inode *inode, unsigned int baseblk,
if (likely(cur_index != index)) { if (likely(cur_index != index)) {
page = ufs_get_locked_page(mapping, index); page = ufs_get_locked_page(mapping, index);
if (IS_ERR(page)) if (!page || IS_ERR(page)) /* it was truncated or EIO */
continue; continue;
} else } else
page = locked_page; page = locked_page;
......
...@@ -251,12 +251,12 @@ struct page *ufs_get_locked_page(struct address_space *mapping, ...@@ -251,12 +251,12 @@ struct page *ufs_get_locked_page(struct address_space *mapping,
{ {
struct page *page; struct page *page;
try_again:
page = find_lock_page(mapping, index); page = find_lock_page(mapping, index);
if (!page) { if (!page) {
page = read_cache_page(mapping, index, page = read_cache_page(mapping, index,
(filler_t*)mapping->a_ops->readpage, (filler_t*)mapping->a_ops->readpage,
NULL); NULL);
if (IS_ERR(page)) { if (IS_ERR(page)) {
printk(KERN_ERR "ufs_change_blocknr: " printk(KERN_ERR "ufs_change_blocknr: "
"read_cache_page error: ino %lu, index: %lu\n", "read_cache_page error: ino %lu, index: %lu\n",
...@@ -266,6 +266,14 @@ struct page *ufs_get_locked_page(struct address_space *mapping, ...@@ -266,6 +266,14 @@ struct page *ufs_get_locked_page(struct address_space *mapping,
lock_page(page); lock_page(page);
if (unlikely(page->mapping == NULL)) {
/* Truncate got there first */
unlock_page(page);
page_cache_release(page);
page = NULL;
goto out;
}
if (!PageUptodate(page) || PageError(page)) { if (!PageUptodate(page) || PageError(page)) {
unlock_page(page); unlock_page(page);
page_cache_release(page); page_cache_release(page);
...@@ -275,14 +283,7 @@ struct page *ufs_get_locked_page(struct address_space *mapping, ...@@ -275,14 +283,7 @@ struct page *ufs_get_locked_page(struct address_space *mapping,
mapping->host->i_ino, index); mapping->host->i_ino, index);
page = ERR_PTR(-EIO); page = ERR_PTR(-EIO);
goto out;
}
} }
if (unlikely(!page->mapping || !page_has_buffers(page))) {
unlock_page(page);
page_cache_release(page);
goto try_again;/*we really need these buffers*/
} }
out: out:
return page; return page;
......
#ifndef __LINUX_DEBUG_LOCKING_H #ifndef __LINUX_DEBUG_LOCKING_H
#define __LINUX_DEBUG_LOCKING_H #define __LINUX_DEBUG_LOCKING_H
struct task_struct;
extern int debug_locks; extern int debug_locks;
extern int debug_locks_silent; extern int debug_locks_silent;
......
...@@ -1557,6 +1557,14 @@ static inline void freeze(struct task_struct *p) ...@@ -1557,6 +1557,14 @@ static inline void freeze(struct task_struct *p)
p->flags |= PF_FREEZE; p->flags |= PF_FREEZE;
} }
/*
* Sometimes we may need to cancel the previous 'freeze' request
*/
static inline void do_not_freeze(struct task_struct *p)
{
p->flags &= ~PF_FREEZE;
}
/* /*
* Wake up a frozen process * Wake up a frozen process
*/ */
......
...@@ -41,23 +41,23 @@ DECLARE_PER_CPU(struct vm_event_state, vm_event_states); ...@@ -41,23 +41,23 @@ DECLARE_PER_CPU(struct vm_event_state, vm_event_states);
static inline void __count_vm_event(enum vm_event_item item) static inline void __count_vm_event(enum vm_event_item item)
{ {
__get_cpu_var(vm_event_states.event[item])++; __get_cpu_var(vm_event_states).event[item]++;
} }
static inline void count_vm_event(enum vm_event_item item) static inline void count_vm_event(enum vm_event_item item)
{ {
get_cpu_var(vm_event_states.event[item])++; get_cpu_var(vm_event_states).event[item]++;
put_cpu(); put_cpu();
} }
static inline void __count_vm_events(enum vm_event_item item, long delta) static inline void __count_vm_events(enum vm_event_item item, long delta)
{ {
__get_cpu_var(vm_event_states.event[item]) += delta; __get_cpu_var(vm_event_states).event[item] += delta;
} }
static inline void count_vm_events(enum vm_event_item item, long delta) static inline void count_vm_events(enum vm_event_item item, long delta)
{ {
get_cpu_var(vm_event_states.event[item]) += delta; get_cpu_var(vm_event_states).event[item] += delta;
put_cpu(); put_cpu();
} }
......
...@@ -1387,9 +1387,11 @@ long do_fork(unsigned long clone_flags, ...@@ -1387,9 +1387,11 @@ long do_fork(unsigned long clone_flags,
if (clone_flags & CLONE_VFORK) { if (clone_flags & CLONE_VFORK) {
wait_for_completion(&vfork); wait_for_completion(&vfork);
if (unlikely (current->ptrace & PT_TRACE_VFORK_DONE)) if (unlikely (current->ptrace & PT_TRACE_VFORK_DONE)) {
current->ptrace_message = nr;
ptrace_notify ((PTRACE_EVENT_VFORK_DONE << 8) | SIGTRAP); ptrace_notify ((PTRACE_EVENT_VFORK_DONE << 8) | SIGTRAP);
} }
}
} else { } else {
free_pid(pid); free_pid(pid);
nr = PTR_ERR(p); nr = PTR_ERR(p);
......
...@@ -948,6 +948,7 @@ static int unqueue_me(struct futex_q *q) ...@@ -948,6 +948,7 @@ static int unqueue_me(struct futex_q *q)
/* In the common case we don't take the spinlock, which is nice. */ /* In the common case we don't take the spinlock, which is nice. */
retry: retry:
lock_ptr = q->lock_ptr; lock_ptr = q->lock_ptr;
barrier();
if (lock_ptr != 0) { if (lock_ptr != 0) {
spin_lock(lock_ptr); spin_lock(lock_ptr);
/* /*
......
...@@ -39,7 +39,7 @@ void compat_exit_robust_list(struct task_struct *curr) ...@@ -39,7 +39,7 @@ void compat_exit_robust_list(struct task_struct *curr)
{ {
struct compat_robust_list_head __user *head = curr->compat_robust_list; struct compat_robust_list_head __user *head = curr->compat_robust_list;
struct robust_list __user *entry, *pending; struct robust_list __user *entry, *pending;
unsigned int limit = ROBUST_LIST_LIMIT, pi; unsigned int limit = ROBUST_LIST_LIMIT, pi, pip;
compat_uptr_t uentry, upending; compat_uptr_t uentry, upending;
compat_long_t futex_offset; compat_long_t futex_offset;
...@@ -59,10 +59,10 @@ void compat_exit_robust_list(struct task_struct *curr) ...@@ -59,10 +59,10 @@ void compat_exit_robust_list(struct task_struct *curr)
* if it exists: * if it exists:
*/ */
if (fetch_robust_entry(&upending, &pending, if (fetch_robust_entry(&upending, &pending,
&head->list_op_pending, &pi)) &head->list_op_pending, &pip))
return; return;
if (upending) if (upending)
handle_futex_death((void *)pending + futex_offset, curr, pi); handle_futex_death((void *)pending + futex_offset, curr, pip);
while (compat_ptr(uentry) != &head->list) { while (compat_ptr(uentry) != &head->list) {
/* /*
......
...@@ -66,13 +66,25 @@ static inline void freeze_process(struct task_struct *p) ...@@ -66,13 +66,25 @@ static inline void freeze_process(struct task_struct *p)
} }
} }
static void cancel_freezing(struct task_struct *p)
{
unsigned long flags;
if (freezing(p)) {
pr_debug(" clean up: %s\n", p->comm);
do_not_freeze(p);
spin_lock_irqsave(&p->sighand->siglock, flags);
recalc_sigpending_tsk(p);
spin_unlock_irqrestore(&p->sighand->siglock, flags);
}
}
/* 0 = success, else # of processes that we failed to stop */ /* 0 = success, else # of processes that we failed to stop */
int freeze_processes(void) int freeze_processes(void)
{ {
int todo, nr_user, user_frozen; int todo, nr_user, user_frozen;
unsigned long start_time; unsigned long start_time;
struct task_struct *g, *p; struct task_struct *g, *p;
unsigned long flags;
printk( "Stopping tasks: " ); printk( "Stopping tasks: " );
start_time = jiffies; start_time = jiffies;
...@@ -85,6 +97,10 @@ int freeze_processes(void) ...@@ -85,6 +97,10 @@ int freeze_processes(void)
continue; continue;
if (frozen(p)) if (frozen(p))
continue; continue;
if (p->state == TASK_TRACED && frozen(p->parent)) {
cancel_freezing(p);
continue;
}
if (p->mm && !(p->flags & PF_BORROWED_MM)) { if (p->mm && !(p->flags & PF_BORROWED_MM)) {
/* The task is a user-space one. /* The task is a user-space one.
* Freeze it unless there's a vfork completion * Freeze it unless there's a vfork completion
...@@ -126,13 +142,7 @@ int freeze_processes(void) ...@@ -126,13 +142,7 @@ int freeze_processes(void)
do_each_thread(g, p) { do_each_thread(g, p) {
if (freezeable(p) && !frozen(p)) if (freezeable(p) && !frozen(p))
printk(KERN_ERR " %s\n", p->comm); printk(KERN_ERR " %s\n", p->comm);
if (freezing(p)) { cancel_freezing(p);
pr_debug(" clean up: %s\n", p->comm);
p->flags &= ~PF_FREEZE;
spin_lock_irqsave(&p->sighand->siglock, flags);
recalc_sigpending_tsk(p);
spin_unlock_irqrestore(&p->sighand->siglock, flags);
}
} while_each_thread(g, p); } while_each_thread(g, p);
read_unlock(&tasklist_lock); read_unlock(&tasklist_lock);
return todo; return todo;
......
...@@ -799,6 +799,9 @@ void release_console_sem(void) ...@@ -799,6 +799,9 @@ void release_console_sem(void)
up(&secondary_console_sem); up(&secondary_console_sem);
return; return;
} }
console_may_schedule = 0;
for ( ; ; ) { for ( ; ; ) {
spin_lock_irqsave(&logbuf_lock, flags); spin_lock_irqsave(&logbuf_lock, flags);
wake_klogd |= log_start - log_end; wake_klogd |= log_start - log_end;
...@@ -812,7 +815,6 @@ void release_console_sem(void) ...@@ -812,7 +815,6 @@ void release_console_sem(void)
local_irq_restore(flags); local_irq_restore(flags);
} }
console_locked = 0; console_locked = 0;
console_may_schedule = 0;
up(&console_sem); up(&console_sem);
spin_unlock_irqrestore(&logbuf_lock, flags); spin_unlock_irqrestore(&logbuf_lock, flags);
if (wake_klogd && !oops_in_progress && waitqueue_active(&log_wait)) { if (wake_klogd && !oops_in_progress && waitqueue_active(&log_wait)) {
......
...@@ -244,6 +244,7 @@ int find_next_system_ram(struct resource *res) ...@@ -244,6 +244,7 @@ int find_next_system_ram(struct resource *res)
start = res->start; start = res->start;
end = res->end; end = res->end;
BUG_ON(start >= end);
read_lock(&resource_lock); read_lock(&resource_lock);
for (p = iomem_resource.child; p ; p = p->sibling) { for (p = iomem_resource.child; p ; p = p->sibling) {
...@@ -254,14 +255,16 @@ int find_next_system_ram(struct resource *res) ...@@ -254,14 +255,16 @@ int find_next_system_ram(struct resource *res)
p = NULL; p = NULL;
break; break;
} }
if (p->start >= start) if ((p->end >= start) && (p->start < end))
break; break;
} }
read_unlock(&resource_lock); read_unlock(&resource_lock);
if (!p) if (!p)
return -1; return -1;
/* copy data */ /* copy data */
if (res->start < p->start)
res->start = p->start; res->start = p->start;
if (res->end > p->end)
res->end = p->end; res->end = p->end;
return 0; return 0;
} }
......
...@@ -162,6 +162,7 @@ static void rwlock_bug(rwlock_t *lock, const char *msg) ...@@ -162,6 +162,7 @@ static void rwlock_bug(rwlock_t *lock, const char *msg)
#define RWLOCK_BUG_ON(cond, lock, msg) if (unlikely(cond)) rwlock_bug(lock, msg) #define RWLOCK_BUG_ON(cond, lock, msg) if (unlikely(cond)) rwlock_bug(lock, msg)
#if 0 /* __write_lock_debug() can lock up - maybe this can too? */
static void __read_lock_debug(rwlock_t *lock) static void __read_lock_debug(rwlock_t *lock)
{ {
int print_once = 1; int print_once = 1;
...@@ -184,12 +185,12 @@ static void __read_lock_debug(rwlock_t *lock) ...@@ -184,12 +185,12 @@ static void __read_lock_debug(rwlock_t *lock)
} }
} }
} }
#endif
void _raw_read_lock(rwlock_t *lock) void _raw_read_lock(rwlock_t *lock)
{ {
RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic"); RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic");
if (unlikely(!__raw_read_trylock(&lock->raw_lock))) __raw_read_lock(&lock->raw_lock);
__read_lock_debug(lock);
} }
int _raw_read_trylock(rwlock_t *lock) int _raw_read_trylock(rwlock_t *lock)
...@@ -235,6 +236,7 @@ static inline void debug_write_unlock(rwlock_t *lock) ...@@ -235,6 +236,7 @@ static inline void debug_write_unlock(rwlock_t *lock)
lock->owner_cpu = -1; lock->owner_cpu = -1;
} }
#if 0 /* This can cause lockups */
static void __write_lock_debug(rwlock_t *lock) static void __write_lock_debug(rwlock_t *lock)
{ {
int print_once = 1; int print_once = 1;
...@@ -257,12 +259,12 @@ static void __write_lock_debug(rwlock_t *lock) ...@@ -257,12 +259,12 @@ static void __write_lock_debug(rwlock_t *lock)
} }
} }
} }
#endif
void _raw_write_lock(rwlock_t *lock) void _raw_write_lock(rwlock_t *lock)
{ {
debug_write_lock_before(lock); debug_write_lock_before(lock);
if (unlikely(!__raw_write_trylock(&lock->raw_lock))) __raw_write_lock(&lock->raw_lock);
__write_lock_debug(lock);
debug_write_lock_after(lock); debug_write_lock_after(lock);
} }
......
...@@ -73,7 +73,6 @@ asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice) ...@@ -73,7 +73,6 @@ asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice)
file->f_ra.ra_pages = bdi->ra_pages * 2; file->f_ra.ra_pages = bdi->ra_pages * 2;
break; break;
case POSIX_FADV_WILLNEED: case POSIX_FADV_WILLNEED:
case POSIX_FADV_NOREUSE:
if (!mapping->a_ops->readpage) { if (!mapping->a_ops->readpage) {
ret = -EINVAL; ret = -EINVAL;
break; break;
...@@ -94,6 +93,8 @@ asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice) ...@@ -94,6 +93,8 @@ asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice)
if (ret > 0) if (ret > 0)
ret = 0; ret = 0;
break; break;
case POSIX_FADV_NOREUSE:
break;
case POSIX_FADV_DONTNEED: case POSIX_FADV_DONTNEED:
if (!bdi_write_congested(mapping->backing_dev_info)) if (!bdi_write_congested(mapping->backing_dev_info))
filemap_flush(mapping); filemap_flush(mapping);
......
...@@ -52,6 +52,9 @@ static int __add_section(struct zone *zone, unsigned long phys_start_pfn) ...@@ -52,6 +52,9 @@ static int __add_section(struct zone *zone, unsigned long phys_start_pfn)
int nr_pages = PAGES_PER_SECTION; int nr_pages = PAGES_PER_SECTION;
int ret; int ret;
if (pfn_valid(phys_start_pfn))
return -EEXIST;
ret = sparse_add_one_section(zone, phys_start_pfn, nr_pages); ret = sparse_add_one_section(zone, phys_start_pfn, nr_pages);
if (ret < 0) if (ret < 0)
...@@ -76,15 +79,22 @@ int __add_pages(struct zone *zone, unsigned long phys_start_pfn, ...@@ -76,15 +79,22 @@ int __add_pages(struct zone *zone, unsigned long phys_start_pfn,
{ {
unsigned long i; unsigned long i;
int err = 0; int err = 0;
int start_sec, end_sec;
/* during initialize mem_map, align hot-added range to section */
start_sec = pfn_to_section_nr(phys_start_pfn);
end_sec = pfn_to_section_nr(phys_start_pfn + nr_pages - 1);
for (i = 0; i < nr_pages; i += PAGES_PER_SECTION) { for (i = start_sec; i <= end_sec; i++) {
err = __add_section(zone, phys_start_pfn + i); err = __add_section(zone, i << PFN_SECTION_SHIFT);
/* We want to keep adding the rest of the /*
* sections if the first ones already exist * EEXIST is finally dealed with by ioresource collision
* check. see add_memory() => register_memory_resource()
* Warning will be printed if there is collision.
*/ */
if (err && (err != -EEXIST)) if (err && (err != -EEXIST))
break; break;
err = 0;
} }
return err; return err;
...@@ -156,7 +166,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages) ...@@ -156,7 +166,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
res.flags = IORESOURCE_MEM; /* we just need system ram */ res.flags = IORESOURCE_MEM; /* we just need system ram */
section_end = res.end; section_end = res.end;
while (find_next_system_ram(&res) >= 0) { while ((res.start < res.end) && (find_next_system_ram(&res) >= 0)) {
start_pfn = (unsigned long)(res.start >> PAGE_SHIFT); start_pfn = (unsigned long)(res.start >> PAGE_SHIFT);
nr_pages = (unsigned long) nr_pages = (unsigned long)
((res.end + 1 - res.start) >> PAGE_SHIFT); ((res.end + 1 - res.start) >> PAGE_SHIFT);
...@@ -213,10 +223,9 @@ static void rollback_node_hotadd(int nid, pg_data_t *pgdat) ...@@ -213,10 +223,9 @@ static void rollback_node_hotadd(int nid, pg_data_t *pgdat)
} }
/* add this memory to iomem resource */ /* add this memory to iomem resource */
static void register_memory_resource(u64 start, u64 size) static struct resource *register_memory_resource(u64 start, u64 size)
{ {
struct resource *res; struct resource *res;
res = kzalloc(sizeof(struct resource), GFP_KERNEL); res = kzalloc(sizeof(struct resource), GFP_KERNEL);
BUG_ON(!res); BUG_ON(!res);
...@@ -228,7 +237,18 @@ static void register_memory_resource(u64 start, u64 size) ...@@ -228,7 +237,18 @@ static void register_memory_resource(u64 start, u64 size)
printk("System RAM resource %llx - %llx cannot be added\n", printk("System RAM resource %llx - %llx cannot be added\n",
(unsigned long long)res->start, (unsigned long long)res->end); (unsigned long long)res->start, (unsigned long long)res->end);
kfree(res); kfree(res);
res = NULL;
} }
return res;
}
static void release_memory_resource(struct resource *res)
{
if (!res)
return;
release_resource(res);
kfree(res);
return;
} }
...@@ -237,8 +257,13 @@ int add_memory(int nid, u64 start, u64 size) ...@@ -237,8 +257,13 @@ int add_memory(int nid, u64 start, u64 size)
{ {
pg_data_t *pgdat = NULL; pg_data_t *pgdat = NULL;
int new_pgdat = 0; int new_pgdat = 0;
struct resource *res;
int ret; int ret;
res = register_memory_resource(start, size);
if (!res)
return -EEXIST;
if (!node_online(nid)) { if (!node_online(nid)) {
pgdat = hotadd_new_pgdat(nid, start); pgdat = hotadd_new_pgdat(nid, start);
if (!pgdat) if (!pgdat)
...@@ -268,14 +293,13 @@ int add_memory(int nid, u64 start, u64 size) ...@@ -268,14 +293,13 @@ int add_memory(int nid, u64 start, u64 size)
BUG_ON(ret); BUG_ON(ret);
} }
/* register this memory as resource */
register_memory_resource(start, size);
return ret; return ret;
error: error:
/* rollback pgdat allocation and others */ /* rollback pgdat allocation and others */
if (new_pgdat) if (new_pgdat)
rollback_node_hotadd(nid, pgdat); rollback_node_hotadd(nid, pgdat);
if (res)
release_memory_resource(res);
return ret; return ret;
} }
......
...@@ -71,7 +71,12 @@ struct cache_head *sunrpc_cache_lookup(struct cache_detail *detail, ...@@ -71,7 +71,12 @@ struct cache_head *sunrpc_cache_lookup(struct cache_detail *detail,
new = detail->alloc(); new = detail->alloc();
if (!new) if (!new)
return NULL; return NULL;
/* must fully initialise 'new', else
* we might get lose if we need to
* cache_put it soon.
*/
cache_init(new); cache_init(new);
detail->init(new, key);
write_lock(&detail->hash_lock); write_lock(&detail->hash_lock);
...@@ -85,7 +90,6 @@ struct cache_head *sunrpc_cache_lookup(struct cache_detail *detail, ...@@ -85,7 +90,6 @@ struct cache_head *sunrpc_cache_lookup(struct cache_detail *detail,
return tmp; return tmp;
} }
} }
detail->init(new, key);
new->next = *head; new->next = *head;
*head = new; *head = new;
detail->entries++; detail->entries++;
......
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