Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1749352imu; Thu, 24 Jan 2019 00:57:26 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Tndz4G4PqBzS1fOUWVrTFRl2dRgJqrLlxbX7NVEYVCtKepbDdnK7O/IutOgbfNjje4zmj X-Received: by 2002:a62:670f:: with SMTP id b15mr5593186pfc.212.1548320246726; Thu, 24 Jan 2019 00:57:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548320246; cv=none; d=google.com; s=arc-20160816; b=QoD52aDon2mtEm8AMRTOMNgR5xbfS7oJpegHi6Zc2x9/QQ3plXszq+W3WgoUFTjIh4 O0TiAEskDBbl/fT0r46ExSQbhbWUjLQ/BwQyPE+HDU+pFlbSeObkwMC+YfATQgY4DwD9 UkgGEK3BImkcN2XLg1635E2ePAoKZbUfYnmMjSaSehvr7wKjKnB/oEobulB0c8tqDYj1 egS4zg3O4+BxBlcMMyDm+1wsZQ4Ak8SkJGnVPE/mI/iml1hPiefvLmDYQiejuLa0PJTl MZwpLz6Qsmt6F2LmRtD+hDZ6TSZvbC+u7q/UnRG8xLV9N1ehCdnfWtGgLUOBrB7iizF2 EwkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=devrnNh+ZwjsxcC6dWzM9HLe3VzxAp6D8/tdedMHHk8=; b=o5o1t8OsJiBCrker9go2eMvmnm7c35h7KDGlj4xKmZX322yeHISsu0DYAoHi7d5Y9D ZmvqdXWkkjqj6kOQlhjvcIWJ1mUp3N7jtCU5aqksXyfYAVRLwhML03AZ/ZsLgJzeruVV XCZclWlyp+f5OwNbjqvnAuP8nM7RgUyeX4rB44tTR7jX1UY9tPCi7CU6lu6wZkrHW08X gZ8DWoijawoQUCJ9jrVJoCjp9hwNdRkxwgPJ7f+aubWuyFQtqtFcUYyrUrOklTTcwuh+ yKs8rm7Xo7GpNxHMLAgIIJzPyPQ+AUUWK4BlT1kvmX0gPfMHfMoeRvmLeeoFQpXHyhda hicQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si22264478pfb.166.2019.01.24.00.57.11; Thu, 24 Jan 2019 00:57:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727531AbfAXI4a (ORCPT + 99 others); Thu, 24 Jan 2019 03:56:30 -0500 Received: from mail.bootlin.com ([62.4.15.54]:57125 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727208AbfAXI4a (ORCPT ); Thu, 24 Jan 2019 03:56:30 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 2393C207B0; Thu, 24 Jan 2019 09:56:28 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from localhost (aaubervilliers-681-1-87-206.w90-88.abo.wanadoo.fr [90.88.29.206]) by mail.bootlin.com (Postfix) with ESMTPSA id B9482207AC; Thu, 24 Jan 2019 09:56:27 +0100 (CET) Date: Thu, 24 Jan 2019 09:56:28 +0100 From: Antoine Tenart To: Andrew Lunn Cc: Antoine Tenart , davem@davemloft.net, sd@queasysnail.net, f.fainelli@gmail.com, hkallweit1@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, alexandre.belloni@bootlin.com, quentin.schulz@bootlin.com, allan.nielsen@microchip.com Subject: Re: [PATCH net-next 05/10] net: phy: introduce a phy_driver macsec helper Message-ID: <20190124085628.GC3662@kwain> References: <20190123155638.13852-1-antoine.tenart@bootlin.com> <20190123155638.13852-6-antoine.tenart@bootlin.com> <20190123170816.GH5310@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190123170816.GH5310@lunn.ch> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andrew, On Wed, Jan 23, 2019 at 06:08:16PM +0100, Andrew Lunn wrote: > > +int phy_macsec(struct phy_device *phydev, struct netdev_macsec *macsec) > > +{ > > + int ret = -EOPNOTSUPP; > > + > > + if (!phydev->drv) > > + return -EIO; > > + > > + mutex_lock(&phydev->lock); > > + > > + if (phydev->drv->macsec) > > + ret = phydev->drv->macsec(phydev, macsec); > > + > > + mutex_unlock(&phydev->lock); > > + return ret; > > +} > > +EXPORT_SYMBOL_GPL(phy_macsec); > > + > > > @@ -630,6 +634,10 @@ struct phy_driver { > > struct ethtool_tunable *tuna, > > const void *data); > > int (*set_loopback)(struct phy_device *dev, bool enable); > > + > > +#ifdef CONFIG_MACSEC > > + int (*macsec)(struct phy_device *dev, struct netdev_macsec *macsec); > > +#endif > > > So the member only exists if CONFIG_MACSEC is defined. So i think you > need similar protection in phy_macsec() or you are going to try to > access a member which sometimes does not exist. Right, I'll fix that and protect the phy_macsec definition within an '#ifdef CONFIG_MACSEC'. Thanks! Antoine -- Antoine T?nart, Bootlin Embedded Linux and Kernel engineering https://bootlin.com