linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Magel <lukas.magel@posteo.net>
To: linux-can@vger.kernel.org
Cc: Stephane Grosjean <s.grosjean@peak-system.com>,
	Lukas Magel <lukas.magel@posteo.net>
Subject: [PATCH v2 1/7] can: peak_usb: rename device_id to a more explicit name
Date: Sun, 30 Oct 2022 10:59:33 +0000	[thread overview]
Message-ID: <20221030105939.87658-2-lukas.magel@posteo.net> (raw)
In-Reply-To: <20221030105939.87658-1-lukas.magel@posteo.net>

From: Stephane Grosjean <s.grosjean@peak-system.com>

The so-called "device id" is in fact a value defined by the user.
Therefore, in order not to confuse it with the device id used by the USB,
the functions and variables for reading this user-defined value are
renamed.

Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Lukas Magel <lukas.magel@posteo.net>
---
 drivers/net/can/usb/peak_usb/pcan_usb.c      | 8 ++++----
 drivers/net/can/usb/peak_usb/pcan_usb_core.c | 6 +++---
 drivers/net/can/usb/peak_usb/pcan_usb_core.h | 4 ++--
 drivers/net/can/usb/peak_usb/pcan_usb_fd.c   | 2 +-
 drivers/net/can/usb/peak_usb/pcan_usb_pro.c  | 8 ++++----
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c
index 687dd542f7f6..11fd033b57f3 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb.c
@@ -381,9 +381,9 @@ static int pcan_usb_get_serial(struct peak_usb_device *dev, u32 *serial_number)
 }
 
 /*
- * read device id from device
+ * read user device id from device
  */
-static int pcan_usb_get_device_id(struct peak_usb_device *dev, u32 *device_id)
+static int pcan_usb_get_user_devid(struct peak_usb_device *dev, u32 *user_devid)
 {
 	u8 args[PCAN_USB_CMD_ARGS_LEN];
 	int err;
@@ -393,7 +393,7 @@ static int pcan_usb_get_device_id(struct peak_usb_device *dev, u32 *device_id)
 		netdev_err(dev->netdev, "getting device id failure: %d\n", err);
 
 	else
-		*device_id = args[0];
+		*user_devid = args[0];
 
 	return err;
 }
@@ -1017,7 +1017,7 @@ const struct peak_usb_adapter pcan_usb = {
 	.dev_init = pcan_usb_init,
 	.dev_set_bus = pcan_usb_write_mode,
 	.dev_set_bittiming = pcan_usb_set_bittiming,
-	.dev_get_device_id = pcan_usb_get_device_id,
+	.dev_get_user_devid = pcan_usb_get_user_devid,
 	.dev_decode_buf = pcan_usb_decode_buf,
 	.dev_encode_msg = pcan_usb_encode_msg,
 	.dev_start = pcan_usb_start,
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
index 225697d70a9a..8e1b3c19f92f 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
@@ -922,11 +922,11 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter,
 	}
 
 	/* get device number early */
