Skip to content

Commit

Permalink
Merge branch 'misc-3.3' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
Linus Torvalds committed Jan 7, 2012
2 parents c774171 + a4b1d1b commit 5ee354a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
19 changes: 19 additions & 0 deletions arch/ia64/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}


Expand Down
5 changes: 2 additions & 3 deletions arch/ia64/sn/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions arch/ia64/sn/pci/pcibr/pcibr_provider.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions arch/ia64/sn/pci/tioca_provider.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 5ee354a

Please sign in to comment.