Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752223AbbDCVZ4 (ORCPT ); Fri, 3 Apr 2015 17:25:56 -0400 Received: from smtp53.i.mail.ru ([94.100.177.113]:43846 "EHLO smtp53.i.mail.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751032AbbDCVZz (ORCPT ); Fri, 3 Apr 2015 17:25:55 -0400 Message-ID: <551F0547.8000202@list.ru> Date: Sat, 04 Apr 2015 00:25:27 +0300 From: Stas Sergeev User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Florian Fainelli , netdev@vger.kernel.org CC: Linux kernel , Stas Sergeev Subject: Re: [PATCH 1/2] add fixed_phy_update_state() - update state of fixed_phy References: <551C2AB9.8020508@list.ru> <551C2B37.6000100@list.ru> <551EE936.4010700@gmail.com> In-Reply-To: <551EE936.4010700@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam: Not detected X-Mras: Ok Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1832 Lines: 35 03.04.2015 22:25, Florian Fainelli пишет: > On 01/04/15 10:30, Stas Sergeev wrote: >> - The callback needs to be registered before of_phy_connect() to >> avoid running with outdated state, but of_phy_connect() returns the >> phy_device pointer, which is needed to register the callback. Registering >> it before of_phy_connect() will therefore require a hack to get the >> pointer earlier. In fact, this can't even be done: registering it before of_phy_connect() is an asking for troubles with NULL deref. >> Overall, this addition makes the subsequent patch that implements >> SGMII link status for mvneta, much cleaner. > Agreed, now that we have that, we should probably just remove the > ability to have a fixed link update callback since it suffers from all > the deficiencies you outlined above, and is creating some overhead by > polling the hardware. In fact, there is still a bit of a problem. You certainly want to set the initial state, so that on of_phy_connect() time it is already valid. For this I still use of_phy_find_device()... This, however, differs from registering the callback: - initial state is set only once; callback should be registered before _every_ of_phy_connect() (but it can't be registered before because of the NULL, so only after) - initial state can be set anywhere anytime, not necessary any near of_phy_connect(). So the problem is mostly solved, but of_phy_find_device() is still there. To get rid of this, I guess some addition to of_mdio may be needed as well. Maybe optionally passing the status directly to of_phy_connect()? Not sure. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/