of: Always use 'struct device.of_node' to get device node pointer.
The following structure elements duplicate the information in 'struct device.of_node' and so are being eliminated. This patch makes all readers of these elements use device.of_node instead. (struct of_device *)->node (struct dev_archdata *)->prom_node (sparc) (struct dev_archdata *)->of_node (powerpc & microblaze) Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
This commit is contained in:
@@ -136,7 +136,8 @@ static inline void emac_report_timeout_error(struct emac_instance *dev,
|
||||
EMAC_FTR_440EP_PHY_CLK_FIX))
|
||||
DBG(dev, "%s" NL, error);
|
||||
else if (net_ratelimit())
|
||||
printk(KERN_ERR "%s: %s\n", dev->ofdev->node->full_name, error);
|
||||
printk(KERN_ERR "%s: %s\n", dev->ofdev->dev.of_node->full_name,
|
||||
error);
|
||||
}
|
||||
|
||||
/* EMAC PHY clock workaround:
|
||||
@@ -2185,7 +2186,7 @@ static void emac_ethtool_get_drvinfo(struct net_device *ndev,
|
||||
strcpy(info->version, DRV_VERSION);
|
||||
info->fw_version[0] = '\0';
|
||||
sprintf(info->bus_info, "PPC 4xx EMAC-%d %s",
|
||||
dev->cell_index, dev->ofdev->node->full_name);
|
||||
dev->cell_index, dev->ofdev->dev.of_node->full_name);
|
||||
info->regdump_len = emac_ethtool_get_regs_len(ndev);
|
||||
}
|
||||
|
||||
@@ -2379,7 +2380,7 @@ static int __devinit emac_read_uint_prop(struct device_node *np, const char *nam
|
||||
|
||||
static int __devinit emac_init_phy(struct emac_instance *dev)
|
||||
{
|
||||
struct device_node *np = dev->ofdev->node;
|
||||
struct device_node *np = dev->ofdev->dev.of_node;
|
||||
struct net_device *ndev = dev->ndev;
|
||||
u32 phy_map, adv;
|
||||
int i;
|
||||
@@ -2514,7 +2515,7 @@ static int __devinit emac_init_phy(struct emac_instance *dev)
|
||||
|
||||
static int __devinit emac_init_config(struct emac_instance *dev)
|
||||
{
|
||||
struct device_node *np = dev->ofdev->node;
|
||||
struct device_node *np = dev->ofdev->dev.of_node;
|
||||
const void *p;
|
||||
unsigned int plen;
|
||||
const char *pm, *phy_modes[] = {
|
||||
@@ -2723,7 +2724,7 @@ static int __devinit emac_probe(struct of_device *ofdev,
|
||||
{
|
||||
struct net_device *ndev;
|
||||
struct emac_instance *dev;
|
||||
struct device_node *np = ofdev->node;
|
||||
struct device_node *np = ofdev->dev.of_node;
|
||||
struct device_node **blist = NULL;
|
||||
int err, i;
|
||||
|
||||
@@ -2810,7 +2811,7 @@ static int __devinit emac_probe(struct of_device *ofdev,
|
||||
err = mal_register_commac(dev->mal, &dev->commac);
|
||||
if (err) {
|
||||
printk(KERN_ERR "%s: failed to register with mal %s!\n",
|
||||
np->full_name, dev->mal_dev->node->full_name);
|
||||
np->full_name, dev->mal_dev->dev.of_node->full_name);
|
||||
goto err_rel_deps;
|
||||
}
|
||||
dev->rx_skb_size = emac_rx_skb_size(ndev->mtu);
|
||||
|
@@ -33,7 +33,7 @@ static void emac_desc_dump(struct emac_instance *p)
|
||||
int i;
|
||||
printk("** EMAC %s TX BDs **\n"
|
||||
" tx_cnt = %d tx_slot = %d ack_slot = %d\n",
|
||||
p->ofdev->node->full_name,
|
||||
p->ofdev->dev.of_node->full_name,
|
||||
p->tx_cnt, p->tx_slot, p->ack_slot);
|
||||
for (i = 0; i < NUM_TX_BUFF / 2; ++i)
|
||||
printk
|
||||
@@ -49,7 +49,7 @@ static void emac_desc_dump(struct emac_instance *p)
|
||||
printk("** EMAC %s RX BDs **\n"
|
||||
" rx_slot = %d flags = 0x%lx rx_skb_size = %d rx_sync_size = %d\n"
|
||||
" rx_sg_skb = 0x%p\n",
|
||||
p->ofdev->node->full_name,
|
||||
p->ofdev->dev.of_node->full_name,
|
||||
p->rx_slot, p->commac.flags, p->rx_skb_size,
|
||||
p->rx_sync_size, p->rx_sg_skb);
|
||||
for (i = 0; i < NUM_RX_BUFF / 2; ++i)
|
||||
@@ -77,7 +77,8 @@ static void emac_mac_dump(struct emac_instance *dev)
|
||||
"MR0 = 0x%08x MR1 = 0x%08x TMR0 = 0x%08x TMR1 = 0x%08x\n"
|
||||
"RMR = 0x%08x ISR = 0x%08x ISER = 0x%08x\n"
|
||||
"IAR = %04x%08x VTPID = 0x%04x VTCI = 0x%04x\n",
|
||||
dev->ofdev->node->full_name, in_be32(&p->mr0), in_be32(&p->mr1),
|
||||
dev->ofdev->dev.of_node->full_name,
|
||||
in_be32(&p->mr0), in_be32(&p->mr1),
|
||||
in_be32(&p->tmr0), in_be32(&p->tmr1),
|
||||
in_be32(&p->rmr), in_be32(&p->isr), in_be32(&p->iser),
|
||||
in_be32(&p->iahr), in_be32(&p->ialr), in_be32(&p->vtpid),
|
||||
@@ -128,7 +129,7 @@ static void emac_mal_dump(struct mal_instance *mal)
|
||||
"CFG = 0x%08x ESR = 0x%08x IER = 0x%08x\n"
|
||||
"TX|CASR = 0x%08x CARR = 0x%08x EOBISR = 0x%08x DEIR = 0x%08x\n"
|
||||
"RX|CASR = 0x%08x CARR = 0x%08x EOBISR = 0x%08x DEIR = 0x%08x\n",
|
||||
mal->ofdev->node->full_name,
|
||||
mal->ofdev->dev.of_node->full_name,
|
||||
get_mal_dcrn(mal, MAL_CFG), get_mal_dcrn(mal, MAL_ESR),
|
||||
get_mal_dcrn(mal, MAL_IER),
|
||||
get_mal_dcrn(mal, MAL_TXCASR), get_mal_dcrn(mal, MAL_TXCARR),
|
||||
|
@@ -53,8 +53,8 @@ extern void emac_dbg_dump_all(void);
|
||||
|
||||
#endif
|
||||
|
||||
#define EMAC_DBG(dev, name, fmt, arg...) \
|
||||
printk(KERN_DEBUG #name "%s: " fmt, dev->ofdev->node->full_name, ## arg)
|
||||
#define EMAC_DBG(d, name, fmt, arg...) \
|
||||
printk(KERN_DEBUG #name "%s: " fmt, d->ofdev->dev.of_node->full_name, ## arg)
|
||||
|
||||
#if DBG_LEVEL > 0
|
||||
# define DBG(d,f,x...) EMAC_DBG(d, emac, f, ##x)
|
||||
|
@@ -538,11 +538,11 @@ static int __devinit mal_probe(struct of_device *ofdev,
|
||||
}
|
||||
mal->index = index;
|
||||
mal->ofdev = ofdev;
|
||||
mal->version = of_device_is_compatible(ofdev->node, "ibm,mcmal2") ? 2 : 1;
|
||||
mal->version = of_device_is_compatible(ofdev->dev.of_node, "ibm,mcmal2") ? 2 : 1;
|
||||
|
||||
MAL_DBG(mal, "probe" NL);
|
||||
|
||||
prop = of_get_property(ofdev->node, "num-tx-chans", NULL);
|
||||
prop = of_get_property(ofdev->dev.of_node, "num-tx-chans", NULL);
|
||||
if (prop == NULL) {
|
||||
printk(KERN_ERR
|
||||
"mal%d: can't find MAL num-tx-chans property!\n",
|
||||
@@ -552,7 +552,7 @@ static int __devinit mal_probe(struct of_device *ofdev,
|
||||
}
|
||||
mal->num_tx_chans = prop[0];
|
||||
|
||||
prop = of_get_property(ofdev->node, "num-rx-chans", NULL);
|
||||
prop = of_get_property(ofdev->dev.of_node, "num-rx-chans", NULL);
|
||||
if (prop == NULL) {
|
||||
printk(KERN_ERR
|
||||
"mal%d: can't find MAL num-rx-chans property!\n",
|
||||
@@ -562,14 +562,14 @@ static int __devinit mal_probe(struct of_device *ofdev,
|
||||
}
|
||||
mal->num_rx_chans = prop[0];
|
||||
|
||||
dcr_base = dcr_resource_start(ofdev->node, 0);
|
||||
dcr_base = dcr_resource_start(ofdev->dev.of_node, 0);
|
||||
if (dcr_base == 0) {
|
||||
printk(KERN_ERR
|
||||
"mal%d: can't find DCR resource!\n", index);
|
||||
err = -ENODEV;
|
||||
goto fail;
|
||||
}
|
||||
mal->dcr_host = dcr_map(ofdev->node, dcr_base, 0x100);
|
||||
mal->dcr_host = dcr_map(ofdev->dev.of_node, dcr_base, 0x100);
|
||||
if (!DCR_MAP_OK(mal->dcr_host)) {
|
||||
printk(KERN_ERR
|
||||
"mal%d: failed to map DCRs !\n", index);
|
||||
@@ -577,28 +577,28 @@ static int __devinit mal_probe(struct of_device *ofdev,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (of_device_is_compatible(ofdev->node, "ibm,mcmal-405ez")) {
|
||||
if (of_device_is_compatible(ofdev->dev.of_node, "ibm,mcmal-405ez")) {
|
||||
#if defined(CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT) && \
|
||||
defined(CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR)
|
||||
mal->features |= (MAL_FTR_CLEAR_ICINTSTAT |
|
||||
MAL_FTR_COMMON_ERR_INT);
|
||||
#else
|
||||
printk(KERN_ERR "%s: Support for 405EZ not enabled!\n",
|
||||
ofdev->node->full_name);
|
||||
ofdev->dev.of_node->full_name);
|
||||
err = -ENODEV;
|
||||
goto fail;
|
||||
#endif
|
||||
}
|
||||
|
||||
mal->txeob_irq = irq_of_parse_and_map(ofdev->node, 0);
|
||||
mal->rxeob_irq = irq_of_parse_and_map(ofdev->node, 1);
|
||||
mal->serr_irq = irq_of_parse_and_map(ofdev->node, 2);
|
||||
mal->txeob_irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
|
||||
mal->rxeob_irq = irq_of_parse_and_map(ofdev->dev.of_node, 1);
|
||||
mal->serr_irq = irq_of_parse_and_map(ofdev->dev.of_node, 2);
|
||||
|
||||
if (mal_has_feature(mal, MAL_FTR_COMMON_ERR_INT)) {
|
||||
mal->txde_irq = mal->rxde_irq = mal->serr_irq;
|
||||
} else {
|
||||
mal->txde_irq = irq_of_parse_and_map(ofdev->node, 3);
|
||||
mal->rxde_irq = irq_of_parse_and_map(ofdev->node, 4);
|
||||
mal->txde_irq = irq_of_parse_and_map(ofdev->dev.of_node, 3);
|
||||
mal->rxde_irq = irq_of_parse_and_map(ofdev->dev.of_node, 4);
|
||||
}
|
||||
|
||||
if (mal->txeob_irq == NO_IRQ || mal->rxeob_irq == NO_IRQ ||
|
||||
@@ -629,7 +629,7 @@ static int __devinit mal_probe(struct of_device *ofdev,
|
||||
/* Current Axon is not happy with priority being non-0, it can
|
||||
* deadlock, fix it up here
|
||||
*/
|
||||
if (of_device_is_compatible(ofdev->node, "ibm,mcmal-axon"))
|
||||
if (of_device_is_compatible(ofdev->dev.of_node, "ibm,mcmal-axon"))
|
||||
cfg &= ~(MAL2_CFG_RPP_10 | MAL2_CFG_WPP_10);
|
||||
|
||||
/* Apply configuration */
|
||||
@@ -701,7 +701,7 @@ static int __devinit mal_probe(struct of_device *ofdev,
|
||||
|
||||
printk(KERN_INFO
|
||||
"MAL v%d %s, %d TX channels, %d RX channels\n",
|
||||
mal->version, ofdev->node->full_name,
|
||||
mal->version, ofdev->dev.of_node->full_name,
|
||||
mal->num_tx_chans, mal->num_rx_chans);
|
||||
|
||||
/* Advertise this instance to the rest of the world */
|
||||
|
@@ -103,7 +103,7 @@ int __devinit rgmii_attach(struct of_device *ofdev, int input, int mode)
|
||||
/* Check if we need to attach to a RGMII */
|
||||
if (input < 0 || !rgmii_valid_mode(mode)) {
|
||||
printk(KERN_ERR "%s: unsupported settings !\n",
|
||||
ofdev->node->full_name);
|
||||
ofdev->dev.of_node->full_name);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ int __devinit rgmii_attach(struct of_device *ofdev, int input, int mode)
|
||||
out_be32(&p->fer, in_be32(&p->fer) | rgmii_mode_mask(mode, input));
|
||||
|
||||
printk(KERN_NOTICE "%s: input %d in %s mode\n",
|
||||
ofdev->node->full_name, input, rgmii_mode_name(mode));
|
||||
ofdev->dev.of_node->full_name, input, rgmii_mode_name(mode));
|
||||
|
||||
++dev->users;
|
||||
|
||||
@@ -231,7 +231,7 @@ void *rgmii_dump_regs(struct of_device *ofdev, void *buf)
|
||||
static int __devinit rgmii_probe(struct of_device *ofdev,
|
||||
const struct of_device_id *match)
|
||||
{
|
||||
struct device_node *np = ofdev->node;
|
||||
struct device_node *np = ofdev->dev.of_node;
|
||||
struct rgmii_instance *dev;
|
||||
struct resource regs;
|
||||
int rc;
|
||||
@@ -264,11 +264,11 @@ static int __devinit rgmii_probe(struct of_device *ofdev,
|
||||
}
|
||||
|
||||
/* Check for RGMII flags */
|
||||
if (of_get_property(ofdev->node, "has-mdio", NULL))
|
||||
if (of_get_property(ofdev->dev.of_node, "has-mdio", NULL))
|
||||
dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO;
|
||||
|
||||
/* CAB lacks the right properties, fix this up */
|
||||
if (of_device_is_compatible(ofdev->node, "ibm,rgmii-axon"))
|
||||
if (of_device_is_compatible(ofdev->dev.of_node, "ibm,rgmii-axon"))
|
||||
dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO;
|
||||
|
||||
DBG2(dev, " Boot FER = 0x%08x, SSR = 0x%08x\n",
|
||||
@@ -279,7 +279,7 @@ static int __devinit rgmii_probe(struct of_device *ofdev,
|
||||
|
||||
printk(KERN_INFO
|
||||
"RGMII %s initialized with%s MDIO support\n",
|
||||
ofdev->node->full_name,
|
||||
ofdev->dev.of_node->full_name,
|
||||
(dev->flags & EMAC_RGMII_FLAG_HAS_MDIO) ? "" : "out");
|
||||
|
||||
wmb();
|
||||
|
@@ -57,7 +57,8 @@ void tah_reset(struct of_device *ofdev)
|
||||
--n;
|
||||
|
||||
if (unlikely(!n))
|
||||
printk(KERN_ERR "%s: reset timeout\n", ofdev->node->full_name);
|
||||
printk(KERN_ERR "%s: reset timeout\n",
|
||||
ofdev->dev.of_node->full_name);
|
||||
|
||||
/* 10KB TAH TX FIFO accomodates the max MTU of 9000 */
|
||||
out_be32(&p->mr,
|
||||
@@ -89,7 +90,7 @@ void *tah_dump_regs(struct of_device *ofdev, void *buf)
|
||||
static int __devinit tah_probe(struct of_device *ofdev,
|
||||
const struct of_device_id *match)
|
||||
{
|
||||
struct device_node *np = ofdev->node;
|
||||
struct device_node *np = ofdev->dev.of_node;
|
||||
struct tah_instance *dev;
|
||||
struct resource regs;
|
||||
int rc;
|
||||
@@ -127,7 +128,7 @@ static int __devinit tah_probe(struct of_device *ofdev,
|
||||
tah_reset(ofdev);
|
||||
|
||||
printk(KERN_INFO
|
||||
"TAH %s initialized\n", ofdev->node->full_name);
|
||||
"TAH %s initialized\n", ofdev->dev.of_node->full_name);
|
||||
wmb();
|
||||
|
||||
return 0;
|
||||
|
@@ -121,13 +121,14 @@ int __devinit zmii_attach(struct of_device *ofdev, int input, int *mode)
|
||||
dev->mode = *mode;
|
||||
|
||||
printk(KERN_NOTICE "%s: bridge in %s mode\n",
|
||||
ofdev->node->full_name, zmii_mode_name(dev->mode));
|
||||
ofdev->dev.of_node->full_name,
|
||||
zmii_mode_name(dev->mode));
|
||||
} else {
|
||||
/* All inputs must use the same mode */
|
||||
if (*mode != PHY_MODE_NA && *mode != dev->mode) {
|
||||
printk(KERN_ERR
|
||||
"%s: invalid mode %d specified for input %d\n",
|
||||
ofdev->node->full_name, *mode, input);
|
||||
ofdev->dev.of_node->full_name, *mode, input);
|
||||
mutex_unlock(&dev->lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -233,7 +234,7 @@ void *zmii_dump_regs(struct of_device *ofdev, void *buf)
|
||||
static int __devinit zmii_probe(struct of_device *ofdev,
|
||||
const struct of_device_id *match)
|
||||
{
|
||||
struct device_node *np = ofdev->node;
|
||||
struct device_node *np = ofdev->dev.of_node;
|
||||
struct zmii_instance *dev;
|
||||
struct resource regs;
|
||||
int rc;
|
||||
@@ -273,7 +274,7 @@ static int __devinit zmii_probe(struct of_device *ofdev,
|
||||
out_be32(&dev->base->fer, 0);
|
||||
|
||||
printk(KERN_INFO
|
||||
"ZMII %s initialized\n", ofdev->node->full_name);
|
||||
"ZMII %s initialized\n", ofdev->dev.of_node->full_name);
|
||||
wmb();
|
||||
dev_set_drvdata(&ofdev->dev, dev);
|
||||
|
||||
|
Reference in New Issue
Block a user