From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 914DB2FAF for ; Wed, 29 Sep 2021 12:25:04 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id F09DB6134F; Wed, 29 Sep 2021 12:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632918304; bh=wWhYoJmf5o0goYtd67yiGvYSKB/JovKlR7TP3Zqi99g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FOgYB8oD4xLYiT0MCbtWOdRGH09IaQNPSb9EOFkBWsnpoxLHGflJa7ENoq5BBegTA /idNuAQ88djuyX6GEANEa3D9oBEdUuEjGy3rDzcd4GQcWFa+2U/Gw+KtNXffW4v0Ud 7oDuoKWmOB12QpwjmS0H8zNQahoQsoL0nRw6FaFU= Date: Wed, 29 Sep 2021 14:25:00 +0200 From: Greg Kroah-Hartman To: Leon Romanovsky Cc: "David S . Miller" , Jakub Kicinski , Leon Romanovsky , Alexandre Belloni , Andrew Lunn , Ariel Elior , Bin Luo , Claudiu Manoil , Coiby Xu , Derek Chickles , drivers@pensando.io, Eric Dumazet , Felix Manlunas , Florian Fainelli , Geetha sowjanya , GR-everest-linux-l2@marvell.com, GR-Linux-NIC-Dev@marvell.com, hariprasad , Ido Schimmel , intel-wired-lan@lists.osuosl.org, Ioana Ciornei , Jerin Jacob , Jesse Brandeburg , Jiri Pirko , Jonathan Lemon , Linu Cherian , linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-rdma@vger.kernel.org, linux-staging@lists.linux.dev, Manish Chopra , Michael Chan , Moshe Shemesh , netdev@vger.kernel.org, oss-drivers@corigine.com, Richard Cochran , Saeed Mahameed , Salil Mehta , Satanand Burla , Shannon Nelson , Shay Drory , Simon Horman , Subbaraya Sundeep , Sunil Goutham , Taras Chornyi , Tariq Toukan , Tony Nguyen , UNGLinuxDriver@microchip.com, Vadym Kochan , Vivien Didelot , Vladimir Oltean , Yisen Zhuang Subject: Re: [PATCH net-next v1 3/5] devlink: Allow set specific ops callbacks dynamically Message-ID: References: Precedence: bulk X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Sep 29, 2021 at 03:00:44PM +0300, Leon Romanovsky wrote: > +void devlink_set_ops(struct devlink *devlink, struct devlink_ops *ops) > +{ > + struct devlink_ops *dev_ops = devlink->ops; > + > + WARN_ON(!devlink_reload_actions_valid(ops)); > + > +#define SET_DEVICE_OP(ptr, op, name) \ > + do { \ > + if ((op)->name) \ > + if (!((ptr)->name)) \ > + (ptr)->name = (op)->name; \ > + } while (0) > + > + /* Keep sorted */ > + SET_DEVICE_OP(dev_ops, ops, reload_actions); > + SET_DEVICE_OP(dev_ops, ops, reload_down); > + SET_DEVICE_OP(dev_ops, ops, reload_limits); > + SET_DEVICE_OP(dev_ops, ops, reload_up); Keep sorted in what order? And why? thanks, greg k-h From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg Kroah-Hartman Date: Wed, 29 Sep 2021 14:25:00 +0200 Subject: [Intel-wired-lan] [PATCH net-next v1 3/5] devlink: Allow set specific ops callbacks dynamically In-Reply-To: References: Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: intel-wired-lan@osuosl.org List-ID: On Wed, Sep 29, 2021 at 03:00:44PM +0300, Leon Romanovsky wrote: > +void devlink_set_ops(struct devlink *devlink, struct devlink_ops *ops) > +{ > + struct devlink_ops *dev_ops = devlink->ops; > + > + WARN_ON(!devlink_reload_actions_valid(ops)); > + > +#define SET_DEVICE_OP(ptr, op, name) \ > + do { \ > + if ((op)->name) \ > + if (!((ptr)->name)) \ > + (ptr)->name = (op)->name; \ > + } while (0) > + > + /* Keep sorted */ > + SET_DEVICE_OP(dev_ops, ops, reload_actions); > + SET_DEVICE_OP(dev_ops, ops, reload_down); > + SET_DEVICE_OP(dev_ops, ops, reload_limits); > + SET_DEVICE_OP(dev_ops, ops, reload_up); Keep sorted in what order? And why? thanks, greg k-h