linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: Leon Romanovsky <leonro@nvidia.com>,
	Alexander Lobakin <alobakin@pm.me>,
	Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>,
	Ariel Elior <aelior@marvell.com>,
	GR-everest-linux-l2@marvell.com,
	GR-QLogic-Storage-Upstream@marvell.com,
	Igor Russkikh <irusskikh@marvell.com>,
	intel-wired-lan@lists.osuosl.org,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	Javed Hasan <jhasan@marvell.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
	Jesse Brandeburg <jesse.brandeburg@intel.com>,
	Jiri Pirko <jiri@nvidia.com>,
	linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Michael Chan <michael.chan@broadcom.com>,
	Michal Kalderon <michal.kalderon@marvell.com>,
	netdev@vger.kernel.org, Sathya Perla <sathya.perla@broadcom.com>,
	Saurav Kashyap <skashyap@marvell.com>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Subject: [PATCH net-next 4/6] devlink: Remove single line function obfuscations
Date: Thu, 23 Sep 2021 21:12:51 +0300	[thread overview]
Message-ID: <a56f5eece50f146ea170571a9dde24079522937f.1632420431.git.leonro@nvidia.com> (raw)
In-Reply-To: <cover.1632420430.git.leonro@nvidia.com>

From: Leon Romanovsky <leonro@nvidia.com>

There is no need in extra one line functions to call relevant
functions only once.

Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 net/core/devlink.c | 89 ++++++++++++++++++----------------------------
 1 file changed, 34 insertions(+), 55 deletions(-)

diff --git a/net/core/devlink.c b/net/core/devlink.c
index 9c071f4e609f..3ea33c689790 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -10117,13 +10117,26 @@ void devlink_params_unpublish(struct devlink *devlink)
 }
 EXPORT_SYMBOL_GPL(devlink_params_unpublish);
 
