[POWERPC] maple: Constify & voidify get_property()
Now that get_property() returns a void *, there's no need to cast its return value. Also, treat the return value as const, so we can constify get_property later. maple platform changes. Built for maple_defconfig Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
parent
ae6b4101e5
commit
eeb2b723ef
@ -38,16 +38,16 @@ static struct pci_controller *u3_agp, *u3_ht;
|
|||||||
static int __init fixup_one_level_bus_range(struct device_node *node, int higher)
|
static int __init fixup_one_level_bus_range(struct device_node *node, int higher)
|
||||||
{
|
{
|
||||||
for (; node != 0;node = node->sibling) {
|
for (; node != 0;node = node->sibling) {
|
||||||
int * bus_range;
|
const int *bus_range;
|
||||||
unsigned int *class_code;
|
const unsigned int *class_code;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
/* For PCI<->PCI bridges or CardBus bridges, we go down */
|
/* For PCI<->PCI bridges or CardBus bridges, we go down */
|
||||||
class_code = (unsigned int *) get_property(node, "class-code", NULL);
|
class_code = get_property(node, "class-code", NULL);
|
||||||
if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
|
if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
|
||||||
(*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
|
(*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
|
||||||
continue;
|
continue;
|
||||||
bus_range = (int *) get_property(node, "bus-range", &len);
|
bus_range = get_property(node, "bus-range", &len);
|
||||||
if (bus_range != NULL && len > 2 * sizeof(int)) {
|
if (bus_range != NULL && len > 2 * sizeof(int)) {
|
||||||
if (bus_range[1] > higher)
|
if (bus_range[1] > higher)
|
||||||
higher = bus_range[1];
|
higher = bus_range[1];
|
||||||
@ -65,16 +65,18 @@ static int __init fixup_one_level_bus_range(struct device_node *node, int higher
|
|||||||
*/
|
*/
|
||||||
static void __init fixup_bus_range(struct device_node *bridge)
|
static void __init fixup_bus_range(struct device_node *bridge)
|
||||||
{
|
{
|
||||||
int * bus_range;
|
int *bus_range;
|
||||||
|
struct property *prop;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
/* Lookup the "bus-range" property for the hose */
|
/* Lookup the "bus-range" property for the hose */
|
||||||
bus_range = (int *) get_property(bridge, "bus-range", &len);
|
prop = of_find_property(bridge, "bus-range", &len);
|
||||||
if (bus_range == NULL || len < 2 * sizeof(int)) {
|
if (prop == NULL || prop->value == NULL || len < 2 * sizeof(int)) {
|
||||||
printk(KERN_WARNING "Can't get bus-range for %s\n",
|
printk(KERN_WARNING "Can't get bus-range for %s\n",
|
||||||
bridge->full_name);
|
bridge->full_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
bus_range = (int *)prop->value;
|
||||||
bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]);
|
bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,12 +316,12 @@ static int __init add_bridge(struct device_node *dev)
|
|||||||
int len;
|
int len;
|
||||||
struct pci_controller *hose;
|
struct pci_controller *hose;
|
||||||
char* disp_name;
|
char* disp_name;
|
||||||
int *bus_range;
|
const int *bus_range;
|
||||||
int primary = 1;
|
int primary = 1;
|
||||||
|
|
||||||
DBG("Adding PCI host bridge %s\n", dev->full_name);
|
DBG("Adding PCI host bridge %s\n", dev->full_name);
|
||||||
|
|
||||||
bus_range = (int *) get_property(dev, "bus-range", &len);
|
bus_range = get_property(dev, "bus-range", &len);
|
||||||
if (bus_range == NULL || len < 2 * sizeof(int)) {
|
if (bus_range == NULL || len < 2 * sizeof(int)) {
|
||||||
printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n",
|
printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n",
|
||||||
dev->full_name);
|
dev->full_name);
|
||||||
|
@ -99,8 +99,7 @@ static unsigned long maple_find_nvram_base(void)
|
|||||||
static void maple_restart(char *cmd)
|
static void maple_restart(char *cmd)
|
||||||
{
|
{
|
||||||
unsigned int maple_nvram_base;
|
unsigned int maple_nvram_base;
|
||||||
unsigned int maple_nvram_offset;
|
const unsigned int *maple_nvram_offset, *maple_nvram_command;
|
||||||
unsigned int maple_nvram_command;
|
|
||||||
struct device_node *sp;
|
struct device_node *sp;
|
||||||
|
|
||||||
maple_nvram_base = maple_find_nvram_base();
|
maple_nvram_base = maple_find_nvram_base();
|
||||||
@ -113,14 +112,12 @@ static void maple_restart(char *cmd)
|
|||||||
printk(KERN_EMERG "Maple: Unable to find Service Processor\n");
|
printk(KERN_EMERG "Maple: Unable to find Service Processor\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
maple_nvram_offset = *(unsigned int*) get_property(sp,
|
maple_nvram_offset = get_property(sp, "restart-addr", NULL);
|
||||||
"restart-addr", NULL);
|
maple_nvram_command = get_property(sp, "restart-value", NULL);
|
||||||
maple_nvram_command = *(unsigned int*) get_property(sp,
|
|
||||||
"restart-value", NULL);
|
|
||||||
of_node_put(sp);
|
of_node_put(sp);
|
||||||
|
|
||||||
/* send command */
|
/* send command */
|
||||||
outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset);
|
outb_p(*maple_nvram_command, maple_nvram_base + *maple_nvram_offset);
|
||||||
for (;;) ;
|
for (;;) ;
|
||||||
fail:
|
fail:
|
||||||
printk(KERN_EMERG "Maple: Manual Restart Required\n");
|
printk(KERN_EMERG "Maple: Manual Restart Required\n");
|
||||||
@ -129,8 +126,7 @@ static void maple_restart(char *cmd)
|
|||||||
static void maple_power_off(void)
|
static void maple_power_off(void)
|
||||||
{
|
{
|
||||||
unsigned int maple_nvram_base;
|
unsigned int maple_nvram_base;
|
||||||
unsigned int maple_nvram_offset;
|
const unsigned int *maple_nvram_offset, *maple_nvram_command;
|
||||||
unsigned int maple_nvram_command;
|
|
||||||
struct device_node *sp;
|
struct device_node *sp;
|
||||||
|
|
||||||
maple_nvram_base = maple_find_nvram_base();
|
maple_nvram_base = maple_find_nvram_base();
|
||||||
@ -143,14 +139,12 @@ static void maple_power_off(void)
|
|||||||
printk(KERN_EMERG "Maple: Unable to find Service Processor\n");
|
printk(KERN_EMERG "Maple: Unable to find Service Processor\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
maple_nvram_offset = *(unsigned int*) get_property(sp,
|
maple_nvram_offset = get_property(sp, "power-off-addr", NULL);
|
||||||
"power-off-addr", NULL);
|
maple_nvram_command = get_property(sp, "power-off-value", NULL);
|
||||||
maple_nvram_command = *(unsigned int*) get_property(sp,
|
|
||||||
"power-off-value", NULL);
|
|
||||||
of_node_put(sp);
|
of_node_put(sp);
|
||||||
|
|
||||||
/* send command */
|
/* send command */
|
||||||
outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset);
|
outb_p(*maple_nvram_command, maple_nvram_base + *maple_nvram_offset);
|
||||||
for (;;) ;
|
for (;;) ;
|
||||||
fail:
|
fail:
|
||||||
printk(KERN_EMERG "Maple: Manual Power-Down Required\n");
|
printk(KERN_EMERG "Maple: Manual Power-Down Required\n");
|
||||||
@ -211,7 +205,7 @@ static void __init maple_init_early(void)
|
|||||||
static void __init maple_init_IRQ(void)
|
static void __init maple_init_IRQ(void)
|
||||||
{
|
{
|
||||||
struct device_node *root, *np, *mpic_node = NULL;
|
struct device_node *root, *np, *mpic_node = NULL;
|
||||||
unsigned int *opprop;
|
const unsigned int *opprop;
|
||||||
unsigned long openpic_addr = 0;
|
unsigned long openpic_addr = 0;
|
||||||
int naddr, n, i, opplen, has_isus = 0;
|
int naddr, n, i, opplen, has_isus = 0;
|
||||||
struct mpic *mpic;
|
struct mpic *mpic;
|
||||||
@ -234,8 +228,7 @@ static void __init maple_init_IRQ(void)
|
|||||||
/* Find address list in /platform-open-pic */
|
/* Find address list in /platform-open-pic */
|
||||||
root = of_find_node_by_path("/");
|
root = of_find_node_by_path("/");
|
||||||
naddr = prom_n_addr_cells(root);
|
naddr = prom_n_addr_cells(root);
|
||||||
opprop = (unsigned int *) get_property(root, "platform-open-pic",
|
opprop = get_property(root, "platform-open-pic", &opplen);
|
||||||
&opplen);
|
|
||||||
if (opprop != 0) {
|
if (opprop != 0) {
|
||||||
openpic_addr = of_read_number(opprop, naddr);
|
openpic_addr = of_read_number(opprop, naddr);
|
||||||
has_isus = (opplen > naddr);
|
has_isus = (opplen > naddr);
|
||||||
|
Loading…
Reference in New Issue
Block a user