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

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

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

powermac platform & macintosh driver changes.

Built for pmac32_defconfig, g5_defconfig

Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent eeb2b723
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -38,7 +38,8 @@ int pmac_has_backlight_type(const char *type)
	struct device_node* bk_node = find_devices("backlight");
	struct device_node* bk_node = find_devices("backlight");


	if (bk_node) {
	if (bk_node) {
		char *prop = get_property(bk_node, "backlight-control", NULL);
		const char *prop = get_property(bk_node,
				"backlight-control", NULL);
		if (prop && strncmp(prop, type, strlen(type)) == 0)
		if (prop && strncmp(prop, type, strlen(type)) == 0)
			return 1;
			return 1;
	}
	}
+12 −11
Original line number Original line Diff line number Diff line
@@ -421,7 +421,7 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy)


static u32 read_gpio(struct device_node *np)
static u32 read_gpio(struct device_node *np)
{
{
	u32 *reg = (u32 *)get_property(np, "reg", NULL);
	const u32 *reg = get_property(np, "reg", NULL);
	u32 offset;
	u32 offset;


	if (reg == NULL)
	if (reg == NULL)
@@ -497,7 +497,7 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode)
								"frequency-gpio");
								"frequency-gpio");
	struct device_node *slew_done_gpio_np = of_find_node_by_name(NULL,
	struct device_node *slew_done_gpio_np = of_find_node_by_name(NULL,
								     "slewing-done");
								     "slewing-done");
	u32 *value;
	const u32 *value;


	/*
	/*
	 * Check to see if it's GPIO driven or PMU only
	 * Check to see if it's GPIO driven or PMU only
@@ -519,15 +519,15 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode)
	 */
	 */
	if (frequency_gpio && slew_done_gpio) {
	if (frequency_gpio && slew_done_gpio) {
		int lenp, rc;
		int lenp, rc;
		u32 *freqs, *ratio;
		const u32 *freqs, *ratio;


		freqs = (u32 *)get_property(cpunode, "bus-frequencies", &lenp);
		freqs = get_property(cpunode, "bus-frequencies", &lenp);
		lenp /= sizeof(u32);
		lenp /= sizeof(u32);
		if (freqs == NULL || lenp != 2) {
		if (freqs == NULL || lenp != 2) {
			printk(KERN_ERR "cpufreq: bus-frequencies incorrect or missing\n");
			printk(KERN_ERR "cpufreq: bus-frequencies incorrect or missing\n");
			return 1;
			return 1;
		}
		}
		ratio = (u32 *)get_property(cpunode, "processor-to-bus-ratio*2", NULL);
		ratio = get_property(cpunode, "processor-to-bus-ratio*2", NULL);
		if (ratio == NULL) {
		if (ratio == NULL) {
			printk(KERN_ERR "cpufreq: processor-to-bus-ratio*2 missing\n");
			printk(KERN_ERR "cpufreq: processor-to-bus-ratio*2 missing\n");
			return 1;
			return 1;
@@ -562,7 +562,7 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode)
	/* If we use the PMU, look for the min & max frequencies in the
	/* If we use the PMU, look for the min & max frequencies in the
	 * device-tree
	 * device-tree
	 */
	 */
	value = (u32 *)get_property(cpunode, "min-clock-frequency", NULL);
	value = get_property(cpunode, "min-clock-frequency", NULL);
	if (!value)
	if (!value)
		return 1;
		return 1;
	low_freq = (*value) / 1000;
	low_freq = (*value) / 1000;
@@ -571,7 +571,7 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode)
	if (low_freq < 100000)
	if (low_freq < 100000)
		low_freq *= 10;
		low_freq *= 10;


	value = (u32 *)get_property(cpunode, "max-clock-frequency", NULL);
	value = get_property(cpunode, "max-clock-frequency", NULL);
	if (!value)
	if (!value)
		return 1;
		return 1;
	hi_freq = (*value) / 1000;
	hi_freq = (*value) / 1000;
@@ -611,13 +611,14 @@ static int pmac_cpufreq_init_7447A(struct device_node *cpunode)
static int pmac_cpufreq_init_750FX(struct device_node *cpunode)
static int pmac_cpufreq_init_750FX(struct device_node *cpunode)
{
{
	struct device_node *volt_gpio_np;
	struct device_node *volt_gpio_np;
	u32 pvr, *value;
	u32 pvr;
	const u32 *value;


	if (get_property(cpunode, "dynamic-power-step", NULL) == NULL)
	if (get_property(cpunode, "dynamic-power-step", NULL) == NULL)
		return 1;
		return 1;


	hi_freq = cur_freq;
	hi_freq = cur_freq;
	value = (u32 *)get_property(cpunode, "reduced-clock-frequency", NULL);
	value = get_property(cpunode, "reduced-clock-frequency", NULL);
	if (!value)
	if (!value)
		return 1;
		return 1;
	low_freq = (*value) / 1000;
	low_freq = (*value) / 1000;
@@ -650,7 +651,7 @@ static int pmac_cpufreq_init_750FX(struct device_node *cpunode)
static int __init pmac_cpufreq_setup(void)
static int __init pmac_cpufreq_setup(void)
{
{
	struct device_node	*cpunode;
	struct device_node	*cpunode;
	u32			*value;
	const u32		*value;


	if (strstr(cmd_line, "nocpufreq"))
	if (strstr(cmd_line, "nocpufreq"))
		return 0;
		return 0;
@@ -661,7 +662,7 @@ static int __init pmac_cpufreq_setup(void)
		goto out;
		goto out;


	/* Get current cpu clock freq */
	/* Get current cpu clock freq */
	value = (u32 *)get_property(cpunode, "clock-frequency", NULL);
	value = get_property(cpunode, "clock-frequency", NULL);
	if (!value)
	if (!value)
		goto out;
		goto out;
	cur_freq = (*value) / 1000;
	cur_freq = (*value) / 1000;
+14 −13
Original line number Original line Diff line number Diff line
@@ -89,7 +89,7 @@ static DEFINE_MUTEX(g5_switch_mutex);


#ifdef CONFIG_PPC_SMU
#ifdef CONFIG_PPC_SMU


static u32 *g5_pmode_data;
static const u32 *g5_pmode_data;
static int g5_pmode_max;
static int g5_pmode_max;


static struct smu_sdbp_fvt *g5_fvt_table;	/* table of op. points */
static struct smu_sdbp_fvt *g5_fvt_table;	/* table of op. points */
@@ -391,7 +391,8 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
	unsigned int psize, ssize;
	unsigned int psize, ssize;
	unsigned long max_freq;
	unsigned long max_freq;
	char *freq_method, *volt_method;
	char *freq_method, *volt_method;
	u32 *valp, pvr_hi;
	const u32 *valp;
	u32 pvr_hi;
	int use_volts_vdnap = 0;
	int use_volts_vdnap = 0;
	int use_volts_smu = 0;
	int use_volts_smu = 0;
	int rc = -ENODEV;
	int rc = -ENODEV;
@@ -409,8 +410,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
	/* Get first CPU node */
	/* Get first CPU node */
	for (cpunode = NULL;
	for (cpunode = NULL;
	     (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) {
	     (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) {
		u32 *reg =
		const u32 *reg = get_property(cpunode, "reg", NULL);
			(u32 *)get_property(cpunode, "reg", NULL);
		if (reg == NULL || (*reg) != 0)
		if (reg == NULL || (*reg) != 0)
			continue;
			continue;
		if (!strcmp(cpunode->type, "cpu"))
		if (!strcmp(cpunode->type, "cpu"))
@@ -422,7 +422,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
	}
	}


	/* Check 970FX for now */
	/* Check 970FX for now */
	valp = (u32 *)get_property(cpunode, "cpu-version", NULL);
	valp = get_property(cpunode, "cpu-version", NULL);
	if (!valp) {
	if (!valp) {
		DBG("No cpu-version property !\n");
		DBG("No cpu-version property !\n");
		goto bail_noprops;
		goto bail_noprops;
@@ -434,7 +434,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
	}
	}


	/* Look for the powertune data in the device-tree */
	/* Look for the powertune data in the device-tree */
	g5_pmode_data = (u32 *)get_property(cpunode, "power-mode-data",&psize);
	g5_pmode_data = get_property(cpunode, "power-mode-data",&psize);
	if (!g5_pmode_data) {
	if (!g5_pmode_data) {
		DBG("No power-mode-data !\n");
		DBG("No power-mode-data !\n");
		goto bail_noprops;
		goto bail_noprops;
@@ -442,7 +442,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
	g5_pmode_max = psize / sizeof(u32) - 1;
	g5_pmode_max = psize / sizeof(u32) - 1;


	if (use_volts_smu) {
	if (use_volts_smu) {
		struct smu_sdbp_header *shdr;
		const struct smu_sdbp_header *shdr;


		/* Look for the FVT table */
		/* Look for the FVT table */
		shdr = smu_get_sdb_partition(SMU_SDB_FVT_ID, NULL);
		shdr = smu_get_sdb_partition(SMU_SDB_FVT_ID, NULL);
@@ -493,7 +493,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
	 * half freq in this version. So far, I haven't yet seen a machine
	 * half freq in this version. So far, I haven't yet seen a machine
	 * supporting anything else.
	 * supporting anything else.
	 */
	 */
	valp = (u32 *)get_property(cpunode, "clock-frequency", NULL);
	valp = get_property(cpunode, "clock-frequency", NULL);
	if (!valp)
	if (!valp)
		return -ENODEV;
		return -ENODEV;
	max_freq = (*valp)/1000;
	max_freq = (*valp)/1000;
@@ -541,8 +541,8 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
{
{
	struct device_node *cpuid = NULL, *hwclock = NULL, *cpunode = NULL;
	struct device_node *cpuid = NULL, *hwclock = NULL, *cpunode = NULL;
	u8 *eeprom = NULL;
	const u8 *eeprom = NULL;
	u32 *valp;
	const u32 *valp;
	u64 max_freq, min_freq, ih, il;
	u64 max_freq, min_freq, ih, il;
	int has_volt = 1, rc = 0;
	int has_volt = 1, rc = 0;


@@ -563,7 +563,7 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
	/* Lookup the cpuid eeprom node */
	/* Lookup the cpuid eeprom node */
        cpuid = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/cpuid@a0");
        cpuid = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/cpuid@a0");
	if (cpuid != NULL)
	if (cpuid != NULL)
		eeprom = (u8 *)get_property(cpuid, "cpuid", NULL);
		eeprom = get_property(cpuid, "cpuid", NULL);
	if (eeprom == NULL) {
	if (eeprom == NULL) {
		printk(KERN_ERR "cpufreq: Can't find cpuid EEPROM !\n");
		printk(KERN_ERR "cpufreq: Can't find cpuid EEPROM !\n");
		rc = -ENODEV;
		rc = -ENODEV;
@@ -573,7 +573,8 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
	/* Lookup the i2c hwclock */
	/* Lookup the i2c hwclock */
	for (hwclock = NULL;
	for (hwclock = NULL;
	     (hwclock = of_find_node_by_name(hwclock, "i2c-hwclock")) != NULL;){
	     (hwclock = of_find_node_by_name(hwclock, "i2c-hwclock")) != NULL;){
		char *loc = get_property(hwclock, "hwctrl-location", NULL);
		const char *loc = get_property(hwclock,
				"hwctrl-location", NULL);
		if (loc == NULL)
		if (loc == NULL)
			continue;
			continue;
		if (strcmp(loc, "CPU CLOCK"))
		if (strcmp(loc, "CPU CLOCK"))
@@ -637,7 +638,7 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
	 */
	 */


	/* Get max frequency from device-tree */
	/* Get max frequency from device-tree */
	valp = (u32 *)get_property(cpunode, "clock-frequency", NULL);
	valp = get_property(cpunode, "clock-frequency", NULL);
	if (!valp) {
	if (!valp) {
		printk(KERN_ERR "cpufreq: Can't find CPU frequency !\n");
		printk(KERN_ERR "cpufreq: Can't find CPU frequency !\n");
		rc = -ENODEV;
		rc = -ENODEV;
+15 −15
Original line number Original line Diff line number Diff line
@@ -1058,8 +1058,8 @@ core99_reset_cpu(struct device_node *node, long param, long value)
	if (np == NULL)
	if (np == NULL)
		return -ENODEV;
		return -ENODEV;
	for (np = np->child; np != NULL; np = np->sibling) {
	for (np = np->child; np != NULL; np = np->sibling) {
		u32 *num = (u32 *)get_property(np, "reg", NULL);
		u32 *num = get_property(np, "reg", NULL);
		u32 *rst = (u32 *)get_property(np, "soft-reset", NULL);
		u32 *rst = get_property(np, "soft-reset", NULL);
		if (num == NULL || rst == NULL)
		if (num == NULL || rst == NULL)
			continue;
			continue;
		if (param == *num) {
		if (param == *num) {
@@ -1087,7 +1087,7 @@ core99_usb_enable(struct device_node *node, long param, long value)
{
{
	struct macio_chip *macio;
	struct macio_chip *macio;
	unsigned long flags;
	unsigned long flags;
	char *prop;
	const char *prop;
	int number;
	int number;
	u32 reg;
	u32 reg;


@@ -1096,7 +1096,7 @@ core99_usb_enable(struct device_node *node, long param, long value)
	    macio->type != macio_intrepid)
	    macio->type != macio_intrepid)
		return -ENODEV;
		return -ENODEV;


	prop = (char *)get_property(node, "AAPL,clock-id", NULL);
	prop = get_property(node, "AAPL,clock-id", NULL);
	if (!prop)
	if (!prop)
		return -ENODEV;
		return -ENODEV;
	if (strncmp(prop, "usb0u048", 8) == 0)
	if (strncmp(prop, "usb0u048", 8) == 0)
@@ -1507,8 +1507,8 @@ static long g5_reset_cpu(struct device_node *node, long param, long value)
	if (np == NULL)
	if (np == NULL)
		return -ENODEV;
		return -ENODEV;
	for (np = np->child; np != NULL; np = np->sibling) {
	for (np = np->child; np != NULL; np = np->sibling) {
		u32 *num = (u32 *)get_property(np, "reg", NULL);
		const u32 *num = get_property(np, "reg", NULL);
		u32 *rst = (u32 *)get_property(np, "soft-reset", NULL);
		const u32 *rst = get_property(np, "soft-reset", NULL);
		if (num == NULL || rst == NULL)
		if (num == NULL || rst == NULL)
			continue;
			continue;
		if (param == *num) {
		if (param == *num) {
@@ -2408,7 +2408,7 @@ static int __init probe_motherboard(void)
	 */
	 */
	dt = find_devices("device-tree");
	dt = find_devices("device-tree");
	if (dt != NULL)
	if (dt != NULL)
		model = (const char *) get_property(dt, "model", NULL);
		model = get_property(dt, "model", NULL);
	for(i=0; model && i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) {
	for(i=0; model && i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) {
	    if (strcmp(model, pmac_mb_defs[i].model_string) == 0) {
	    if (strcmp(model, pmac_mb_defs[i].model_string) == 0) {
		pmac_mb = pmac_mb_defs[i];
		pmac_mb = pmac_mb_defs[i];
@@ -2536,7 +2536,7 @@ found:
 */
 */
static void __init probe_uninorth(void)
static void __init probe_uninorth(void)
{
{
	u32 *addrp;
	const u32 *addrp;
	phys_addr_t address;
	phys_addr_t address;
	unsigned long actrl;
	unsigned long actrl;


@@ -2555,7 +2555,7 @@ static void __init probe_uninorth(void)
	if (uninorth_node == NULL)
	if (uninorth_node == NULL)
		return;
		return;


	addrp = (u32 *)get_property(uninorth_node, "reg", NULL);
	addrp = get_property(uninorth_node, "reg", NULL);
	if (addrp == NULL)
	if (addrp == NULL)
		return;
		return;
	address = of_translate_address(uninorth_node, addrp);
	address = of_translate_address(uninorth_node, addrp);
@@ -2596,7 +2596,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ
	struct device_node*	node;
	struct device_node*	node;
	int			i;
	int			i;
	volatile u32 __iomem	*base;
	volatile u32 __iomem	*base;
	u32			*addrp, *revp;
	const u32		*addrp, *revp;
	phys_addr_t		addr;
	phys_addr_t		addr;
	u64			size;
	u64			size;


@@ -2639,7 +2639,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ
		return;
		return;
	}
	}
	if (type == macio_keylargo || type == macio_keylargo2) {
	if (type == macio_keylargo || type == macio_keylargo2) {
		u32 *did = (u32 *)get_property(node, "device-id", NULL);
		const u32 *did = get_property(node, "device-id", NULL);
		if (*did == 0x00000025)
		if (*did == 0x00000025)
			type = macio_pangea;
			type = macio_pangea;
		if (*did == 0x0000003e)
		if (*did == 0x0000003e)
@@ -2652,7 +2652,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ
	macio_chips[i].base	= base;
	macio_chips[i].base	= base;
	macio_chips[i].flags	= MACIO_FLAG_SCCB_ON | MACIO_FLAG_SCCB_ON;
	macio_chips[i].flags	= MACIO_FLAG_SCCB_ON | MACIO_FLAG_SCCB_ON;
	macio_chips[i].name	= macio_names[type];
	macio_chips[i].name	= macio_names[type];
	revp = (u32 *)get_property(node, "revision-id", NULL);
	revp = get_property(node, "revision-id", NULL);
	if (revp)
	if (revp)
		macio_chips[i].rev = *revp;
		macio_chips[i].rev = *revp;
	printk(KERN_INFO "Found a %s mac-io controller, rev: %d, mapped at 0x%p\n",
	printk(KERN_INFO "Found a %s mac-io controller, rev: %d, mapped at 0x%p\n",
@@ -2695,15 +2695,15 @@ static void __init
initial_serial_shutdown(struct device_node *np)
initial_serial_shutdown(struct device_node *np)
{
{
	int len;
	int len;
	struct slot_names_prop {
	const struct slot_names_prop {
		int	count;
		int	count;
		char	name[1];
		char	name[1];
	} *slots;
	} *slots;
	char *conn;
	const char *conn;
	int port_type = PMAC_SCC_ASYNC;
	int port_type = PMAC_SCC_ASYNC;
	int modem = 0;
	int modem = 0;


	slots = (struct slot_names_prop *)get_property(np, "slot-names", &len);
	slots = get_property(np, "slot-names", &len);
	conn = get_property(np, "AAPL,connector", &len);
	conn = get_property(np, "AAPL,connector", &len);
	if (conn && (strcmp(conn, "infrared") == 0))
	if (conn && (strcmp(conn, "infrared") == 0))
		port_type = PMAC_SCC_IRDA;
		port_type = PMAC_SCC_IRDA;
+12 −12
Original line number Original line Diff line number Diff line
@@ -477,7 +477,8 @@ static int kw_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize,
static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np)
static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np)
{
{
	struct pmac_i2c_host_kw *host;
	struct pmac_i2c_host_kw *host;
	u32			*psteps, *prate, *addrp, steps;
	const u32		*psteps, *prate, *addrp;
	u32			steps;


	host = kzalloc(sizeof(struct pmac_i2c_host_kw), GFP_KERNEL);
	host = kzalloc(sizeof(struct pmac_i2c_host_kw), GFP_KERNEL);
	if (host == NULL) {
	if (host == NULL) {
@@ -490,7 +491,7 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np)
	 * on all i2c keywest nodes so far ... we would have to fallback
	 * on all i2c keywest nodes so far ... we would have to fallback
	 * to macio parsing if that wasn't the case
	 * to macio parsing if that wasn't the case
	 */
	 */
	addrp = (u32 *)get_property(np, "AAPL,address", NULL);
	addrp = get_property(np, "AAPL,address", NULL);
	if (addrp == NULL) {
	if (addrp == NULL) {
		printk(KERN_ERR "low_i2c: Can't find address for %s\n",
		printk(KERN_ERR "low_i2c: Can't find address for %s\n",
		       np->full_name);
		       np->full_name);
@@ -504,13 +505,13 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np)
	host->timeout_timer.function = kw_i2c_timeout;
	host->timeout_timer.function = kw_i2c_timeout;
	host->timeout_timer.data = (unsigned long)host;
	host->timeout_timer.data = (unsigned long)host;


	psteps = (u32 *)get_property(np, "AAPL,address-step", NULL);
	psteps = get_property(np, "AAPL,address-step", NULL);
	steps = psteps ? (*psteps) : 0x10;
	steps = psteps ? (*psteps) : 0x10;
	for (host->bsteps = 0; (steps & 0x01) == 0; host->bsteps++)
	for (host->bsteps = 0; (steps & 0x01) == 0; host->bsteps++)
		steps >>= 1;
		steps >>= 1;
	/* Select interface rate */
	/* Select interface rate */
	host->speed = KW_I2C_MODE_25KHZ;
	host->speed = KW_I2C_MODE_25KHZ;
	prate = (u32 *)get_property(np, "AAPL,i2c-rate", NULL);
	prate = get_property(np, "AAPL,i2c-rate", NULL);
	if (prate) switch(*prate) {
	if (prate) switch(*prate) {
	case 100:
	case 100:
		host->speed = KW_I2C_MODE_100KHZ;
		host->speed = KW_I2C_MODE_100KHZ;
@@ -618,8 +619,8 @@ static void __init kw_i2c_probe(void)
		} else {
		} else {
			for (child = NULL;
			for (child = NULL;
			     (child = of_get_next_child(np, child)) != NULL;) {
			     (child = of_get_next_child(np, child)) != NULL;) {
				u32 *reg =
				const u32 *reg = get_property(child,
					(u32 *)get_property(child, "reg", NULL);
						"reg", NULL);
				if (reg == NULL)
				if (reg == NULL)
					continue;
					continue;
				kw_i2c_add(host, np, child, *reg);
				kw_i2c_add(host, np, child, *reg);
@@ -881,7 +882,7 @@ static void __init smu_i2c_probe(void)
{
{
	struct device_node *controller, *busnode;
	struct device_node *controller, *busnode;
	struct pmac_i2c_bus *bus;
	struct pmac_i2c_bus *bus;
	u32 *reg;
	const u32 *reg;
	int sz;
	int sz;


	if (!smu_present())
	if (!smu_present())
@@ -904,7 +905,7 @@ static void __init smu_i2c_probe(void)
		if (strcmp(busnode->type, "i2c") &&
		if (strcmp(busnode->type, "i2c") &&
		    strcmp(busnode->type, "i2c-bus"))
		    strcmp(busnode->type, "i2c-bus"))
			continue;
			continue;
		reg = (u32 *)get_property(busnode, "reg", NULL);
		reg = get_property(busnode, "reg", NULL);
		if (reg == NULL)
		if (reg == NULL)
			continue;
			continue;


@@ -948,9 +949,8 @@ struct pmac_i2c_bus *pmac_i2c_find_bus(struct device_node *node)
		list_for_each_entry(bus, &pmac_i2c_busses, link) {
		list_for_each_entry(bus, &pmac_i2c_busses, link) {
			if (p == bus->busnode) {
			if (p == bus->busnode) {
				if (prev && bus->flags & pmac_i2c_multibus) {
				if (prev && bus->flags & pmac_i2c_multibus) {
					u32 *reg;
					const u32 *reg;
					reg = (u32 *)get_property(prev, "reg",
					reg = get_property(prev, "reg", NULL);
								  NULL);
					if (!reg)
					if (!reg)
						continue;
						continue;
					if (((*reg) >> 8) != bus->channel)
					if (((*reg) >> 8) != bus->channel)
@@ -971,7 +971,7 @@ EXPORT_SYMBOL_GPL(pmac_i2c_find_bus);


u8 pmac_i2c_get_dev_addr(struct device_node *device)
u8 pmac_i2c_get_dev_addr(struct device_node *device)
{
{
	u32 *reg = (u32 *)get_property(device, "reg", NULL);
	const u32 *reg = get_property(device, "reg", NULL);


	if (reg == NULL)
	if (reg == NULL)
		return 0;
		return 0;
Loading