-static int
-__devlink_param_driverinit_value_get(struct list_head *param_list, u32 param_id,
-				     union devlink_param_value *init_val)
+/**
+ *	devlink_param_driverinit_value_get - get configuration parameter
+ *					     value for driver initializing
+ *
+ *	@devlink: devlink
+ *	@param_id: parameter ID
+ *	@init_val: value of parameter in driverinit configuration mode
+ *
+ *	This function should be used by the driver to get driverinit
+ *	configuration for initialization after reload command.
+ */
+int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
+				       union devlink_param_value *init_val)
 {
 	struct devlink_param_item *param_item;
 
-	param_item = devlink_param_find_by_id(param_list, param_id);
+	if (!devlink_reload_supported(devlink->ops))
+		return -EOPNOTSUPP;
+
+	param_item = devlink_param_find_by_id(&devlink->param_list, param_id);
 	if (!param_item)
 		return -EINVAL;
 
@@ -10139,17 +10152,26 @@ __devlink_param_driverinit_value_get(struct list_head *param_list, u32 param_id,
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(devlink_param_driverinit_value_get);
 
-static int
-__devlink_param_driverinit_value_set(struct devlink *devlink,
-				     unsigned int port_index,
-				     struct list_head *param_list, u32 param_id,
-				     union devlink_param_value init_val,
-				     enum devlink_command cmd)
+/**
+ *	devlink_param_driverinit_value_set - set value of configuration
+ *					     parameter for driverinit
+ *					     configuration mode
+ *
+ *	@devlink: devlink
+ *	@param_id: parameter ID
+ *	@init_val: value of parameter to set for driverinit configuration mode
+ *
+ *	This function should be used by the driver to set driverinit
+ *	configuration mode default value.
+ */
+int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
+				       union devlink_param_value init_val)
 {
 	struct devlink_param_item *param_item;
 
-	param_item = devlink_param_find_by_id(param_list, param_id);
+	param_item = devlink_param_find_by_id(&devlink->param_list, param_id);
 	if (!param_item)
 		return -EINVAL;
 
@@ -10163,52 +10185,9 @@ __devlink_param_driverinit_value_set(struct devlink *devlink,
 		param_item->driverinit_value = init_val;
 	param_item->driverinit_value_valid = true;
 
-	devlink_param_notify(devlink, port_index, param_item, cmd);
+	devlink_param_notify(devlink, 0, param_item, DEVLINK_CMD_PARAM_NEW);
 	return 0;
 }
-
-/**
- *	devlink_param_driverinit_value_get - get configuration parameter
- *					     value for driver initializing
- *
- *	@devlink: devlink
- *	@param_id: parameter ID
- *	@init_val: value of parameter in driverinit configuration mode
- *
- *	This function should be used by the driver to get driverinit
- *	configuration for initialization after reload command.
- */
-int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
-				       union devlink_param_value *init_val)
-{
-	if (!devlink_reload_supported(devlink->ops))
-		return -EOPNOTSUPP;
-
-	return __devlink_param_driverinit_value_get(&devlink->param_list,
-						    param_id, init_val);
-}
-EXPORT_SYMBOL_GPL(devlink_param_driverinit_value_get);
-
-/**
- *	devlink_param_driverinit_value_set - set value of configuration
- *					     parameter for driverinit
- *					     configuration mode
- *
- *	@devlink: devlink
- *	@param_id: parameter ID
- *	@init_val: value of parameter to set for driverinit configuration mode
- *
- *	This function should be used by the driver to set driverinit
- *	configuration mode default value.
- */
-int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
-				       union devlink_param_value init_val)
-{
-	return __devlink_param_driverinit_value_set(devlink, 0,
-						    &devlink->param_list,
-						    param_id, init_val,
-						    DEVLINK_CMD_PARAM_NEW);
-}
 EXPORT_SYMBOL_GPL(devlink_param_driverinit_value_set);
 
 /**
-- 
2.31.1


  parent reply	other threads:[~2021-09-23 18:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23 18:12 [PATCH net-next 0/6] Batch of devlink related fixes Leon Romanovsky
2021-09-23 18:12 ` [PATCH net-next 1/6] bnxt_en: Check devlink allocation and registration status Leon Romanovsky
2021-09-23 21:11   ` Edwin Peer
2021-09-23 23:11     ` Leon Romanovsky
2021-09-24  1:39       ` Jakub Kicinski
2021-09-24 17:20         ` Edwin Peer
2021-09-25 10:01           ` Leon Romanovsky
2021-09-23 18:12 ` [PATCH net-next 2/6] bnxt_en: Properly remove port parameter support Leon Romanovsky
2021-09-23 21:23   ` Edwin Peer
2021-09-23 18:12 ` [PATCH net-next 3/6] devlink: Delete not used port parameters APIs Leon Romanovsky
2021-09-23 18:12 ` Leon Romanovsky [this message]
2021-09-23 18:12 ` [PATCH net-next 5/6] ice: Delete always true check of PF pointer Leon Romanovsky
2021-09-23 18:12 ` [PATCH net-next 6/6] qed: Don't ignore devlink allocation failures Leon Romanovsky
2021-09-23 22:55 ` [PATCH net-next 0/6] Batch of devlink related fixes Jakub Kicinski
2021-09-23 23:16   ` Leon Romanovsky
2021-09-24 13:14 ` David Miller
2021-09-25  8:56   ` Leon Romanovsky
2021-09-24 13:20 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a56f5eece50f146ea170571a9dde24079522937f.1632420431.git.leonro@nvidia.com \
    --to=leon@kernel.org \
    --cc=GR-QLogic-Storage-Upstream@marvell.com \
    --cc=GR-everest-linux-l2@marvell.com \
    --cc=aelior@marvell.com \
    --cc=alobakin@pm.me \
    --cc=anirudh.venkataramanan@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=irusskikh@marvell.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=jejb@linux.ibm.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=jhasan@marvell.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michael.chan@broadcom.com \
    --cc=michal.kalderon@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=sathya.perla@broadcom.com \
    --cc=skashyap@marvell.com \
    --cc=vasundhara-v.volam@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).