From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3B8EC433E0 for ; Tue, 23 Feb 2021 12:23:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B8DC64E5C for ; Tue, 23 Feb 2021 12:23:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232471AbhBWMX0 (ORCPT ); Tue, 23 Feb 2021 07:23:26 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:36002 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232316AbhBWMXP (ORCPT ); Tue, 23 Feb 2021 07:23:15 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 11NCMKs4017792; Tue, 23 Feb 2021 06:22:20 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1614082940; bh=EhWZj3kxi2xbFc+sNH7zq/wCO8MCdICSnmIsalBeMas=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=KXTsdsCpdMNOqaK4YajpxkOrPNWFiKgjSmKhjk5oJvRxuZF3oolSD6rzzjltQjfZz 6L+uAeF3bqB4u0EXwQRkjB645Q5ye+EsYEuJydSQ94BN33z8mm4T3USrPPHzLLqnFi 6MA/g7o7fm/L83mlgwYJO9YYrNwib3nG+27ymyOw= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 11NCMK50031926 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 23 Feb 2021 06:22:20 -0600 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 23 Feb 2021 06:22:19 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Tue, 23 Feb 2021 06:22:19 -0600 Received: from [10.250.232.74] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 11NCMFBc073064; Tue, 23 Feb 2021 06:22:16 -0600 Subject: Re: [PATCH v15 2/4] phy: Add media type and speed serdes configuration interfaces To: Steen Hegelund , Leon Romanovsky CC: Vinod Koul , Alexandre Belloni , Lars Povlsen , Bjarni Jonasson , Microchip UNG Driver List , , , Andrew Lunn References: <20210218161451.3489955-1-steen.hegelund@microchip.com> <20210218161451.3489955-3-steen.hegelund@microchip.com> <94dad8f439dd870b3488130e82f50e28b81fccf1.camel@microchip.com> From: Kishon Vijay Abraham I Message-ID: Date: Tue, 23 Feb 2021 17:52:14 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <94dad8f439dd870b3488130e82f50e28b81fccf1.camel@microchip.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Leon, On 22/02/21 1:30 pm, Steen Hegelund wrote: > Hi Leon, > > On Sun, 2021-02-21 at 07:59 +0200, Leon Romanovsky wrote: >> EXTERNAL EMAIL: Do not click links or open attachments unless you >> know the content is safe >> >> On Thu, Feb 18, 2021 at 05:14:49PM +0100, Steen Hegelund wrote: >>> Provide new phy configuration interfaces for media type and speed >>> that >>> allows e.g. PHYs used for ethernet to be configured with this >>> information. >>> >>> Signed-off-by: Lars Povlsen >>> Signed-off-by: Steen Hegelund >>> Reviewed-by: Andrew Lunn >>> Reviewed-by: Alexandre Belloni >>> --- >>> > > ... > >>>  int phy_validate(struct phy *phy, enum phy_mode mode, int submode, >>>                union phy_configure_opts *opts); >>> @@ -344,6 +356,20 @@ static inline int phy_set_mode_ext(struct phy >>> *phy, enum phy_mode mode, >>>  #define phy_set_mode(phy, mode) \ >>>       phy_set_mode_ext(phy, mode, 0) >>> >>> +static inline int phy_set_media(struct phy *phy, enum phy_media >>> media) >>> +{ >>> +     if (!phy) >>> +             return 0; >> >> I'm curious, why do you check for the NULL in all newly introduced >> functions? >> How is it possible that calls to phy_*() supply NULL as the main >> struct? >> >> Thanks > > I do not know the history of that, but all the functions in the > interface that takes a phy as input and returns a status follow that > pattern. Maybe Kishon and Vinod knows the origin? It is to make handling optional PHYs simpler. See here for the origin :-) http://lore.kernel.org/r/1391264157-2112-1-git-send-email-andrew@lunn.ch Thanks Kishon > >> >>> +     return -ENODEV; >>> +} >>> + >>> +static inline int phy_set_speed(struct phy *phy, int speed) >>> +{ >>> +     if (!phy) >>> +             return 0; >>> +     return -ENODEV; >>> +} >>> + >>>  static inline enum phy_mode phy_get_mode(struct phy *phy) >>>  { >>>       return PHY_MODE_INVALID; >>> -- >>> 2.30.0 >>> > > Best Regards > Steen >