Skip to content

Commit

Permalink
can: m_can: Fix runtime resume call
Browse files Browse the repository at this point in the history
commit 1675bee upstream.

pm_runtime_get_sync() returns a 1 if the state of the device is already
'active'. This is not a failure case and should return a success.

Therefore fix error handling for pm_runtime_get_sync() call such that
it returns success when the value is 1.

Also cleanup the TODO for using runtime PM for sleep mode as that is
implemented.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Cc: <stable@vger.kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Faiz Abbas authored and Greg Kroah-Hartman committed Jul 28, 2018
1 parent 432a412 commit 467b5b4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/net/can/m_can/m_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -634,10 +634,12 @@ static int m_can_clk_start(struct m_can_priv *priv)
int err;

err = pm_runtime_get_sync(priv->device);
if (err)
if (err < 0) {
pm_runtime_put_noidle(priv->device);
return err;
}

return err;
return 0;
}

static void m_can_clk_stop(struct m_can_priv *priv)
Expand Down Expand Up @@ -1687,8 +1689,6 @@ static int m_can_plat_probe(struct platform_device *pdev)
return ret;
}

/* TODO: runtime PM with power down or sleep mode */

static __maybe_unused int m_can_suspend(struct device *dev)
{
struct net_device *ndev = dev_get_drvdata(dev);
Expand Down

0 comments on commit 467b5b4

Please sign in to comment.