Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: nikita.yoush@cogentembedded.com
Cc: fugang.duan@nxp.com, troy.kisky@boundarydevices.com,
	andrew@lunn.ch, eric@nelint.com, tremyfr@gmail.com,
	johannes@sipsolutions.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, cphealy@gmail.com,
	fabio.estevam@nxp.com
Subject: Re: [PATCH] net: fec: turn on device when extracting statistics
Date: Mon, 28 Nov 2016 09:11:49 -0500 (EST)	[thread overview]
Message-ID: <20161128.091149.2039527154584013771.davem@davemloft.net> (raw)
In-Reply-To: <4ddb5842-0ece-2950-214f-f56db808ffbd@cogentembedded.com>

From: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Date: Mon, 28 Nov 2016 10:06:31 +0300

> 
> 
> 28.11.2016 04:29, David Miller пишет:
>> From: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
>> Date: Fri, 25 Nov 2016 13:02:00 +0300
>> 
>>> +	int i, ret;
>>> +
>>> +	ret = pm_runtime_get_sync(&fep->pdev->dev);
>>> +	if (IS_ERR_VALUE(ret)) {
>>> +		memset(data, 0, sizeof(*data) * ARRAY_SIZE(fec_stats));
>>> +		return;
>>> +	}
>> 
>> This really isn't the way to do this.
>> 
>> When the device is suspended and the clocks are going to be stopped,
>> you must fetch the statistic values into a software copy and provide
>> those if the device is suspended when statistics are requested.
> 
> Ok, can do that, although can't see what's wrong with waking device
> here. The situation of requesting stats on down device isn't something
> widely used, thus keeping handling of that as local as possible looks
> better for me.

The issue is the fact that you need error handling at all and might
therefore provide a set of zero stats to the user when that entire
possibility could have been avoided in the first place by recording
the stats at suspend time.

      reply	other threads:[~2016-11-28 14:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-25 10:02 [PATCH] net: fec: turn on device when extracting statistics Nikita Yushchenko
2016-11-27  6:25 ` Andy Duan
2016-11-28  1:29 ` David Miller
2016-11-28  7:06   ` Nikita Yushchenko
2016-11-28 14:11     ` David Miller [this message]

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=20161128.091149.2039527154584013771.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=andrew@lunn.ch \
    --cc=cphealy@gmail.com \
    --cc=eric@nelint.com \
    --cc=fabio.estevam@nxp.com \
    --cc=fugang.duan@nxp.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nikita.yoush@cogentembedded.com \
    --cc=tremyfr@gmail.com \
    --cc=troy.kisky@boundarydevices.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