Commit 5ee354a0 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'misc-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux

* 'misc-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux:
  ia64: pcibr: Use kmemdup rather than duplicating its implementation
  ia64: sn: Use kmemdup rather than duplicating its implementation
  ia64: tioca: Use kmemdup rather than duplicating its implementation
  [IA64] Merge overlapping reserved regions at boot
parents c7741713 a4b1d1b3
......@@ -220,6 +220,23 @@ sort_regions (struct rsvd_region *rsvd_region, int max)
}
}
/* merge overlaps */
static int __init
merge_regions (struct rsvd_region *rsvd_region, int max)
{
int i;
for (i = 1; i < max; ++i) {
if (rsvd_region[i].start >= rsvd_region[i-1].end)
continue;
if (rsvd_region[i].end > rsvd_region[i-1].end)
rsvd_region[i-1].end = rsvd_region[i].end;
--max;
memmove(&rsvd_region[i], &rsvd_region[i+1],
(max - i) * sizeof(struct rsvd_region));
}
return max;
}
/*
* Request address space for all standard resources
*/
......@@ -270,6 +287,7 @@ static void __init setup_crashkernel(unsigned long total, int *n)
if (ret == 0 && size > 0) {
if (!base) {
sort_regions(rsvd_region, *n);
*n = merge_regions(rsvd_region, *n);
base = kdump_find_rsvd_region(size,
rsvd_region, *n);
}
......@@ -373,6 +391,7 @@ reserve_memory (void)
BUG_ON(IA64_MAX_RSVD_REGIONS + 1 < n);
sort_regions(rsvd_region, num_rsvd_regions);
num_rsvd_regions = merge_regions(rsvd_region, num_rsvd_regions);
}
......
......@@ -150,12 +150,11 @@ struct sn_irq_info *sn_retarget_vector(struct sn_irq_info *sn_irq_info,
* PROM does not support SAL_INTR_REDIRECT, or it failed.
* Revert to old method.
*/
new_irq_info = kmalloc(sizeof(struct sn_irq_info), GFP_ATOMIC);
new_irq_info = kmemdup(sn_irq_info, sizeof(struct sn_irq_info),
GFP_ATOMIC);
if (new_irq_info == NULL)
return NULL;
memcpy(new_irq_info, sn_irq_info, sizeof(struct sn_irq_info));
/* Free the old PROM new_irq_info structure */
sn_intr_free(local_nasid, local_widget, new_irq_info);
unregister_intr_pda(new_irq_info);
......
......@@ -127,12 +127,11 @@ pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
* Allocate kernel bus soft and copy from prom.
*/
soft = kmalloc(sizeof(struct pcibus_info), GFP_KERNEL);
soft = kmemdup(prom_bussoft, sizeof(struct pcibus_info), GFP_KERNEL);
if (!soft) {
return NULL;
}
memcpy(soft, prom_bussoft, sizeof(struct pcibus_info));
soft->pbi_buscommon.bs_base = (unsigned long)
ioremap(REGION_OFFSET(soft->pbi_buscommon.bs_base),
sizeof(struct pic));
......
......@@ -600,11 +600,11 @@ tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
* Allocate kernel bus soft and copy from prom.
*/
tioca_common = kzalloc(sizeof(struct tioca_common), GFP_KERNEL);
tioca_common = kmemdup(prom_bussoft, sizeof(struct tioca_common),
GFP_KERNEL);
if (!tioca_common)
return NULL;
memcpy(tioca_common, prom_bussoft, sizeof(struct tioca_common));
tioca_common->ca_common.bs_base = (unsigned long)
ioremap(REGION_OFFSET(tioca_common->ca_common.bs_base),
sizeof(struct tioca_common));
......
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