Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae6b4101 authored by Jeremy Kerr's avatar Jeremy Kerr Committed by Paul Mackerras
Browse files

[POWERPC] chrp: 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.

chrp platform changes.

Built for chrp32_defconfig

Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent c61c27d5
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -67,13 +67,14 @@ static void chrp_nvram_write(int addr, unsigned char val)
void __init chrp_nvram_init(void)
void __init chrp_nvram_init(void)
{
{
	struct device_node *nvram;
	struct device_node *nvram;
	unsigned int *nbytes_p, proplen;
	const unsigned int *nbytes_p;
	unsigned int proplen;


	nvram = of_find_node_by_type(NULL, "nvram");
	nvram = of_find_node_by_type(NULL, "nvram");
	if (nvram == NULL)
	if (nvram == NULL)
		return;
		return;


	nbytes_p = (unsigned int *)get_property(nvram, "#bytes", &proplen);
	nbytes_p = get_property(nvram, "#bytes", &proplen);
	if (nbytes_p == NULL || proplen != sizeof(unsigned int))
	if (nbytes_p == NULL || proplen != sizeof(unsigned int))
		return;
		return;


+5 −6
Original line number Original line Diff line number Diff line
@@ -214,11 +214,11 @@ void __init
chrp_find_bridges(void)
chrp_find_bridges(void)
{
{
	struct device_node *dev;
	struct device_node *dev;
	int *bus_range;
	const int *bus_range;
	int len, index = -1;
	int len, index = -1;
	struct pci_controller *hose;
	struct pci_controller *hose;
	unsigned int *dma;
	const unsigned int *dma;
	char *model, *machine;
	const char *model, *machine;
	int is_longtrail = 0, is_mot = 0, is_pegasos = 0;
	int is_longtrail = 0, is_mot = 0, is_pegasos = 0;
	struct device_node *root = find_path_device("/");
	struct device_node *root = find_path_device("/");
	struct resource r;
	struct resource r;
@@ -246,7 +246,7 @@ chrp_find_bridges(void)
			       dev->full_name);
			       dev->full_name);
			continue;
			continue;
		}
		}
		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\n",
			printk(KERN_WARNING "Can't get bus-range for %s\n",
				dev->full_name);
				dev->full_name);
@@ -312,8 +312,7 @@ chrp_find_bridges(void)


		/* check the first bridge for a property that we can
		/* check the first bridge for a property that we can
		   use to set pci_dram_offset */
		   use to set pci_dram_offset */
		dma = (unsigned int *)
		dma = get_property(dev, "ibm,dma-ranges", &len);
			get_property(dev, "ibm,dma-ranges", &len);
		if (index == 0 && dma != NULL && len >= 6 * sizeof(*dma)) {
		if (index == 0 && dma != NULL && len >= 6 * sizeof(*dma)) {
			pci_dram_offset = dma[2] - dma[3];
			pci_dram_offset = dma[2] - dma[3];
			printk("pci_dram_offset = %lx\n", pci_dram_offset);
			printk("pci_dram_offset = %lx\n", pci_dram_offset);
+9 −12
Original line number Original line Diff line number Diff line
@@ -226,8 +226,7 @@ static void __init pegasos_set_l2cr(void)
	/* Enable L2 cache if needed */
	/* Enable L2 cache if needed */
	np = find_type_devices("cpu");
	np = find_type_devices("cpu");
	if (np != NULL) {
	if (np != NULL) {
		unsigned int *l2cr = (unsigned int *)
		const unsigned int *l2cr = get_property(np, "l2cr", NULL);
			get_property (np, "l2cr", NULL);
		if (l2cr == NULL) {
		if (l2cr == NULL) {
			printk ("Pegasos l2cr : no cpu l2cr property found\n");
			printk ("Pegasos l2cr : no cpu l2cr property found\n");
			return;
			return;
@@ -252,7 +251,7 @@ static void briq_restart(char *cmd)
void __init chrp_setup_arch(void)
void __init chrp_setup_arch(void)
{
{
	struct device_node *root = find_path_device ("/");
	struct device_node *root = find_path_device ("/");
	char *machine = NULL;
	const char *machine = NULL;


	/* init to some ~sane value until calibrate_delay() runs */
	/* init to some ~sane value until calibrate_delay() runs */
	loops_per_jiffy = 50000000/HZ;
	loops_per_jiffy = 50000000/HZ;
@@ -353,7 +352,7 @@ static void __init chrp_find_openpic(void)
	struct device_node *np, *root;
	struct device_node *np, *root;
	int len, i, j;
	int len, i, j;
	int isu_size, idu_size;
	int isu_size, idu_size;
	unsigned int *iranges, *opprop = NULL;
	const unsigned int *iranges, *opprop = NULL;
	int oplen = 0;
	int oplen = 0;
	unsigned long opaddr;
	unsigned long opaddr;
	int na = 1;
	int na = 1;
@@ -363,8 +362,7 @@ static void __init chrp_find_openpic(void)
		return;
		return;
	root = of_find_node_by_path("/");
	root = of_find_node_by_path("/");
	if (root) {
	if (root) {
		opprop = (unsigned int *) get_property
		opprop = get_property(root, "platform-open-pic", &oplen);
			(root, "platform-open-pic", &oplen);
		na = prom_n_addr_cells(root);
		na = prom_n_addr_cells(root);
	}
	}
	if (opprop && oplen >= na * sizeof(unsigned int)) {
	if (opprop && oplen >= na * sizeof(unsigned int)) {
@@ -381,7 +379,7 @@ static void __init chrp_find_openpic(void)


	printk(KERN_INFO "OpenPIC at %lx\n", opaddr);
	printk(KERN_INFO "OpenPIC at %lx\n", opaddr);


	iranges = (unsigned int *) get_property(np, "interrupt-ranges", &len);
	iranges = get_property(np, "interrupt-ranges", &len);
	if (iranges == NULL)
	if (iranges == NULL)
		len = 0;	/* non-distributed mpic */
		len = 0;	/* non-distributed mpic */
	else
	else
@@ -467,8 +465,8 @@ static void __init chrp_find_8259(void)
	 * from anyway
	 * from anyway
	 */
	 */
	for (np = find_devices("pci"); np != NULL; np = np->next) {
	for (np = find_devices("pci"); np != NULL; np = np->next) {
		unsigned int *addrp = (unsigned int *)
		const unsigned int *addrp = get_property(np,
			get_property(np, "8259-interrupt-acknowledge", NULL);
				"8259-interrupt-acknowledge", NULL);


		if (addrp == NULL)
		if (addrp == NULL)
			continue;
			continue;
@@ -527,7 +525,7 @@ void __init
chrp_init2(void)
chrp_init2(void)
{
{
	struct device_node *device;
	struct device_node *device;
	unsigned int *p = NULL;
	const unsigned int *p = NULL;


#ifdef CONFIG_NVRAM
#ifdef CONFIG_NVRAM
	chrp_nvram_init();
	chrp_nvram_init();
@@ -545,8 +543,7 @@ chrp_init2(void)
	 */
	 */
	device = find_devices("rtas");
	device = find_devices("rtas");
	if (device)
	if (device)
		p = (unsigned int *) get_property
		p = get_property(device, "rtas-event-scan-rate", NULL);
			(device, "rtas-event-scan-rate", NULL);
	if (p && *p) {
	if (p && *p) {
		/*
		/*
		 * Arrange to call chrp_event_scan at least *p times
		 * Arrange to call chrp_event_scan at least *p times