Commit b04e3dd4 authored by Jeremy Kerr's avatar Jeremy Kerr Committed by Paul Mackerras

[POWERPC] video & agp: 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.

powerpc-specific video & agp driver changes.
Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 018a3d1d
...@@ -601,8 +601,8 @@ static int __devinit agp_uninorth_probe(struct pci_dev *pdev, ...@@ -601,8 +601,8 @@ static int __devinit agp_uninorth_probe(struct pci_dev *pdev,
uninorth_node = of_find_node_by_name(NULL, "u3"); uninorth_node = of_find_node_by_name(NULL, "u3");
} }
if (uninorth_node) { if (uninorth_node) {
int *revprop = (int *) const int *revprop = get_property(uninorth_node,
get_property(uninorth_node, "device-rev", NULL); "device-rev", NULL);
if (revprop != NULL) if (revprop != NULL)
uninorth_rev = *revprop & 0x3f; uninorth_rev = *revprop & 0x3f;
of_node_put(uninorth_node); of_node_put(uninorth_node);
......
...@@ -350,30 +350,30 @@ static void __init s3triofb_of_init(struct device_node *dp) ...@@ -350,30 +350,30 @@ static void __init s3triofb_of_init(struct device_node *dp)
s3trio_name[sizeof(s3trio_name)-1] = '\0'; s3trio_name[sizeof(s3trio_name)-1] = '\0';
strcpy(fb_fix.id, s3trio_name); strcpy(fb_fix.id, s3trio_name);
if((pp = (int *)get_property(dp, "vendor-id", &len)) != NULL if((pp = get_property(dp, "vendor-id", &len)) != NULL
&& *pp!=PCI_VENDOR_ID_S3) { && *pp!=PCI_VENDOR_ID_S3) {
printk("%s: can't find S3 Trio board\n", dp->full_name); printk("%s: can't find S3 Trio board\n", dp->full_name);
return; return;
} }
if((pp = (int *)get_property(dp, "device-id", &len)) != NULL if((pp = get_property(dp, "device-id", &len)) != NULL
&& *pp!=PCI_DEVICE_ID_S3_TRIO) { && *pp!=PCI_DEVICE_ID_S3_TRIO) {
printk("%s: can't find S3 Trio board\n", dp->full_name); printk("%s: can't find S3 Trio board\n", dp->full_name);
return; return;
} }
if ((pp = (int *)get_property(dp, "depth", &len)) != NULL if ((pp = get_property(dp, "depth", &len)) != NULL
&& len == sizeof(int) && *pp != 8) { && len == sizeof(int) && *pp != 8) {
printk("%s: can't use depth = %d\n", dp->full_name, *pp); printk("%s: can't use depth = %d\n", dp->full_name, *pp);
return; return;
} }
if ((pp = (int *)get_property(dp, "width", &len)) != NULL if ((pp = get_property(dp, "width", &len)) != NULL
&& len == sizeof(int)) && len == sizeof(int))
fb_var.xres = fb_var.xres_virtual = *pp; fb_var.xres = fb_var.xres_virtual = *pp;
if ((pp = (int *)get_property(dp, "height", &len)) != NULL if ((pp = get_property(dp, "height", &len)) != NULL
&& len == sizeof(int)) && len == sizeof(int))
fb_var.yres = fb_var.yres_virtual = *pp; fb_var.yres = fb_var.yres_virtual = *pp;
if ((pp = (int *)get_property(dp, "linebytes", &len)) != NULL if ((pp = get_property(dp, "linebytes", &len)) != NULL
&& len == sizeof(int)) && len == sizeof(int))
fb_fix.line_length = *pp; fb_fix.line_length = *pp;
else else
......
...@@ -412,11 +412,11 @@ static int __devinit radeon_find_mem_vbios(struct radeonfb_info *rinfo) ...@@ -412,11 +412,11 @@ static int __devinit radeon_find_mem_vbios(struct radeonfb_info *rinfo)
static int __devinit radeon_read_xtal_OF (struct radeonfb_info *rinfo) static int __devinit radeon_read_xtal_OF (struct radeonfb_info *rinfo)
{ {
struct device_node *dp = rinfo->of_node; struct device_node *dp = rinfo->of_node;
u32 *val; const u32 *val;
if (dp == NULL) if (dp == NULL)
return -ENODEV; return -ENODEV;
val = (u32 *) get_property(dp, "ATY,RefCLK", NULL); val = get_property(dp, "ATY,RefCLK", NULL);
if (!val || !*val) { if (!val || !*val) {
printk(KERN_WARNING "radeonfb: No ATY,RefCLK property !\n"); printk(KERN_WARNING "radeonfb: No ATY,RefCLK property !\n");
return -EINVAL; return -EINVAL;
...@@ -424,11 +424,11 @@ static int __devinit radeon_read_xtal_OF (struct radeonfb_info *rinfo) ...@@ -424,11 +424,11 @@ static int __devinit radeon_read_xtal_OF (struct radeonfb_info *rinfo)
rinfo->pll.ref_clk = (*val) / 10; rinfo->pll.ref_clk = (*val) / 10;
val = (u32 *) get_property(dp, "ATY,SCLK", NULL); val = get_property(dp, "ATY,SCLK", NULL);
if (val && *val) if (val && *val)
rinfo->pll.sclk = (*val) / 10; rinfo->pll.sclk = (*val) / 10;
val = (u32 *) get_property(dp, "ATY,MCLK", NULL); val = get_property(dp, "ATY,MCLK", NULL);
if (val && *val) if (val && *val)
rinfo->pll.mclk = (*val) / 10; rinfo->pll.mclk = (*val) / 10;
......
...@@ -64,13 +64,13 @@ static int __devinit radeon_parse_montype_prop(struct device_node *dp, u8 **out_ ...@@ -64,13 +64,13 @@ static int __devinit radeon_parse_montype_prop(struct device_node *dp, u8 **out_
{ {
static char *propnames[] = { "DFP,EDID", "LCD,EDID", "EDID", static char *propnames[] = { "DFP,EDID", "LCD,EDID", "EDID",
"EDID1", "EDID2", NULL }; "EDID1", "EDID2", NULL };
u8 *pedid = NULL; const u8 *pedid = NULL;
u8 *pmt = NULL; const u8 *pmt = NULL;
u8 *tmp; u8 *tmp;
int i, mt = MT_NONE; int i, mt = MT_NONE;
RTRACE("analyzing OF properties...\n"); RTRACE("analyzing OF properties...\n");
pmt = (u8 *)get_property(dp, "display-type", NULL); pmt = get_property(dp, "display-type", NULL);
if (!pmt) if (!pmt)
return MT_NONE; return MT_NONE;
RTRACE("display-type: %s\n", pmt); RTRACE("display-type: %s\n", pmt);
...@@ -89,7 +89,7 @@ static int __devinit radeon_parse_montype_prop(struct device_node *dp, u8 **out_ ...@@ -89,7 +89,7 @@ static int __devinit radeon_parse_montype_prop(struct device_node *dp, u8 **out_
} }
for (i = 0; propnames[i] != NULL; ++i) { for (i = 0; propnames[i] != NULL; ++i) {
pedid = (u8 *)get_property(dp, propnames[i], NULL); pedid = get_property(dp, propnames[i], NULL);
if (pedid != NULL) if (pedid != NULL)
break; break;
} }
...@@ -124,14 +124,14 @@ static int __devinit radeon_probe_OF_head(struct radeonfb_info *rinfo, int head_ ...@@ -124,14 +124,14 @@ static int __devinit radeon_probe_OF_head(struct radeonfb_info *rinfo, int head_
return MT_NONE; return MT_NONE;
if (rinfo->has_CRTC2) { if (rinfo->has_CRTC2) {
char *pname; const char *pname;
int len, second = 0; int len, second = 0;
dp = dp->child; dp = dp->child;
do { do {
if (!dp) if (!dp)
return MT_NONE; return MT_NONE;
pname = (char *)get_property(dp, "name", NULL); pname = get_property(dp, "name", NULL);
if (!pname) if (!pname)
return MT_NONE; return MT_NONE;
len = strlen(pname); len = strlen(pname);
......
...@@ -1167,7 +1167,7 @@ static void radeon_pm_full_reset_sdram(struct radeonfb_info *rinfo) ...@@ -1167,7 +1167,7 @@ static void radeon_pm_full_reset_sdram(struct radeonfb_info *rinfo)
0x21320032, 0xa1320032, 0x21320032, 0xffffffff, 0x21320032, 0xa1320032, 0x21320032, 0xffffffff,
0x31320032 }; 0x31320032 };
u32 *mrtable = default_mrtable; const u32 *mrtable = default_mrtable;
int i, mrtable_size = ARRAY_SIZE(default_mrtable); int i, mrtable_size = ARRAY_SIZE(default_mrtable);
mdelay(30); mdelay(30);
...@@ -1186,7 +1186,7 @@ static void radeon_pm_full_reset_sdram(struct radeonfb_info *rinfo) ...@@ -1186,7 +1186,7 @@ static void radeon_pm_full_reset_sdram(struct radeonfb_info *rinfo)
if (rinfo->of_node != NULL) { if (rinfo->of_node != NULL) {
int size; int size;
mrtable = (u32 *)get_property(rinfo->of_node, "ATY,MRT", &size); mrtable = get_property(rinfo->of_node, "ATY,MRT", &size);
if (mrtable) if (mrtable)
mrtable_size = size >> 2; mrtable_size = size >> 2;
else else
......
...@@ -32,7 +32,7 @@ int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid) ...@@ -32,7 +32,7 @@ int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid)
{ {
struct nvidia_par *par = info->par; struct nvidia_par *par = info->par;
struct device_node *parent, *dp; struct device_node *parent, *dp;
unsigned char *pedid = NULL; const unsigned char *pedid = NULL;
static char *propnames[] = { static char *propnames[] = {
"DFP,EDID", "LCD,EDID", "EDID", "EDID1", "DFP,EDID", "LCD,EDID", "EDID", "EDID1",
"EDID,B", "EDID,A", NULL }; "EDID,B", "EDID,A", NULL };
...@@ -42,20 +42,19 @@ int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid) ...@@ -42,20 +42,19 @@ int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid)
if (parent == NULL) if (parent == NULL)
return -1; return -1;
if (par->twoHeads) { if (par->twoHeads) {
char *pname; const char *pname;
int len; int len;
for (dp = NULL; for (dp = NULL;
(dp = of_get_next_child(parent, dp)) != NULL;) { (dp = of_get_next_child(parent, dp)) != NULL;) {
pname = (char *)get_property(dp, "name", NULL); pname = get_property(dp, "name", NULL);
if (!pname) if (!pname)
continue; continue;
len = strlen(pname); len = strlen(pname);
if ((pname[len-1] == 'A' && conn == 1) || if ((pname[len-1] == 'A' && conn == 1) ||
(pname[len-1] == 'B' && conn == 2)) { (pname[len-1] == 'B' && conn == 2)) {
for (i = 0; propnames[i] != NULL; ++i) { for (i = 0; propnames[i] != NULL; ++i) {
pedid = (unsigned char *) pedid = get_property(dp, propnames[i],
get_property(dp, propnames[i],
NULL); NULL);
if (pedid != NULL) if (pedid != NULL)
break; break;
...@@ -67,8 +66,7 @@ int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid) ...@@ -67,8 +66,7 @@ int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid)
} }
if (pedid == NULL) { if (pedid == NULL) {
for (i = 0; propnames[i] != NULL; ++i) { for (i = 0; propnames[i] != NULL; ++i) {
pedid = (unsigned char *) pedid = get_property(parent, propnames[i], NULL);
get_property(parent, propnames[i], NULL);
if (pedid != NULL) if (pedid != NULL)
break; break;
} }
......
...@@ -410,30 +410,30 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node) ...@@ -410,30 +410,30 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node)
unsigned int flags, rsize, addr_prop = 0; unsigned int flags, rsize, addr_prop = 0;
unsigned long max_size = 0; unsigned long max_size = 0;
u64 rstart, address = OF_BAD_ADDR; u64 rstart, address = OF_BAD_ADDR;
u32 *pp, *addrp, *up; const u32 *pp, *addrp, *up;
u64 asize; u64 asize;
pp = (u32 *)get_property(dp, "linux,bootx-depth", &len); pp = get_property(dp, "linux,bootx-depth", &len);
if (pp == NULL) if (pp == NULL)
pp = (u32 *)get_property(dp, "depth", &len); pp = get_property(dp, "depth", &len);
if (pp && len == sizeof(u32)) if (pp && len == sizeof(u32))
depth = *pp; depth = *pp;
pp = (u32 *)get_property(dp, "linux,bootx-width", &len); pp = get_property(dp, "linux,bootx-width", &len);
if (pp == NULL) if (pp == NULL)
pp = (u32 *)get_property(dp, "width", &len); pp = get_property(dp, "width", &len);
if (pp && len == sizeof(u32)) if (pp && len == sizeof(u32))
width = *pp; width = *pp;
pp = (u32 *)get_property(dp, "linux,bootx-height", &len); pp = get_property(dp, "linux,bootx-height", &len);
if (pp == NULL) if (pp == NULL)
pp = (u32 *)get_property(dp, "height", &len); pp = get_property(dp, "height", &len);
if (pp && len == sizeof(u32)) if (pp && len == sizeof(u32))
height = *pp; height = *pp;
pp = (u32 *)get_property(dp, "linux,bootx-linebytes", &len); pp = get_property(dp, "linux,bootx-linebytes", &len);
if (pp == NULL) if (pp == NULL)
pp = (u32 *)get_property(dp, "linebytes", &len); pp = get_property(dp, "linebytes", &len);
if (pp && len == sizeof(u32)) if (pp && len == sizeof(u32))
pitch = *pp; pitch = *pp;
else else
...@@ -451,9 +451,9 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node) ...@@ -451,9 +451,9 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node)
* ranges and pick one that is both big enough and if possible encloses * ranges and pick one that is both big enough and if possible encloses
* the "address" property. If none match, we pick the biggest * the "address" property. If none match, we pick the biggest
*/ */
up = (u32 *)get_property(dp, "linux,bootx-addr", &len); up = get_property(dp, "linux,bootx-addr", &len);
if (up == NULL) if (up == NULL)
up = (u32 *)get_property(dp, "address", &len); up = get_property(dp, "address", &len);
if (up && len == sizeof(u32)) if (up && len == sizeof(u32))
addr_prop = *up; addr_prop = *up;
......
...@@ -1816,14 +1816,13 @@ static int __devinit riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd) ...@@ -1816,14 +1816,13 @@ static int __devinit riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd)
NVTRACE_ENTER(); NVTRACE_ENTER();
dp = pci_device_to_OF_node(pd); dp = pci_device_to_OF_node(pd);
for (; dp != NULL; dp = dp->child) { for (; dp != NULL; dp = dp->child) {
disptype = (unsigned char *)get_property(dp, "display-type", NULL); disptype = get_property(dp, "display-type", NULL);
if (disptype == NULL) if (disptype == NULL)
continue; continue;
if (strncmp(disptype, "LCD", 3) != 0) if (strncmp(disptype, "LCD", 3) != 0)
continue; continue;
for (i = 0; propnames[i] != NULL; ++i) { for (i = 0; propnames[i] != NULL; ++i) {
pedid = (unsigned char *) pedid = get_property(dp, propnames[i], NULL);
get_property(dp, propnames[i], NULL);
if (pedid != NULL) { if (pedid != NULL) {
par->EDID = pedid; par->EDID = pedid;
NVTRACE("LCD found.\n"); NVTRACE("LCD found.\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment