提交 a7edd0e6 编写于 作者: S Stephen Rothwell 提交者: Paul Mackerras

[POWERPC] get_property returns const

This just tidies up some of the remains.
Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: NPaul Mackerras <paulus@samba.org>
上级 6c2d0469
...@@ -141,10 +141,10 @@ static void ams_worker(struct work_struct *work) ...@@ -141,10 +141,10 @@ static void ams_worker(struct work_struct *work)
int ams_sensor_attach(void) int ams_sensor_attach(void)
{ {
int result; int result;
u32 *prop; const u32 *prop;
/* Get orientation */ /* Get orientation */
prop = (u32*)get_property(ams_info.of_node, "orientation", NULL); prop = get_property(ams_info.of_node, "orientation", NULL);
if (!prop) if (!prop)
return -ENODEV; return -ENODEV;
ams_info.orient1 = *prop; ams_info.orient1 = *prop;
......
...@@ -263,7 +263,7 @@ int __init ams_i2c_init(struct device_node *np) ...@@ -263,7 +263,7 @@ int __init ams_i2c_init(struct device_node *np)
{ {
char *tmp_bus; char *tmp_bus;
int result; int result;
u32 *prop; const u32 *prop;
mutex_lock(&ams_info.lock); mutex_lock(&ams_info.lock);
...@@ -276,7 +276,7 @@ int __init ams_i2c_init(struct device_node *np) ...@@ -276,7 +276,7 @@ int __init ams_i2c_init(struct device_node *np)
ams_info.bustype = BUS_I2C; ams_info.bustype = BUS_I2C;
/* look for bus either using "reg" or by path */ /* look for bus either using "reg" or by path */
prop = (u32*)get_property(ams_info.of_node, "reg", NULL); prop = get_property(ams_info.of_node, "reg", NULL);
if (!prop) { if (!prop) {
result = -ENODEV; result = -ENODEV;
......
...@@ -146,7 +146,7 @@ static void ams_pmu_exit(void) ...@@ -146,7 +146,7 @@ static void ams_pmu_exit(void)
int __init ams_pmu_init(struct device_node *np) int __init ams_pmu_init(struct device_node *np)
{ {
u32 *prop; const u32 *prop;
int result; int result;
mutex_lock(&ams_info.lock); mutex_lock(&ams_info.lock);
...@@ -160,7 +160,7 @@ int __init ams_pmu_init(struct device_node *np) ...@@ -160,7 +160,7 @@ int __init ams_pmu_init(struct device_node *np)
ams_info.bustype = BUS_HOST; ams_info.bustype = BUS_HOST;
/* Get PMU command, should be 0x4e, but we can never know */ /* Get PMU command, should be 0x4e, but we can never know */
prop = (u32*)get_property(ams_info.of_node, "reg", NULL); prop = get_property(ams_info.of_node, "reg", NULL);
if (!prop) { if (!prop) {
result = -ENODEV; result = -ENODEV;
goto exit; goto exit;
......
...@@ -565,11 +565,11 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev, ...@@ -565,11 +565,11 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev,
const struct of_device_id *id) const struct of_device_id *id)
{ {
struct ehca_shca *shca; struct ehca_shca *shca;
u64 *handle; const u64 *handle;
struct ib_pd *ibpd; struct ib_pd *ibpd;
int ret; int ret;
handle = (u64 *)get_property(dev->ofdev.node, "ibm,hca-handle", NULL); handle = get_property(dev->ofdev.node, "ibm,hca-handle", NULL);
if (!handle) { if (!handle) {
ehca_gen_err("Cannot get eHCA handle for adapter: %s.", ehca_gen_err("Cannot get eHCA handle for adapter: %s.",
dev->ofdev.node->full_name); dev->ofdev.node->full_name);
......
...@@ -2320,7 +2320,7 @@ static int ehea_setup_single_port(struct ehea_port *port, ...@@ -2320,7 +2320,7 @@ static int ehea_setup_single_port(struct ehea_port *port,
struct net_device *dev = port->netdev; struct net_device *dev = port->netdev;
struct ehea_adapter *adapter = port->adapter; struct ehea_adapter *adapter = port->adapter;
struct hcp_ehea_port_cb4 *cb4; struct hcp_ehea_port_cb4 *cb4;
u32 *dn_log_port_id; const u32 *dn_log_port_id;
int jumbo = 0; int jumbo = 0;
sema_init(&port->port_lock, 1); sema_init(&port->port_lock, 1);
...@@ -2336,7 +2336,7 @@ static int ehea_setup_single_port(struct ehea_port *port, ...@@ -2336,7 +2336,7 @@ static int ehea_setup_single_port(struct ehea_port *port,
port->of_dev_node = dn; port->of_dev_node = dn;
/* Determine logical port id */ /* Determine logical port id */
dn_log_port_id = (u32*)get_property(dn, "ibm,hea-port-no", NULL); dn_log_port_id = get_property(dn, "ibm,hea-port-no", NULL);
if (!dn_log_port_id) { if (!dn_log_port_id) {
ehea_error("bad device node: dn_log_port_id=%p", ehea_error("bad device node: dn_log_port_id=%p",
...@@ -2492,7 +2492,7 @@ static int __devinit ehea_probe(struct ibmebus_dev *dev, ...@@ -2492,7 +2492,7 @@ static int __devinit ehea_probe(struct ibmebus_dev *dev,
const struct of_device_id *id) const struct of_device_id *id)
{ {
struct ehea_adapter *adapter; struct ehea_adapter *adapter;
u64 *adapter_handle; const u64 *adapter_handle;
int ret; int ret;
adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); adapter = kzalloc(sizeof(*adapter), GFP_KERNEL);
...@@ -2502,7 +2502,7 @@ static int __devinit ehea_probe(struct ibmebus_dev *dev, ...@@ -2502,7 +2502,7 @@ static int __devinit ehea_probe(struct ibmebus_dev *dev,
goto out; goto out;
} }
adapter_handle = (u64*)get_property(dev->ofdev.node, "ibm,hea-handle", adapter_handle = get_property(dev->ofdev.node, "ibm,hea-handle",
NULL); NULL);
if (adapter_handle) if (adapter_handle)
adapter->handle = *adapter_handle; adapter->handle = *adapter_handle;
......
...@@ -897,7 +897,7 @@ static int get_system_info(void) ...@@ -897,7 +897,7 @@ static int get_system_info(void)
{ {
struct device_node *rootdn; struct device_node *rootdn;
const char *id, *model, *name; const char *id, *model, *name;
unsigned int *num; const unsigned int *num;
rootdn = find_path_device("/"); rootdn = find_path_device("/");
if (!rootdn) if (!rootdn)
...@@ -912,7 +912,7 @@ static int get_system_info(void) ...@@ -912,7 +912,7 @@ static int get_system_info(void)
if (name) if (name)
strncpy(partition_name, name, sizeof(partition_name)); strncpy(partition_name, name, sizeof(partition_name));
num = (unsigned int *) get_property(rootdn, "ibm,partition-no", NULL); num = get_property(rootdn, "ibm,partition-no", NULL);
if (num) if (num)
partition_number = *num; partition_number = *num;
......
...@@ -1262,7 +1262,7 @@ static void radeon_pm_full_reset_sdram(struct radeonfb_info *rinfo) ...@@ -1262,7 +1262,7 @@ static void radeon_pm_full_reset_sdram(struct radeonfb_info *rinfo)
/* This is the code for the Aluminium PowerBooks M10 / iBooks M11 */ /* This is the code for the Aluminium PowerBooks M10 / iBooks M11 */
if (rinfo->family == CHIP_FAMILY_RV350) { if (rinfo->family == CHIP_FAMILY_RV350) {
u32 sdram_mode_reg = rinfo->save_regs[35]; u32 sdram_mode_reg = rinfo->save_regs[35];
static u32 default_mrtable[] = static const u32 default_mrtable[] =
{ 0x21320032, { 0x21320032,
0x21321000, 0xa1321000, 0x21321000, 0xffffffff, 0x21321000, 0xa1321000, 0x21321000, 0xffffffff,
0x21320032, 0xa1320032, 0x21320032, 0xffffffff, 0x21320032, 0xa1320032, 0x21320032, 0xffffffff,
......
...@@ -1062,9 +1062,9 @@ static int onyx_i2c_attach(struct i2c_adapter *adapter) ...@@ -1062,9 +1062,9 @@ static int onyx_i2c_attach(struct i2c_adapter *adapter)
while ((dev = of_get_next_child(busnode, dev)) != NULL) { while ((dev = of_get_next_child(busnode, dev)) != NULL) {
if (device_is_compatible(dev, "pcm3052")) { if (device_is_compatible(dev, "pcm3052")) {
u32 *addr; const u32 *addr;
printk(KERN_DEBUG PFX "found pcm3052\n"); printk(KERN_DEBUG PFX "found pcm3052\n");
addr = (u32 *) get_property(dev, "reg", NULL); addr = get_property(dev, "reg", NULL);
if (!addr) if (!addr)
return -ENODEV; return -ENODEV;
return onyx_create(adapter, dev, (*addr)>>1); return onyx_create(adapter, dev, (*addr)>>1);
......
...@@ -939,9 +939,9 @@ static int tas_i2c_attach(struct i2c_adapter *adapter) ...@@ -939,9 +939,9 @@ static int tas_i2c_attach(struct i2c_adapter *adapter)
while ((dev = of_get_next_child(busnode, dev)) != NULL) { while ((dev = of_get_next_child(busnode, dev)) != NULL) {
if (device_is_compatible(dev, "tas3004")) { if (device_is_compatible(dev, "tas3004")) {
u32 *addr; const u32 *addr;
printk(KERN_DEBUG PFX "found tas3004\n"); printk(KERN_DEBUG PFX "found tas3004\n");
addr = (u32 *) get_property(dev, "reg", NULL); addr = get_property(dev, "reg", NULL);
if (!addr) if (!addr)
continue; continue;
return tas_create(adapter, dev, ((*addr) >> 1) & 0x7f); return tas_create(adapter, dev, ((*addr) >> 1) & 0x7f);
...@@ -950,7 +950,8 @@ static int tas_i2c_attach(struct i2c_adapter *adapter) ...@@ -950,7 +950,8 @@ static int tas_i2c_attach(struct i2c_adapter *adapter)
* property that says 'tas3004', they just have a 'deq' * property that says 'tas3004', they just have a 'deq'
* node without any such property... */ * node without any such property... */
if (strcmp(dev->name, "deq") == 0) { if (strcmp(dev->name, "deq") == 0) {
u32 *_addr, addr; const u32 *_addr;
u32 addr;
printk(KERN_DEBUG PFX "found 'deq' node\n"); printk(KERN_DEBUG PFX "found 'deq' node\n");
_addr = (u32 *) get_property(dev, "i2c-address", NULL); _addr = (u32 *) get_property(dev, "i2c-address", NULL);
if (!_addr) if (!_addr)
......
...@@ -55,7 +55,7 @@ static struct device_node *get_gpio(char *name, ...@@ -55,7 +55,7 @@ static struct device_node *get_gpio(char *name,
int *gpioactiveptr) int *gpioactiveptr)
{ {
struct device_node *np, *gpio; struct device_node *np, *gpio;
u32 *reg; const u32 *reg;
const char *audio_gpio; const char *audio_gpio;
*gpioptr = -1; *gpioptr = -1;
...@@ -84,7 +84,7 @@ static struct device_node *get_gpio(char *name, ...@@ -84,7 +84,7 @@ static struct device_node *get_gpio(char *name,
return NULL; return NULL;
} }
reg = (u32 *)get_property(np, "reg", NULL); reg = get_property(np, "reg", NULL);
if (!reg) if (!reg)
return NULL; return NULL;
...@@ -96,7 +96,7 @@ static struct device_node *get_gpio(char *name, ...@@ -96,7 +96,7 @@ static struct device_node *get_gpio(char *name,
if (*gpioptr < 0x50) if (*gpioptr < 0x50)
*gpioptr += 0x50; *gpioptr += 0x50;
reg = (u32 *)get_property(np, "audio-gpio-active-state", NULL); reg = get_property(np, "audio-gpio-active-state", NULL);
if (!reg) if (!reg)
/* Apple seems to default to 1, but /* Apple seems to default to 1, but
* that doesn't seem right at least on most * that doesn't seem right at least on most
......
...@@ -724,7 +724,7 @@ static int check_codec(struct aoa_codec *codec, ...@@ -724,7 +724,7 @@ static int check_codec(struct aoa_codec *codec,
struct layout_dev *ldev, struct layout_dev *ldev,
struct codec_connect_info *cci) struct codec_connect_info *cci)
{ {
u32 *ref; const u32 *ref;
char propname[32]; char propname[32];
struct codec_connection *cc; struct codec_connection *cc;
...@@ -732,7 +732,7 @@ static int check_codec(struct aoa_codec *codec, ...@@ -732,7 +732,7 @@ static int check_codec(struct aoa_codec *codec,
if (codec->node && (strcmp(codec->node->name, "codec") == 0)) { if (codec->node && (strcmp(codec->node->name, "codec") == 0)) {
snprintf(propname, sizeof(propname), snprintf(propname, sizeof(propname),
"platform-%s-codec-ref", codec->name); "platform-%s-codec-ref", codec->name);
ref = (u32*)get_property(ldev->sound, propname, NULL); ref = get_property(ldev->sound, propname, NULL);
if (!ref) { if (!ref) {
printk(KERN_INFO "snd-aoa-fabric-layout: " printk(KERN_INFO "snd-aoa-fabric-layout: "
"required property %s not present\n", propname); "required property %s not present\n", propname);
......
...@@ -61,9 +61,10 @@ static int soundbus_uevent(struct device *dev, char **envp, int num_envp, ...@@ -61,9 +61,10 @@ static int soundbus_uevent(struct device *dev, char **envp, int num_envp,
{ {
struct soundbus_dev * soundbus_dev; struct soundbus_dev * soundbus_dev;
struct of_device * of; struct of_device * of;
char *scratch, *compat, *compat2; char *scratch;
const char *compat;
int i = 0; int i = 0;
int length, cplen, cplen2, seen = 0; int length, cplen, seen = 0;
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
...@@ -95,9 +96,7 @@ static int soundbus_uevent(struct device *dev, char **envp, int num_envp, ...@@ -95,9 +96,7 @@ static int soundbus_uevent(struct device *dev, char **envp, int num_envp,
* it's not really legal to split it out with commas. We split it * it's not really legal to split it out with commas. We split it
* up using a number of environment variables instead. */ * up using a number of environment variables instead. */
compat = (char *) get_property(of->node, "compatible", &cplen); compat = get_property(of->node, "compatible", &cplen);
compat2 = compat;
cplen2= cplen;
while (compat && cplen > 0) { while (compat && cplen > 0) {
envp[i++] = scratch; envp[i++] = scratch;
length = scnprintf (scratch, buffer_size, length = scnprintf (scratch, buffer_size,
......
...@@ -122,7 +122,7 @@ static int i2sbus_get_and_fixup_rsrc(struct device_node *np, int index, ...@@ -122,7 +122,7 @@ static int i2sbus_get_and_fixup_rsrc(struct device_node *np, int index,
{ {
struct device_node *parent; struct device_node *parent;
int pindex, rc = -ENXIO; int pindex, rc = -ENXIO;
u32 *reg; const u32 *reg;
/* Machines with layout 76 and 36 (K2 based) have a weird device /* Machines with layout 76 and 36 (K2 based) have a weird device
* tree what we need to special case. * tree what we need to special case.
...@@ -141,7 +141,7 @@ static int i2sbus_get_and_fixup_rsrc(struct device_node *np, int index, ...@@ -141,7 +141,7 @@ static int i2sbus_get_and_fixup_rsrc(struct device_node *np, int index,
rc = of_address_to_resource(parent, pindex, res); rc = of_address_to_resource(parent, pindex, res);
if (rc) if (rc)
goto bail; goto bail;
reg = (u32 *)get_property(np, "reg", NULL); reg = get_property(np, "reg", NULL);
if (reg == NULL) { if (reg == NULL) {
rc = -ENXIO; rc = -ENXIO;
goto bail; goto bail;
...@@ -188,8 +188,7 @@ static int i2sbus_add_dev(struct macio_dev *macio, ...@@ -188,8 +188,7 @@ static int i2sbus_add_dev(struct macio_dev *macio,
} }
} }
if (i == 1) { if (i == 1) {
u32 *layout_id; const u32 *layout_id = get_property(sound, "layout-id", NULL);
layout_id = (u32*) get_property(sound, "layout-id", NULL);
if (layout_id) { if (layout_id) {
layout = *layout_id; layout = *layout_id;
snprintf(dev->sound.modalias, 32, snprintf(dev->sound.modalias, 32,
......
...@@ -578,7 +578,7 @@ tas_mixer_ioctl(u_int cmd, u_long arg) ...@@ -578,7 +578,7 @@ tas_mixer_ioctl(u_int cmd, u_long arg)
} }
static void __init static void __init
tas_init_frame_rates(unsigned int *prop, unsigned int l) tas_init_frame_rates(const unsigned int *prop, unsigned int l)
{ {
int i ; int i ;
if (prop) { if (prop) {
...@@ -2651,7 +2651,7 @@ get_expansion_type(void) ...@@ -2651,7 +2651,7 @@ get_expansion_type(void)
*/ */
static void __init static void __init
awacs_init_frame_rates(unsigned int *prop, unsigned int l) awacs_init_frame_rates(const unsigned int *prop, unsigned int l)
{ {
int i ; int i ;
if (prop) { if (prop) {
...@@ -2674,7 +2674,7 @@ awacs_init_frame_rates(unsigned int *prop, unsigned int l) ...@@ -2674,7 +2674,7 @@ awacs_init_frame_rates(unsigned int *prop, unsigned int l)
} }
static void __init static void __init
burgundy_init_frame_rates(unsigned int *prop, unsigned int l) burgundy_init_frame_rates(const unsigned int *prop, unsigned int l)
{ {
int temp[9] ; int temp[9] ;
int i = 0 ; int i = 0 ;
...@@ -2700,7 +2700,7 @@ if (i > 1){ ...@@ -2700,7 +2700,7 @@ if (i > 1){
} }
static void __init static void __init
daca_init_frame_rates(unsigned int *prop, unsigned int l) daca_init_frame_rates(const unsigned int *prop, unsigned int l)
{ {
int temp[9] ; int temp[9] ;
int i = 0 ; int i = 0 ;
...@@ -2727,7 +2727,7 @@ if (i > 1){ ...@@ -2727,7 +2727,7 @@ if (i > 1){
} }
static void __init static void __init
init_frame_rates(unsigned int *prop, unsigned int l) init_frame_rates(const unsigned int *prop, unsigned int l)
{ {
switch (awacs_revision) { switch (awacs_revision) {
case AWACS_TUMBLER: case AWACS_TUMBLER:
...@@ -2972,21 +2972,21 @@ printk("dmasound_pmac: Awacs/Screamer Codec Mfct: %d Rev %d\n", mfg, rev); ...@@ -2972,21 +2972,21 @@ printk("dmasound_pmac: Awacs/Screamer Codec Mfct: %d Rev %d\n", mfg, rev);
*/ */
if (info) { if (info) {
unsigned int *prop, l; const unsigned int *prop;
unsigned int l;
sound_device_id = 0; sound_device_id = 0;
/* device ID appears post g3 b&w */ /* device ID appears post g3 b&w */
prop = (unsigned int *)get_property(info, "device-id", NULL); prop = get_property(info, "device-id", NULL);
if (prop != 0) if (prop != 0)
sound_device_id = *prop; sound_device_id = *prop;
/* look for a property saying what sample rates /* look for a property saying what sample rates
are available */ are available */
prop = (unsigned int *)get_property(info, "sample-rates", &l); prop = get_property(info, "sample-rates", &l);
if (prop == 0) if (prop == 0)
prop = (unsigned int *) get_property prop = get_property(info, "output-frame-rates", &l);
(info, "output-frame-rates", &l);
/* if it's there use it to set up frame rates */ /* if it's there use it to set up frame rates */
init_frame_rates(prop, l) ; init_frame_rates(prop, l) ;
......
...@@ -190,7 +190,7 @@ tas_cleanup(void) ...@@ -190,7 +190,7 @@ tas_cleanup(void)
int __init int __init
tas_init(int driver_id, const char *driver_name) tas_init(int driver_id, const char *driver_name)
{ {
u32* paddr; const u32* paddr;
printk(KERN_INFO "tas driver [%s])\n", driver_name); printk(KERN_INFO "tas driver [%s])\n", driver_name);
...@@ -200,7 +200,7 @@ tas_init(int driver_id, const char *driver_name) ...@@ -200,7 +200,7 @@ tas_init(int driver_id, const char *driver_name)
tas_node = find_devices("deq"); tas_node = find_devices("deq");
if (tas_node == NULL) if (tas_node == NULL)
return -ENODEV; return -ENODEV;
paddr = (u32 *)get_property(tas_node, "i2c-address", NULL); paddr = get_property(tas_node, "i2c-address", NULL);
if (paddr) { if (paddr) {
tas_i2c_address = (*paddr) >> 1; tas_i2c_address = (*paddr) >> 1;
printk(KERN_INFO "using i2c address: 0x%x from device-tree\n", printk(KERN_INFO "using i2c address: 0x%x from device-tree\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册