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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A159EC7619A for ; Wed, 5 Apr 2023 12:07:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237191AbjDEMHM (ORCPT ); Wed, 5 Apr 2023 08:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230520AbjDEMHK (ORCPT ); Wed, 5 Apr 2023 08:07:10 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6F85423B; Wed, 5 Apr 2023 05:07:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=qWBuUdDNLTomMrWa17ue40qpTA5SPEfNQkTISsS/20Y=; b=URiP68ONioLF3PEBmrHrpCwU3N MkWdAfLyOLgHVH5SB0rg98qCkHgkTSjumXpkW4Q3Sb9Juv587zbcO10z9vGcNXDeqGK9ezMlgyXLd WjLCUCigqNKA/klnPdrYUNbJHVi4hNttRqKG0ZKr77RNMcmh1edSIhtHJgCeZ/iDfz1w=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pk1uZ-009W6d-3C; Wed, 05 Apr 2023 14:06:47 +0200 Date: Wed, 5 Apr 2023 14:06:47 +0200 From: Andrew Lunn To: Marco Felsch Cc: Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Fainelli , Broadcom internal kernel review list , Richard Cochran , Radu Pirea , Shyam Sundar S K , Yisen Zhuang , Salil Mehta , Jassi Brar , Ilias Apalodimas , Iyappan Subramanian , Keyur Chudgar , Quan Nguyen , "Rafael J. Wysocki" , Len Brown , Rob Herring , Frank Rowand , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, devicetree@vger.kernel.org, kernel@pengutronix.de Subject: Re: [PATCH 03/12] net: phy: add phy_device_set_miits helper Message-ID: References: <20230405-net-next-topic-net-phy-reset-v1-0-7e5329f08002@pengutronix.de> <20230405-net-next-topic-net-phy-reset-v1-3-7e5329f08002@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230405-net-next-topic-net-phy-reset-v1-3-7e5329f08002@pengutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +void phy_device_set_miits(struct phy_device *phydev, > + struct mii_timestamper *mii_ts) > +{ > + if (!phydev) > + return; > + > + if (phydev->mii_ts) { > + phydev_dbg(phydev, > + "MII timestamper already set -> skip set\n"); > + return; > + } > + > + phydev->mii_ts = mii_ts; > +} We tend to be less paranoid. Few, if any, other functions test that phydev is not NULL. And the current code allows overwriting of an existing stamper. If you think overwriting should not be allowed return -EINVAL, and change all the callers to test for it. > +EXPORT_SYMBOL(phy_device_set_miits); _GPL please. The code is a bit inconsistent, but new symbols should be EXPORT_SYMBOL_GPL. I do however like this patch, hiding away the internals of phydev. Andrew