Commit 45f9cb6b authored by Jinjie Ruan's avatar Jinjie Ruan Committed by David S. Miller

dp83640: Use list_for_each_entry() helper

Convert list_for_each() to list_for_each_entry() where applicable.

No functional changed.
Signed-off-by: default avatarJinjie Ruan <ruanjinjie@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5c42b66d
...@@ -631,7 +631,6 @@ static void recalibrate(struct dp83640_clock *clock) ...@@ -631,7 +631,6 @@ static void recalibrate(struct dp83640_clock *clock)
s64 now, diff; s64 now, diff;
struct phy_txts event_ts; struct phy_txts event_ts;
struct timespec64 ts; struct timespec64 ts;
struct list_head *this;
struct dp83640_private *tmp; struct dp83640_private *tmp;
struct phy_device *master = clock->chosen->phydev; struct phy_device *master = clock->chosen->phydev;
u16 cal_gpio, cfg0, evnt, ptp_trig, trigger, val; u16 cal_gpio, cfg0, evnt, ptp_trig, trigger, val;
...@@ -648,8 +647,7 @@ static void recalibrate(struct dp83640_clock *clock) ...@@ -648,8 +647,7 @@ static void recalibrate(struct dp83640_clock *clock)
/* /*
* enable broadcast, disable status frames, enable ptp clock * enable broadcast, disable status frames, enable ptp clock
*/ */
list_for_each(this, &clock->phylist) { list_for_each_entry(tmp, &clock->phylist, list) {
tmp = list_entry(this, struct dp83640_private, list);
enable_broadcast(tmp->phydev, clock->page, 1); enable_broadcast(tmp->phydev, clock->page, 1);
tmp->cfg0 = ext_read(tmp->phydev, PAGE5, PSF_CFG0); tmp->cfg0 = ext_read(tmp->phydev, PAGE5, PSF_CFG0);
ext_write(0, tmp->phydev, PAGE5, PSF_CFG0, 0); ext_write(0, tmp->phydev, PAGE5, PSF_CFG0, 0);
...@@ -667,10 +665,8 @@ static void recalibrate(struct dp83640_clock *clock) ...@@ -667,10 +665,8 @@ static void recalibrate(struct dp83640_clock *clock)
evnt |= (CAL_EVENT & EVNT_SEL_MASK) << EVNT_SEL_SHIFT; evnt |= (CAL_EVENT & EVNT_SEL_MASK) << EVNT_SEL_SHIFT;
evnt |= (cal_gpio & EVNT_GPIO_MASK) << EVNT_GPIO_SHIFT; evnt |= (cal_gpio & EVNT_GPIO_MASK) << EVNT_GPIO_SHIFT;
list_for_each(this, &clock->phylist) { list_for_each_entry(tmp, &clock->phylist, list)
tmp = list_entry(this, struct dp83640_private, list);
ext_write(0, tmp->phydev, PAGE5, PTP_EVNT, evnt); ext_write(0, tmp->phydev, PAGE5, PTP_EVNT, evnt);
}
ext_write(0, master, PAGE5, PTP_EVNT, evnt); ext_write(0, master, PAGE5, PTP_EVNT, evnt);
/* /*
...@@ -709,8 +705,7 @@ static void recalibrate(struct dp83640_clock *clock) ...@@ -709,8 +705,7 @@ static void recalibrate(struct dp83640_clock *clock)
event_ts.sec_hi = ext_read(master, PAGE4, PTP_EDATA); event_ts.sec_hi = ext_read(master, PAGE4, PTP_EDATA);
now = phy2txts(&event_ts); now = phy2txts(&event_ts);
list_for_each(this, &clock->phylist) { list_for_each_entry(tmp, &clock->phylist, list) {
tmp = list_entry(this, struct dp83640_private, list);
val = ext_read(tmp->phydev, PAGE4, PTP_STS); val = ext_read(tmp->phydev, PAGE4, PTP_STS);
phydev_info(tmp->phydev, "slave PTP_STS 0x%04hx\n", val); phydev_info(tmp->phydev, "slave PTP_STS 0x%04hx\n", val);
val = ext_read(tmp->phydev, PAGE4, PTP_ESTS); val = ext_read(tmp->phydev, PAGE4, PTP_ESTS);
...@@ -730,10 +725,8 @@ static void recalibrate(struct dp83640_clock *clock) ...@@ -730,10 +725,8 @@ static void recalibrate(struct dp83640_clock *clock)
/* /*
* restore status frames * restore status frames
*/ */
list_for_each(this, &clock->phylist) { list_for_each_entry(tmp, &clock->phylist, list)
tmp = list_entry(this, struct dp83640_private, list);
ext_write(0, tmp->phydev, PAGE5, PSF_CFG0, tmp->cfg0); ext_write(0, tmp->phydev, PAGE5, PSF_CFG0, tmp->cfg0);
}
ext_write(0, master, PAGE5, PSF_CFG0, cfg0); ext_write(0, master, PAGE5, PSF_CFG0, cfg0);
mutex_unlock(&clock->extreg_lock); mutex_unlock(&clock->extreg_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment