Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2415412pxb; Tue, 23 Feb 2021 06:38:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXcHJfFLD9uEwNURgSOdnKIvMcdAdzphtqfMHHXnnN/iydfC1Bf7RBwkOWQOlGz9LnCQjD X-Received: by 2002:a17:906:4e1a:: with SMTP id z26mr25976913eju.349.1614091081812; Tue, 23 Feb 2021 06:38:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614091081; cv=none; d=google.com; s=arc-20160816; b=EU0s+7/KgOqhXl2BMgZE0Vi9kv85/GHYBSedonnjR3ZxomZBXaZ21CITl9lRTuaaVJ URBu4xAzOVuR1IRFYsHxs7I45tpSwhRRySbib0Zpfd62pJZ6iB3DWSoxBEIfojkdZ6s8 q7WH4HCtdU/ugNPJlktbrdWWqNRTU16Rxl2Z2QI1mjN4x/CVhkdN6rd3GnJpFbg5JqkP s/Pe4+A2hz11ez+zaDTzT9fiGBPg+ykvjpKrr7aRqAKKAzR/HD7mGieUavTBqu3f+lyt DnfBsD1H1Tm8rNnugxORANtpcWo012E55OMlAQn09I+hnehxBxK5YXLa9SrCUj+ylisR 9+bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=5r8gkE691BvVr+XZ6iWsmMYKDnAhRA4VboC/aMX6Nos=; b=oSE7SkF0vaeRCJRolb7JW687xkn/TZLz7iwlLjf3ORdhJpIR7UQJPtoQybu0u5hHZs xbeN9oW+UbBu/Dwb1BTqQr5lDoWWsobiADCg9uHCyBe35wFMCuxIHl5xjyGmGURg4pIi dXIbym6UXQhXMBHu65YO56XBrp6nUS+hfayrpLrAtoBt4ZPYT4OwrmcUzSQuA28fnFfp I/YRgVajH5Ek60LaYQpqf5gsZwNaYu2ex09XvGP4/bflKKIAsvSCLVBnGqCkLxg3WDge 26ZytM6ZE89ho2tvgHSDxvvsyiCfITGw9JTCK0hDYdeVtQbEPQeGEHK+wZSM7XcOreyr VRLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lPLLx8YS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l18si4075633edq.302.2021.02.23.06.37.34; Tue, 23 Feb 2021 06:38:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lPLLx8YS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231177AbhBWNyV (ORCPT + 99 others); Tue, 23 Feb 2021 08:54:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:57592 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229886AbhBWNyS (ORCPT ); Tue, 23 Feb 2021 08:54:18 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 332CD64DBD; Tue, 23 Feb 2021 13:53:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614088417; bh=iC+DgKr7bNJFm/2RCPxrXSkZ+QAYNIbWqrFQAEW25Qc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lPLLx8YS97rViZelcC8uKRfa1j4HTlb1BDuAPafMDEuVWwNy0t/Mct6w3hQ1eT3+G qYkoBm+tHhW34haK0FkzDHWJwAtuOheI+OVzWretFm+1I5y1qgWnuGmKadOQ3hD2Vn aCB8rFx//afOkiuaxoxzYq4AokAf2AxvzypBveNgkwJEHtbPqrd8nya1aJU/21cCc1 KPI+hWF06hxmwHRZkFYkzmQHDmg3jUXJGy5k/BpZ2UkI6bbWCho2aAratAcd5eJcWu oLIbKXNc0MU7j+u6/fel8EydSFLh+ikd1YQHTCWQgBqS8V1wqXhkb3XF27r2t3C6cm WlKiBUebYPDzQ== Date: Tue, 23 Feb 2021 15:53:34 +0200 From: Leon Romanovsky To: Kishon Vijay Abraham I Cc: Steen Hegelund , Vinod Koul , Alexandre Belloni , Lars Povlsen , Bjarni Jonasson , Microchip UNG Driver List , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lunn Subject: Re: [PATCH v15 2/4] phy: Add media type and speed serdes configuration interfaces Message-ID: References: <20210218161451.3489955-1-steen.hegelund@microchip.com> <20210218161451.3489955-3-steen.hegelund@microchip.com> <94dad8f439dd870b3488130e82f50e28b81fccf1.camel@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 23, 2021 at 05:52:14PM +0530, Kishon Vijay Abraham I wrote: > 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 for the pointer, it is good to know. I personally would do it differently, but whatever. > > 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 > >