| .. | .. |
|---|
| 23 | 23 | #include <linux/slab.h> |
|---|
| 24 | 24 | #include <linux/of.h> |
|---|
| 25 | 25 | #include <linux/gpio.h> |
|---|
| 26 | | -#include <linux/seqlock.h> |
|---|
| 27 | 26 | #include <linux/idr.h> |
|---|
| 28 | 27 | |
|---|
| 29 | 28 | #include "swphy.h" |
|---|
| .. | .. |
|---|
| 36 | 35 | struct fixed_phy { |
|---|
| 37 | 36 | int addr; |
|---|
| 38 | 37 | struct phy_device *phydev; |
|---|
| 39 | | - seqcount_t seqcount; |
|---|
| 40 | 38 | struct fixed_phy_status status; |
|---|
| 41 | 39 | int (*link_update)(struct net_device *, struct fixed_phy_status *); |
|---|
| 42 | 40 | struct list_head node; |
|---|
| .. | .. |
|---|
| 62 | 60 | list_for_each_entry(fp, &fmb->phys, node) { |
|---|
| 63 | 61 | if (fp->addr == phy_addr) { |
|---|
| 64 | 62 | struct fixed_phy_status state; |
|---|
| 65 | | - int s; |
|---|
| 66 | 63 | |
|---|
| 67 | | - do { |
|---|
| 68 | | - s = read_seqcount_begin(&fp->seqcount); |
|---|
| 69 | | - /* Issue callback if user registered it. */ |
|---|
| 70 | | - if (fp->link_update) |
|---|
| 71 | | - fp->link_update(fp->phydev->attached_dev, |
|---|
| 72 | | - &fp->status); |
|---|
| 73 | | - /* Check the GPIO for change in status */ |
|---|
| 74 | | - fixed_phy_update(fp); |
|---|
| 75 | | - state = fp->status; |
|---|
| 76 | | - } while (read_seqcount_retry(&fp->seqcount, s)); |
|---|
| 64 | + /* Issue callback if user registered it. */ |
|---|
| 65 | + if (fp->link_update) |
|---|
| 66 | + fp->link_update(fp->phydev->attached_dev, |
|---|
| 67 | + &fp->status); |
|---|
| 68 | + |
|---|
| 69 | + /* Check the GPIO for change in status */ |
|---|
| 70 | + fixed_phy_update(fp); |
|---|
| 71 | + state = fp->status; |
|---|
| 77 | 72 | |
|---|
| 78 | 73 | return swphy_read_reg(reg_num, &state); |
|---|
| 79 | 74 | } |
|---|
| .. | .. |
|---|
| 130 | 125 | fp = kzalloc(sizeof(*fp), GFP_KERNEL); |
|---|
| 131 | 126 | if (!fp) |
|---|
| 132 | 127 | return -ENOMEM; |
|---|
| 133 | | - |
|---|
| 134 | | - seqcount_init(&fp->seqcount); |
|---|
| 135 | 128 | |
|---|
| 136 | 129 | if (irq != PHY_POLL) |
|---|
| 137 | 130 | fmb->mii_bus->irq[phy_addr] = irq; |
|---|