mirror of https://gitee.com/openkylin/linux.git
[POWERPC] netdevices: 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 network device driver changes. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
parent
294ef16a2e
commit
1a2509c946
|
@ -1264,7 +1264,8 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_i
|
||||||
{
|
{
|
||||||
int j, rev, ret;
|
int j, rev, ret;
|
||||||
struct bmac_data *bp;
|
struct bmac_data *bp;
|
||||||
unsigned char *addr;
|
const unsigned char *prop_addr;
|
||||||
|
unsigned char addr[6];
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
int is_bmac_plus = ((int)match->data) != 0;
|
int is_bmac_plus = ((int)match->data) != 0;
|
||||||
|
|
||||||
|
@ -1272,14 +1273,16 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_i
|
||||||
printk(KERN_ERR "BMAC: can't use, need 3 addrs and 3 intrs\n");
|
printk(KERN_ERR "BMAC: can't use, need 3 addrs and 3 intrs\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
addr = get_property(macio_get_of_node(mdev), "mac-address", NULL);
|
prop_addr = get_property(macio_get_of_node(mdev), "mac-address", NULL);
|
||||||
if (addr == NULL) {
|
if (prop_addr == NULL) {
|
||||||
addr = get_property(macio_get_of_node(mdev), "local-mac-address", NULL);
|
prop_addr = get_property(macio_get_of_node(mdev),
|
||||||
if (addr == NULL) {
|
"local-mac-address", NULL);
|
||||||
|
if (prop_addr == NULL) {
|
||||||
printk(KERN_ERR "BMAC: Can't get mac-address\n");
|
printk(KERN_ERR "BMAC: Can't get mac-address\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
memcpy(addr, prop_addr, sizeof(addr));
|
||||||
|
|
||||||
dev = alloc_etherdev(PRIV_BYTES);
|
dev = alloc_etherdev(PRIV_BYTES);
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
|
|
|
@ -113,7 +113,7 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i
|
||||||
struct device_node *mace = macio_get_of_node(mdev);
|
struct device_node *mace = macio_get_of_node(mdev);
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
struct mace_data *mp;
|
struct mace_data *mp;
|
||||||
unsigned char *addr;
|
const unsigned char *addr;
|
||||||
int j, rev, rc = -EBUSY;
|
int j, rev, rc = -EBUSY;
|
||||||
|
|
||||||
if (macio_resource_count(mdev) != 3 || macio_irq_count(mdev) != 3) {
|
if (macio_resource_count(mdev) != 3 || macio_irq_count(mdev) != 3) {
|
||||||
|
|
|
@ -1812,10 +1812,10 @@ spider_net_setup_phy(struct spider_net_card *card)
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
spider_net_download_firmware(struct spider_net_card *card,
|
spider_net_download_firmware(struct spider_net_card *card,
|
||||||
u8 *firmware_ptr)
|
const void *firmware_ptr)
|
||||||
{
|
{
|
||||||
int sequencer, i;
|
int sequencer, i;
|
||||||
u32 *fw_ptr = (u32 *)firmware_ptr;
|
const u32 *fw_ptr = firmware_ptr;
|
||||||
|
|
||||||
/* stop sequencers */
|
/* stop sequencers */
|
||||||
spider_net_write_reg(card, SPIDER_NET_GSINIT,
|
spider_net_write_reg(card, SPIDER_NET_GSINIT,
|
||||||
|
@ -1872,7 +1872,7 @@ spider_net_init_firmware(struct spider_net_card *card)
|
||||||
{
|
{
|
||||||
struct firmware *firmware = NULL;
|
struct firmware *firmware = NULL;
|
||||||
struct device_node *dn;
|
struct device_node *dn;
|
||||||
u8 *fw_prop = NULL;
|
const u8 *fw_prop = NULL;
|
||||||
int err = -ENOENT;
|
int err = -ENOENT;
|
||||||
int fw_size;
|
int fw_size;
|
||||||
|
|
||||||
|
@ -1898,7 +1898,7 @@ spider_net_init_firmware(struct spider_net_card *card)
|
||||||
if (!dn)
|
if (!dn)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
fw_prop = (u8 *)get_property(dn, "firmware", &fw_size);
|
fw_prop = get_property(dn, "firmware", &fw_size);
|
||||||
if (!fw_prop)
|
if (!fw_prop)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
|
@ -2058,7 +2058,7 @@ spider_net_setup_netdev(struct spider_net_card *card)
|
||||||
struct net_device *netdev = card->netdev;
|
struct net_device *netdev = card->netdev;
|
||||||
struct device_node *dn;
|
struct device_node *dn;
|
||||||
struct sockaddr addr;
|
struct sockaddr addr;
|
||||||
u8 *mac;
|
const u8 *mac;
|
||||||
|
|
||||||
SET_MODULE_OWNER(netdev);
|
SET_MODULE_OWNER(netdev);
|
||||||
SET_NETDEV_DEV(netdev, &card->pdev->dev);
|
SET_NETDEV_DEV(netdev, &card->pdev->dev);
|
||||||
|
@ -2089,7 +2089,7 @@ spider_net_setup_netdev(struct spider_net_card *card)
|
||||||
if (!dn)
|
if (!dn)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
mac = (u8 *)get_property(dn, "local-mac-address", NULL);
|
mac = get_property(dn, "local-mac-address", NULL);
|
||||||
if (!mac)
|
if (!mac)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
memcpy(addr.sa_data, mac, ETH_ALEN);
|
memcpy(addr.sa_data, mac, ETH_ALEN);
|
||||||
|
|
|
@ -2896,7 +2896,7 @@ static int __devinit gem_get_device_address(struct gem *gp)
|
||||||
if (use_idprom)
|
if (use_idprom)
|
||||||
memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
|
memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
|
||||||
#elif defined(CONFIG_PPC_PMAC)
|
#elif defined(CONFIG_PPC_PMAC)
|
||||||
unsigned char *addr;
|
const unsigned char *addr;
|
||||||
|
|
||||||
addr = get_property(gp->of_node, "local-mac-address", NULL);
|
addr = get_property(gp->of_node, "local-mac-address", NULL);
|
||||||
if (addr == NULL) {
|
if (addr == NULL) {
|
||||||
|
|
Loading…
Reference in New Issue