powerpc/mpic: Assume a device-node was passed in mpic_alloc()
All of the existing callers of mpic_alloc() pass in a non-NULL device-node pointer, so the checks for a NULL device-node may be removed. Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
parent
8bf4156896
commit
5bdb6f2e58
|
@ -1137,19 +1137,17 @@ struct mpic * __init mpic_alloc(struct device_node *node,
|
||||||
unsigned int irq_count,
|
unsigned int irq_count,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
struct mpic *mpic;
|
int i, psize, intvec_top;
|
||||||
u32 greg_feature;
|
struct mpic *mpic;
|
||||||
const char *vers;
|
u32 greg_feature;
|
||||||
int i;
|
const char *vers;
|
||||||
int intvec_top;
|
const u32 *psrc;
|
||||||
|
|
||||||
/*
|
/* This code assumes that a non-NULL device node is passed in */
|
||||||
* If no phyiscal address was specified then all of the phyiscal
|
BUG_ON(!node);
|
||||||
* addressing parameters must come from the device-tree.
|
|
||||||
*/
|
/* Pick the physical address from the device tree if unspecified */
|
||||||
if (!phys_addr) {
|
if (!phys_addr) {
|
||||||
BUG_ON(!node);
|
|
||||||
|
|
||||||
/* Check if it is DCR-based */
|
/* Check if it is DCR-based */
|
||||||
if (of_get_property(node, "dcr-reg", NULL)) {
|
if (of_get_property(node, "dcr-reg", NULL)) {
|
||||||
flags |= MPIC_USES_DCR;
|
flags |= MPIC_USES_DCR;
|
||||||
|
@ -1211,28 +1209,22 @@ struct mpic * __init mpic_alloc(struct device_node *node,
|
||||||
mpic->spurious_vec = intvec_top;
|
mpic->spurious_vec = intvec_top;
|
||||||
|
|
||||||
/* Check for "big-endian" in device-tree */
|
/* Check for "big-endian" in device-tree */
|
||||||
if (node && of_get_property(node, "big-endian", NULL) != NULL)
|
if (of_get_property(node, "big-endian", NULL) != NULL)
|
||||||
mpic->flags |= MPIC_BIG_ENDIAN;
|
mpic->flags |= MPIC_BIG_ENDIAN;
|
||||||
if (node && of_device_is_compatible(node, "fsl,mpic"))
|
if (of_device_is_compatible(node, "fsl,mpic"))
|
||||||
mpic->flags |= MPIC_FSL;
|
mpic->flags |= MPIC_FSL;
|
||||||
|
|
||||||
/* Look for protected sources */
|
/* Look for protected sources */
|
||||||
if (node) {
|
psrc = of_get_property(node, "protected-sources", &psize);
|
||||||
int psize;
|
if (psrc) {
|
||||||
unsigned int bits, mapsize;
|
/* Allocate a bitmap with one bit per interrupt */
|
||||||
const u32 *psrc =
|
unsigned int mapsize = BITS_TO_LONGS(intvec_top + 1);
|
||||||
of_get_property(node, "protected-sources", &psize);
|
mpic->protected = kzalloc(mapsize*sizeof(long), GFP_KERNEL);
|
||||||
if (psrc) {
|
BUG_ON(mpic->protected == NULL);
|
||||||
psize /= 4;
|
for (i = 0; i < psize/sizeof(u32); i++) {
|
||||||
bits = intvec_top + 1;
|
if (psrc[i] > intvec_top)
|
||||||
mapsize = BITS_TO_LONGS(bits) * sizeof(unsigned long);
|
continue;
|
||||||
mpic->protected = kzalloc(mapsize, GFP_KERNEL);
|
__set_bit(psrc[i], mpic->protected);
|
||||||
BUG_ON(mpic->protected == NULL);
|
|
||||||
for (i = 0; i < psize; i++) {
|
|
||||||
if (psrc[i] > intvec_top)
|
|
||||||
continue;
|
|
||||||
__set_bit(psrc[i], mpic->protected);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue