Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754402AbcK1HHB (ORCPT ); Mon, 28 Nov 2016 02:07:01 -0500 Received: from mail-lf0-f50.google.com ([209.85.215.50]:33721 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754296AbcK1HGf (ORCPT ); Mon, 28 Nov 2016 02:06:35 -0500 Subject: Re: [PATCH] net: fec: turn on device when extracting statistics To: David Miller References: <1480068120-22137-1-git-send-email-nikita.yoush@cogentembedded.com> <20161127.202945.1759992980026862076.davem@davemloft.net> 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 From: Nikita Yushchenko X-Enigmail-Draft-Status: N1110 Message-ID: <4ddb5842-0ece-2950-214f-f56db808ffbd@cogentembedded.com> Date: Mon, 28 Nov 2016 10:06:31 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161127.202945.1759992980026862076.davem@davemloft.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 811 Lines: 24 28.11.2016 04:29, David Miller пишет: > From: Nikita Yushchenko > 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.