-	if (dev->adapter->dev_get_device_id)
-		dev->adapter->dev_get_device_id(dev, &dev->device_number);
+	if (dev->adapter->dev_get_user_devid)
+		dev->adapter->dev_get_user_devid(dev, &dev->user_devid);
 
 	netdev_info(netdev, "attached to %s channel %u (device %u)\n",
-			peak_usb_adapter->name, ctrl_idx, dev->device_number);
+			peak_usb_adapter->name, ctrl_idx, dev->user_devid);
 
 	return 0;
 
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.h b/drivers/net/can/usb/peak_usb/pcan_usb_core.h
index f6bdd8b3f290..6ff32673a256 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.h
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.h
@@ -60,7 +60,7 @@ struct peak_usb_adapter {
 	int (*dev_set_data_bittiming)(struct peak_usb_device *dev,
 				      struct can_bittiming *bt);
 	int (*dev_set_bus)(struct peak_usb_device *dev, u8 onoff);
-	int (*dev_get_device_id)(struct peak_usb_device *dev, u32 *device_id);
+	int (*dev_get_user_devid)(struct peak_usb_device *dev, u32 *user_devid);
 	int (*dev_decode_buf)(struct peak_usb_device *dev, struct urb *urb);
 	int (*dev_encode_msg)(struct peak_usb_device *dev, struct sk_buff *skb,
 					u8 *obuf, size_t *size);
@@ -122,7 +122,7 @@ struct peak_usb_device {
 	u8 *cmd_buf;
 	struct usb_anchor rx_submitted;
 
-	u32 device_number;
+	u32 user_devid;
 	u8 device_rev;
 
 	u8 ep_msg_in;
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
index 2ea1500df393..b8053e697261 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
@@ -972,7 +972,7 @@ static int pcan_usb_fd_init(struct peak_usb_device *dev)
 	}
 
 	pdev->usb_if->dev[dev->ctrl_idx] = dev;
-	dev->device_number =
+	dev->user_devid =
 		le32_to_cpu(pdev->usb_if->fw_info.dev_id[dev->ctrl_idx]);
 
 	/* if vendor rsp is of type 2, then it contains EP numbers to
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
index 5d8f6a40bb2c..15410d60cdf7 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
@@ -419,8 +419,8 @@ static int pcan_usb_pro_set_led(struct peak_usb_device *dev, u8 mode,
 	return pcan_usb_pro_send_cmd(dev, &um);
 }
 
-static int pcan_usb_pro_get_device_id(struct peak_usb_device *dev,
-				      u32 *device_id)
+static int pcan_usb_pro_get_user_devid(struct peak_usb_device *dev,
+				       u32 *user_devid)
 {
 	struct pcan_usb_pro_devid *pdn;
 	struct pcan_usb_pro_msg um;
@@ -439,7 +439,7 @@ static int pcan_usb_pro_get_device_id(struct peak_usb_device *dev,
 		return err;
 
 	pdn = (struct pcan_usb_pro_devid *)pc;
-	*device_id = le32_to_cpu(pdn->dev_num);
+	*user_devid = le32_to_cpu(pdn->dev_num);
 
 	return err;
 }
@@ -1076,7 +1076,7 @@ const struct peak_usb_adapter pcan_usb_pro = {
 	.dev_free = pcan_usb_pro_free,
 	.dev_set_bus = pcan_usb_pro_set_bus,
 	.dev_set_bittiming = pcan_usb_pro_set_bittiming,
-	.dev_get_device_id = pcan_usb_pro_get_device_id,
+	.dev_get_user_devid = pcan_usb_pro_get_user_devid,
 	.dev_decode_buf = pcan_usb_pro_decode_buf,
 	.dev_encode_msg = pcan_usb_pro_encode_msg,
 	.dev_start = pcan_usb_pro_start,
-- 
2.37.2


  reply	other threads:[~2022-10-30 11:01 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01  8:04 [PATCH v1] can: peak_usb: export PCAN device ID as sysfs device attribute Lukas Magel
2022-08-01 14:36 ` Vincent MAILHOL
2022-08-02 19:26   ` [PATCH v2] " Lukas Magel
2022-09-15  9:54 ` [RESEND PATCH " Lukas Magel
2022-09-28 20:43   ` Lukas Magel
2022-09-30 12:06     ` Marc Kleine-Budde
2022-09-30 14:20       ` Marc Kleine-Budde
2022-10-22 21:57         ` Lukas Magel
2022-10-22 21:35 ` [PATCH 0/7] can: peak_usb: Introduce configurable user dev id Lukas Magel
2022-10-22 21:35   ` [PATCH 1/7] can: peak_usb: rename device_id to a more explicit name Lukas Magel
2022-10-22 21:35   ` [PATCH 2/7] can: peak_usb: add callback to read user value of CANFD devices Lukas Magel
2022-10-22 21:35   ` [PATCH 3/7] can: peak_usb: allow flashing of the user device id Lukas Magel
2022-10-22 21:35   ` [PATCH 4/7] can: peak_usb: replace unregister_netdev() with unregister_candev() Lukas Magel
2022-10-25 13:30     ` Marc Kleine-Budde
2022-10-22 21:35   ` [PATCH 5/7] can: peak_usb: add ethtool interface to user defined flashed device number Lukas Magel
2022-10-25 14:54     ` Marc Kleine-Budde
2022-10-22 21:35   ` [PATCH 6/7] can: peak_usb: export PCAN user device ID as sysfs device attribute Lukas Magel
2022-10-25 13:30     ` Marc Kleine-Budde
2022-10-22 21:35   ` [PATCH 7/7] can: peak_usb: align user device id format in log with sysfs attribute Lukas Magel
2022-10-25 11:28     ` Marc Kleine-Budde
2022-10-25 11:44       ` Marc Kleine-Budde
2022-10-30 10:59 ` [PATCH v2 0/7] can: peak_usb: Introduce configurable user dev id Lukas Magel
2022-10-30 10:59   ` Lukas Magel [this message]
2022-10-30 10:59   ` [PATCH v2 2/7] can: peak_usb: add callback to read user value of CANFD devices Lukas Magel
2022-10-30 10:59   ` [PATCH v2 3/7] can: peak_usb: allow flashing of the user device id Lukas Magel
2022-10-30 10:59   ` [PATCH v2 4/7] can: peak_usb: replace unregister_netdev() with unregister_candev() Lukas Magel
2022-10-30 10:59   ` [PATCH v2 5/7] can: peak_usb: add ethtool interface to user defined flashed device number Lukas Magel
2022-10-30 10:59   ` [PATCH v2 6/7] can: peak_usb: export PCAN user device ID as sysfs device attribute Lukas Magel
2022-10-30 10:59   ` [PATCH v2 7/7] can: peak_usb: align user device id format in log with sysfs attribute Lukas Magel
2022-12-13  8:03 ` [PATCH v3 0/7] can: peak_usb: Introduce configurable CAN channel ID Lukas Magel
2022-12-13  8:03 ` [PATCH v3 1/8] can: peak_usb: rename device_id to " Lukas Magel
2022-12-13  8:03 ` [PATCH v3 2/8] can: peak_usb: add callback to read CAN channel ID of PEAK CAN-FD devices Lukas Magel
2022-12-13  8:03 ` [PATCH v3 3/8] can: peak_usb: allow flashing of the CAN channel ID Lukas Magel
2022-12-13  8:03 ` [PATCH v3 4/8] can: peak_usb: replace unregister_netdev() with unregister_candev() Lukas Magel
2022-12-13  8:03 ` [PATCH v3 5/8] can: peak_usb: add ethtool interface to user-configurable CAN channel identifier Lukas Magel
2022-12-13  8:03 ` [PATCH v3 6/8] can: peak_usb: export PCAN CAN channel ID as sysfs device attribute Lukas Magel
2022-12-13  8:03 ` [PATCH v3 7/8] can: peak_usb: align CAN channel ID format in log with sysfs attribute Lukas Magel
2022-12-13  8:03 ` [PATCH v3 8/8] can: peak_usb: Reorder include directives alphabetically Lukas Magel
2023-01-16 20:09 ` [RESEND PATCH v3 0/8] can: peak_usb: Introduce configurable CAN channel ID Lukas Magel
2023-01-16 20:09   ` [PATCH v3 1/8] can: peak_usb: rename device_id to " Lukas Magel
2023-01-16 20:09   ` [PATCH v3 2/8] can: peak_usb: add callback to read CAN channel ID of PEAK CAN-FD devices Lukas Magel
2023-01-16 20:09   ` [PATCH v3 3/8] can: peak_usb: allow flashing of the CAN channel ID Lukas Magel
2023-01-16 20:09   ` [PATCH v3 4/8] can: peak_usb: replace unregister_netdev() with unregister_candev() Lukas Magel
2023-01-16 20:09   ` [PATCH v3 5/8] can: peak_usb: add ethtool interface to user-configurable CAN channel identifier Lukas Magel
2023-01-16 20:09   ` [PATCH v3 6/8] can: peak_usb: export PCAN CAN channel ID as sysfs device attribute Lukas Magel
2023-01-16 20:09   ` [PATCH v3 7/8] can: peak_usb: align CAN channel ID format in log with sysfs attribute Lukas Magel
2023-01-16 20:09   ` [PATCH v3 8/8] can: peak_usb: Reorder include directives alphabetically Lukas Magel
2023-02-02 16:45   ` [RESEND PATCH v3 0/8] can: peak_usb: Introduce configurable CAN channel ID Marc Kleine-Budde

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=20221030105939.87658-2-lukas.magel@posteo.net \
    --to=lukas.magel@posteo.net \
    --cc=linux-can@vger.kernel.org \
    --cc=s.grosjean@peak-system.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).