Skip to content

Commit

Permalink
tg3: Remove residual error handling in tg3_suspend
Browse files Browse the repository at this point in the history
As of now, tg3_power_down_prepare always ends with success, but
the error handling code from former tg3_set_power_state call is still here.

This code became unreachable in commit c866b7e ("tg3: Do not use
legacy PCI power management").

Remove (now unreachable) error handling code for simplification and change
tg3_power_down_prepare to a void function as its result is no more checked.

Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru>
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240401191418.361747-1-kiryushin@ancud.ru
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Nikita Kiryushin authored and Paolo Abeni committed Apr 4, 2024
1 parent c0de6ab commit 9ab4ad2
Showing 1 changed file with 4 additions and 26 deletions.
30 changes: 4 additions & 26 deletions drivers/net/ethernet/broadcom/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -4019,7 +4019,7 @@ static int tg3_power_up(struct tg3 *tp)

static int tg3_setup_phy(struct tg3 *, bool);

static int tg3_power_down_prepare(struct tg3 *tp)
static void tg3_power_down_prepare(struct tg3 *tp)
{
u32 misc_host_ctrl;
bool device_should_wake, do_low_power;
Expand Down Expand Up @@ -4263,7 +4263,7 @@ static int tg3_power_down_prepare(struct tg3 *tp)

tg3_ape_driver_state_change(tp, RESET_KIND_SHUTDOWN);

return 0;
return;
}

static void tg3_power_down(struct tg3 *tp)
Expand Down Expand Up @@ -18084,7 +18084,6 @@ static int tg3_suspend(struct device *device)
{
struct net_device *dev = dev_get_drvdata(device);
struct tg3 *tp = netdev_priv(dev);
int err = 0;

rtnl_lock();

Expand All @@ -18108,32 +18107,11 @@ static int tg3_suspend(struct device *device)
tg3_flag_clear(tp, INIT_COMPLETE);
tg3_full_unlock(tp);

err = tg3_power_down_prepare(tp);
if (err) {
int err2;

tg3_full_lock(tp, 0);

tg3_flag_set(tp, INIT_COMPLETE);
err2 = tg3_restart_hw(tp, true);
if (err2)
goto out;

tg3_timer_start(tp);

netif_device_attach(dev);
tg3_netif_start(tp);

out:
tg3_full_unlock(tp);

if (!err2)
tg3_phy_start(tp);
}
tg3_power_down_prepare(tp);

unlock:
rtnl_unlock();
return err;
return 0;
}

static int tg3_resume(struct device *device)
Expand Down

0 comments on commit 9ab4ad2

Please sign in to comment.