Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 369253
b: refs/heads/master
c: 264f0ef
h: refs/heads/master
i:
  369251: 9389a2d
v: v3
  • Loading branch information
David S. Miller committed Apr 16, 2013
1 parent 13b751b commit 8c46f94
Show file tree
Hide file tree
Showing 16 changed files with 170 additions and 181 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 06e1d1d71876c75bf4a9d3b310c1b4df34e8be69
refs/heads/master: 264f0ef766d6e9fcc1b4c3afd288a20ee05ef541
8 changes: 2 additions & 6 deletions trunk/drivers/net/can/mcp251x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1194,14 +1194,10 @@ static int mcp251x_can_resume(struct device *dev)
enable_irq(spi->irq);
return 0;
}
#endif

static SIMPLE_DEV_PM_OPS(mcp251x_can_pm_ops, mcp251x_can_suspend,
mcp251x_can_resume);
#define MCP251X_PM_OPS (&mcp251x_can_pm_ops)

#else
#define MCP251X_PM_OPS NULL
#endif

static const struct spi_device_id mcp251x_id_table[] = {
{ "mcp2510", CAN_MCP251X_MCP2510 },
Expand All @@ -1215,7 +1211,7 @@ static struct spi_driver mcp251x_can_driver = {
.driver = {
.name = DEVICE_NAME,
.owner = THIS_MODULE,
.pm = MCP251X_PM_OPS,
.pm = &mcp251x_can_pm_ops,
},

.id_table = mcp251x_id_table,
Expand Down
11 changes: 2 additions & 9 deletions trunk/drivers/net/ethernet/atheros/atlx/atl1.c
Original file line number Diff line number Diff line change
Expand Up @@ -2876,16 +2876,9 @@ static int atl1_resume(struct device *dev)

return 0;
}
#endif

static SIMPLE_DEV_PM_OPS(atl1_pm_ops, atl1_suspend, atl1_resume);
#define ATL1_PM_OPS (&atl1_pm_ops)

#else

static int atl1_suspend(struct device *dev) { return 0; }

#define ATL1_PM_OPS NULL
#endif

static void atl1_shutdown(struct pci_dev *pdev)
{
Expand Down Expand Up @@ -3147,7 +3140,7 @@ static struct pci_driver atl1_driver = {
.probe = atl1_probe,
.remove = atl1_remove,
.shutdown = atl1_shutdown,
.driver.pm = ATL1_PM_OPS,
.driver.pm = &atl1_pm_ops,
};

/**
Expand Down
10 changes: 2 additions & 8 deletions trunk/drivers/net/ethernet/broadcom/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -17533,15 +17533,9 @@ static int tg3_resume(struct device *device)

return err;
}
#endif /* CONFIG_PM_SLEEP */

static SIMPLE_DEV_PM_OPS(tg3_pm_ops, tg3_suspend, tg3_resume);
#define TG3_PM_OPS (&tg3_pm_ops)

#else

#define TG3_PM_OPS NULL

#endif /* CONFIG_PM_SLEEP */

/**
* tg3_io_error_detected - called when PCI error is detected
Expand Down Expand Up @@ -17689,7 +17683,7 @@ static struct pci_driver tg3_driver = {
.probe = tg3_init_one,
.remove = tg3_remove_one,
.err_handler = &tg3_err_handler,
.driver.pm = TG3_PM_OPS,
.driver.pm = &tg3_pm_ops,
};

static int __init tg3_init(void)
Expand Down
7 changes: 2 additions & 5 deletions trunk/drivers/net/ethernet/calxeda/xgmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1886,12 +1886,9 @@ static int xgmac_resume(struct device *dev)

return 0;
}
#endif /* CONFIG_PM_SLEEP */

static SIMPLE_DEV_PM_OPS(xgmac_pm_ops, xgmac_suspend, xgmac_resume);
#define XGMAC_PM_OPS (&xgmac_pm_ops)
#else
#define XGMAC_PM_OPS NULL
#endif /* CONFIG_PM_SLEEP */

static const struct of_device_id xgmac_of_match[] = {
{ .compatible = "calxeda,hb-xgmac", },
Expand All @@ -1906,7 +1903,7 @@ static struct platform_driver xgmac_driver = {
},
.probe = xgmac_probe,
.remove = xgmac_remove,
.driver.pm = XGMAC_PM_OPS,
.driver.pm = &xgmac_pm_ops,
};

module_platform_driver(xgmac_driver);
Expand Down
15 changes: 3 additions & 12 deletions trunk/drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1909,7 +1909,7 @@ fec_drv_remove(struct platform_device *pdev)
return 0;
}

#ifdef CONFIG_PM
#ifdef CONFIG_PM_SLEEP
static int
fec_suspend(struct device *dev)
{
Expand Down Expand Up @@ -1941,24 +1941,15 @@ fec_resume(struct device *dev)

return 0;
}
#endif /* CONFIG_PM_SLEEP */

static const struct dev_pm_ops fec_pm_ops = {
.suspend = fec_suspend,
.resume = fec_resume,
.freeze = fec_suspend,
.thaw = fec_resume,
.poweroff = fec_suspend,
.restore = fec_resume,
};
#endif
static SIMPLE_DEV_PM_OPS(fec_pm_ops, fec_suspend, fec_resume);

static struct platform_driver fec_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
#ifdef CONFIG_PM
.pm = &fec_pm_ops,
#endif
.of_match_table = fec_dt_ids,
},
.id_table = fec_devtype,
Expand Down
8 changes: 2 additions & 6 deletions trunk/drivers/net/ethernet/micrel/ks8851.c
Original file line number Diff line number Diff line change
Expand Up @@ -1391,13 +1391,9 @@ static int ks8851_resume(struct device *dev)

return 0;
}
#endif

static SIMPLE_DEV_PM_OPS(ks8851_pm_ops, ks8851_suspend, ks8851_resume);
#define KS8851_PM_OPS (&ks8851_pm_ops)

#else
#define KS8851_PM_OPS NULL
#endif

static int ks8851_probe(struct spi_device *spi)
{
Expand Down Expand Up @@ -1536,7 +1532,7 @@ static struct spi_driver ks8851_driver = {
.driver = {
.name = "ks8851",
.owner = THIS_MODULE,
.pm = KS8851_PM_OPS,
.pm = &ks8851_pm_ops,
},
.probe = ks8851_probe,
.remove = ks8851_remove,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2263,7 +2263,7 @@ static int pch_gbe_change_mtu(struct net_device *netdev, int new_mtu)
if (err) {
adapter->rx_buffer_len = old_rx_buffer_len;
pch_gbe_up(adapter);
return -ENOMEM;
return err;
} else {
netdev->mtu = new_mtu;
adapter->hw.mac.max_frame_size = max_frame;
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/ethernet/ti/tlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ static void tlan_remove_one(struct pci_dev *pdev)
free_netdev(dev);

pci_set_drvdata(pdev, NULL);
cancel_work_sync(&priv->tlan_tqueue);
}

static void tlan_start(struct net_device *dev)
Expand Down
98 changes: 68 additions & 30 deletions trunk/drivers/net/ieee802154/at86rf230.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct at86rf230_local {
struct ieee802154_dev *dev;

spinlock_t lock;
bool irq_disabled;
bool irq_busy;
bool is_tx;
};

Expand Down Expand Up @@ -219,6 +219,9 @@ struct at86rf230_local {
#define IRQ_PLL_UNL (1 << 1)
#define IRQ_PLL_LOCK (1 << 0)

#define IRQ_ACTIVE_HIGH 0
#define IRQ_ACTIVE_LOW 1

#define STATE_P_ON 0x00 /* BUSY */
#define STATE_BUSY_RX 0x01
#define STATE_BUSY_TX 0x02
Expand Down Expand Up @@ -544,7 +547,7 @@ at86rf230_xmit(struct ieee802154_dev *dev, struct sk_buff *skb)
unsigned long flags;

spin_lock(&lp->lock);
if (lp->irq_disabled) {
if (lp->irq_busy) {
spin_unlock(&lp->lock);
return -EBUSY;
}
Expand Down Expand Up @@ -705,8 +708,16 @@ static void at86rf230_irqwork(struct work_struct *work)
}

spin_lock_irqsave(&lp->lock, flags);
lp->irq_disabled = 0;
lp->irq_busy = 0;
spin_unlock_irqrestore(&lp->lock, flags);
}

static void at86rf230_irqwork_level(struct work_struct *work)
{
struct at86rf230_local *lp =
container_of(work, struct at86rf230_local, irqwork);

at86rf230_irqwork(work);

enable_irq(lp->spi->irq);
}
Expand All @@ -715,22 +726,32 @@ static irqreturn_t at86rf230_isr(int irq, void *data)
{
struct at86rf230_local *lp = data;

disable_irq_nosync(irq);

spin_lock(&lp->lock);
lp->irq_disabled = 1;
lp->irq_busy = 1;
spin_unlock(&lp->lock);

schedule_work(&lp->irqwork);

return IRQ_HANDLED;
}

static irqreturn_t at86rf230_isr_level(int irq, void *data)
{
disable_irq_nosync(irq);

return at86rf230_isr(irq, data);
}

static int at86rf230_irq_polarity(struct at86rf230_local *lp, int pol)
{
return at86rf230_write_subreg(lp, SR_IRQ_POLARITY, pol);
}

static int at86rf230_hw_init(struct at86rf230_local *lp)
{
struct at86rf230_platform_data *pdata = lp->spi->dev.platform_data;
int rc, irq_pol;
u8 status;
int rc;

rc = at86rf230_read_subreg(lp, SR_TRX_STATUS, &status);
if (rc)
Expand All @@ -748,12 +769,17 @@ static int at86rf230_hw_init(struct at86rf230_local *lp)
dev_info(&lp->spi->dev, "Status: %02x\n", status);
}

rc = at86rf230_write_subreg(lp, SR_IRQ_MASK, 0xff); /* IRQ_TRX_UR |
* IRQ_CCA_ED |
* IRQ_TRX_END |
* IRQ_PLL_UNL |
* IRQ_PLL_LOCK
*/
/* configure irq polarity, defaults to high active */
if (pdata->irq_type & (IRQF_TRIGGER_FALLING | IRQF_TRIGGER_LOW))
irq_pol = IRQ_ACTIVE_LOW;
else
irq_pol = IRQ_ACTIVE_HIGH;

rc = at86rf230_irq_polarity(lp, irq_pol);
if (rc)
return rc;

rc = at86rf230_write_subreg(lp, SR_IRQ_MASK, IRQ_TRX_END);
if (rc)
return rc;

Expand Down Expand Up @@ -798,37 +824,38 @@ static int at86rf230_hw_init(struct at86rf230_local *lp)
return 0;
}

static int at86rf230_fill_data(struct spi_device *spi)
static void at86rf230_fill_data(struct spi_device *spi)
{
struct at86rf230_local *lp = spi_get_drvdata(spi);
struct at86rf230_platform_data *pdata = spi->dev.platform_data;

if (!pdata) {
dev_err(&spi->dev, "no platform_data\n");
return -EINVAL;
}

lp->rstn = pdata->rstn;
lp->slp_tr = pdata->slp_tr;
lp->dig2 = pdata->dig2;

return 0;
}

static int at86rf230_probe(struct spi_device *spi)
{
struct at86rf230_platform_data *pdata;
struct ieee802154_dev *dev;
struct at86rf230_local *lp;
u8 man_id_0, man_id_1;
int rc;
u8 man_id_0, man_id_1, status;
irq_handler_t irq_handler;
work_func_t irq_worker;
int rc, supported = 0;
const char *chip;
int supported = 0;

if (!spi->irq) {
dev_err(&spi->dev, "no IRQ specified\n");
return -EINVAL;
}

pdata = spi->dev.platform_data;
if (!pdata) {
dev_err(&spi->dev, "no platform_data\n");
return -EINVAL;
}

dev = ieee802154_alloc_device(sizeof(*lp), &at86rf230_ops);
if (!dev)
return -ENOMEM;
Expand All @@ -844,16 +871,22 @@ static int at86rf230_probe(struct spi_device *spi)
dev->phy->channels_supported[0] = 0x7FFF800;
dev->flags = IEEE802154_HW_OMIT_CKSUM;

if (pdata->irq_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) {
irq_worker = at86rf230_irqwork;
irq_handler = at86rf230_isr;
} else {
irq_worker = at86rf230_irqwork_level;
irq_handler = at86rf230_isr_level;
}

mutex_init(&lp->bmux);
INIT_WORK(&lp->irqwork, at86rf230_irqwork);
INIT_WORK(&lp->irqwork, irq_worker);
spin_lock_init(&lp->lock);
init_completion(&lp->tx_complete);

spi_set_drvdata(spi, lp);

rc = at86rf230_fill_data(spi);
if (rc)
goto err_fill;
at86rf230_fill_data(spi);

rc = gpio_request(lp->rstn, "rstn");
if (rc)
Expand Down Expand Up @@ -928,11 +961,17 @@ static int at86rf230_probe(struct spi_device *spi)
if (rc)
goto err_gpio_dir;

rc = request_irq(spi->irq, at86rf230_isr, IRQF_SHARED,
rc = request_irq(spi->irq, irq_handler,
IRQF_SHARED | pdata->irq_type,
dev_name(&spi->dev), lp);
if (rc)
goto err_gpio_dir;

/* Read irq status register to reset irq line */
rc = at86rf230_read_subreg(lp, RG_IRQ_STATUS, 0xff, 0, &status);
if (rc)
goto err_irq;

rc = ieee802154_register_device(lp->dev);
if (rc)
goto err_irq;
Expand All @@ -948,7 +987,6 @@ static int at86rf230_probe(struct spi_device *spi)
err_slp_tr:
gpio_free(lp->rstn);
err_rstn:
err_fill:
spi_set_drvdata(spi, NULL);
mutex_destroy(&lp->bmux);
ieee802154_free_device(lp->dev);
Expand Down
Loading

0 comments on commit 8c46f94

Please sign in to comment.