public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: "Lothar Waßmann" <LW@KARO-electronics.de>
To: Appana Durga Kedareswara Rao <appana.durga.rao@xilinx.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
	"wg@grandegger.com" <wg@grandegger.com>,
	Michal Simek <michals@xilinx.com>,
	Soren Brinkmann <sorenb@xilinx.com>,
	"grant.likely@linaro.org" <grant.likely@linaro.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: [PATCH] can: Fix bug in suspend/resume
Date: Thu, 13 Nov 2014 12:32:18 +0100	[thread overview]
Message-ID: <20141113123218.79850236@ipc1.ka-ro> (raw)
In-Reply-To: <9455da2b86c74d5aafe9bf118edec7bb@BN1AFFO11FD045.protection.gbl>

Hi,

Appana Durga Kedareswara Rao wrote:
> Hi Marc,
> 
> -----Original Message-----
> From: Marc Kleine-Budde [mailto:mkl@pengutronix.de]
> Sent: Thursday, November 13, 2014 4:16 PM
> To: Appana Durga Kedareswara Rao; wg@grandegger.com; Michal Simek; Soren Brinkmann; grant.likely@linaro.org; robh+dt@kernel.org
> Cc: linux-can@vger.kernel.org; netdev@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; devicetree@vger.kernel.org; Appana Durga Kedareswara Rao
> Subject: Re: [PATCH] can: Fix bug in suspend/resume
> 
> On 11/13/2014 11:15 AM, Marc Kleine-Budde wrote:
> > On 11/13/2014 07:58 AM, Kedareswara rao Appana wrote:
> >> When accessing the priv structure use container_of instead of dev_get_drvdata.
> >
> > Why?
> 
> The drvdata here is the struct net_device, not the platform device.
> Please state this in the commit message.
> 
> If I understand the code correct, you can make use of the existing helper function to_platform_device():
> 
> http://lxr.free-electrons.com/source/include/linux/platform_device.h#L42
> 
> Thanks for the suggestion.
>  Will use this macro(to_platform_device)  .
> 
> >
> >> Enable the clocks in the suspend before accessing the registers of the CAN.
> >>
> >> Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
> >> ---
> >>  drivers/net/can/xilinx_can.c |   20 ++++++++++++++++++--
> >>  1 files changed, 18 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/net/can/xilinx_can.c
> >> b/drivers/net/can/xilinx_can.c index 5e8b560..63ef645 100644
> >> --- a/drivers/net/can/xilinx_can.c
> >> +++ b/drivers/net/can/xilinx_can.c
> >> @@ -972,15 +972,30 @@ static const struct net_device_ops xcan_netdev_ops = {
> >>   */
> >>  static int __maybe_unused xcan_suspend(struct device *dev)  {
> >> -    struct platform_device *pdev = dev_get_drvdata(dev);
> >> +    struct platform_device *pdev = container_of(dev,
> >> +                    struct platform_device, dev);
> >>      struct net_device *ndev = platform_get_drvdata(pdev);
> >>      struct xcan_priv *priv = netdev_priv(ndev);
>
Why not simply:
	struct net_device *ndev = dev_get_drvdata(dev);

There is no need for a struct platform_device* at all.


Lothar Waßmann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info@karo-electronics.de
___________________________________________________________

  reply	other threads:[~2014-11-13 11:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-13  6:58 [PATCH] can: Fix bug in suspend/resume Kedareswara rao Appana
2014-11-13 10:15 ` Marc Kleine-Budde
2014-11-13 10:46   ` Marc Kleine-Budde
     [not found]     ` <54648BF4.60007-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-11-13 10:58       ` Appana Durga Kedareswara Rao
2014-11-13 11:32         ` Lothar Waßmann [this message]
2014-11-13 12:03           ` Marc Kleine-Budde
2014-11-13 11:01     ` Appana Durga Kedareswara Rao

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=20141113123218.79850236@ipc1.ka-ro \
    --to=lw@karo-electronics.de \
    --cc=appana.durga.rao@xilinx.com \
    --cc=devicetree@vger.kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michals@xilinx.com \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sorenb@xilinx.com \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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