public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@grandegger•com>
To: Sriramakrishnan <srk@ti•com>
Cc: socketcan-core@lists•berlios.de, netdev@vger•kernel.org,
	K R Baalaaji <krbaalaaji@ti•com>
Subject: Re: [PATCH 1/2] can:ti_hecc: Add pm hook-up
Date: Mon, 22 Feb 2010 15:01:32 +0100	[thread overview]
Message-ID: <4B828E3C.40203@grandegger.com> (raw)
In-Reply-To: <1266845736-7161-1-git-send-email-srk@ti.com>

Sriramakrishnan wrote:
> Added the suspend and resume implementation in the HECC (CAN)
> driver.
> 
> Signed-off-by: K R Baalaaji <krbaalaaji@ti•com>
> Signed-off-by: Sriramakrishnan <srk@ti•com>
> Acked-by: Anant Gole <anantgole@ti•com>
> ---
>  drivers/net/can/ti_hecc.c |   51 ++++++++++++++++++++++++++++++++++++++++++--
>  1 files changed, 48 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c
> index 5c993c2..df27d82 100644
> --- a/drivers/net/can/ti_hecc.c
> +++ b/drivers/net/can/ti_hecc.c
> @@ -824,7 +824,6 @@ static int ti_hecc_open(struct net_device *ndev)
>  		return err;
>  	}
>  
> -	clk_enable(priv->clk);
>  	ti_hecc_start(ndev);
>  	napi_enable(&priv->napi);
>  	netif_start_queue(ndev);
> @@ -840,7 +839,6 @@ static int ti_hecc_close(struct net_device *ndev)
>  	napi_disable(&priv->napi);
>  	ti_hecc_stop(ndev);
>  	free_irq(ndev->irq, ndev);
> -	clk_disable(priv->clk);
>  	close_candev(ndev);
>  
>  	return 0;
> @@ -925,6 +923,7 @@ static int ti_hecc_probe(struct platform_device *pdev)
>  	netif_napi_add(ndev, &priv->napi, ti_hecc_rx_poll,
>  		HECC_DEF_NAPI_WEIGHT);
>  
> +	clk_enable(priv->clk);
>  	err = register_candev(ndev);
>  	if (err) {
>  		dev_err(&pdev->dev, "register_candev() failed\n");
> @@ -953,6 +952,7 @@ static int __devexit ti_hecc_remove(struct platform_device *pdev)
>  	struct net_device *ndev = platform_get_drvdata(pdev);
>  	struct ti_hecc_priv *priv = netdev_priv(ndev);
>  
> +	clk_disable(priv->clk);
>  	clk_put(priv->clk);
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	iounmap(priv->base);
> @@ -964,6 +964,48 @@ static int __devexit ti_hecc_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +
> +#ifdef CONFIG_PM
> +static int ti_hecc_suspend(struct platform_device *pdev, pm_message_t state)
> +{
> +	struct net_device *dev = platform_get_drvdata(pdev);
> +	struct ti_hecc_priv *priv = netdev_priv(dev);
> +
> +	if (netif_running(dev)) {
> +		netif_stop_queue(dev);
> +		netif_device_detach(dev);
> +	}
> +
> +	hecc_set_bit(priv, HECC_CANMC, HECC_CANMC_PDR);
> +	priv->can.state = CAN_STATE_SLEEPING;
> +
> +	clk_disable(priv->clk);
> +
> +	return 0;
> +}
> +
> +static int ti_hecc_resume(struct platform_device *pdev)
> +{
> +	struct net_device *dev = platform_get_drvdata(pdev);
> +	struct ti_hecc_priv *priv = netdev_priv(dev);
> +
> +	clk_enable(priv->clk);
> +
> +	hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_PDR);
> +	priv->can.state = CAN_STATE_ERROR_ACTIVE;
> +
> +	if (netif_running(dev)) {
> +		netif_device_attach(dev);
> +		netif_start_queue(dev);
> +	}
> +
> +	return 0;
> +}
> +#else
> +#define ti_hecc_suspend NULL
> +#define ti_hecc_resume NULL
> +#endif
> +
>  /* TI HECC netdevice driver: platform driver structure */
>  static struct platform_driver ti_hecc_driver = {
>  	.driver = {
> @@ -972,6 +1014,8 @@ static struct platform_driver ti_hecc_driver = {
>  	},
>  	.probe = ti_hecc_probe,
>  	.remove = __devexit_p(ti_hecc_remove),
> +	.suspend = ti_hecc_suspend,
> +	.resume = ti_hecc_resume,
>  };
>  
>  static int __init ti_hecc_init_driver(void)
> @@ -979,14 +1023,15 @@ static int __init ti_hecc_init_driver(void)
>  	printk(KERN_INFO DRV_DESC "\n");
>  	return platform_driver_register(&ti_hecc_driver);
>  }
> -module_init(ti_hecc_init_driver);
>  
>  static void __exit ti_hecc_exit_driver(void)
>  {
>  	printk(KERN_INFO DRV_DESC " unloaded\n");
>  	platform_driver_unregister(&ti_hecc_driver);
>  }
> +
>  module_exit(ti_hecc_exit_driver);
> +module_init(ti_hecc_init_driver);

What is the reason for moving around module_init? Please revert. Then
you can add my "Acked-by: Wolfgang Grandegger <wg@grandegger•com>".

Thanks,

Wolfgang.

  reply	other threads:[~2010-02-22 14:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-22 13:35 [PATCH 1/2] can:ti_hecc: Add pm hook-up Sriramakrishnan
2010-02-22 14:01 ` Wolfgang Grandegger [this message]
2010-02-22 14:11   ` Daniel Baluta
2010-02-22 14:40     ` Wolfgang Grandegger
     [not found]   ` <4B828E3C.40203-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2010-02-22 23:33     ` David Miller
     [not found] ` <1266845736-7161-1-git-send-email-srk-l0cyMroinI0@public.gmane.org>
2010-02-22 23:47   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B828E3C.40203@grandegger.com \
    --to=wg@grandegger$(echo .)com \
    --cc=krbaalaaji@ti$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=socketcan-core@lists$(echo .)berlios.de \
    --cc=srk@ti$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox