* [PATCH 1/6] can: etas_es58x: fix three typos in author name and documentation
2021-06-28 15:54 [PATCH 0/6] Miscellaneous small fix and improvements on driver etas_es58x Vincent Mailhol
@ 2021-06-28 15:54 ` Vincent Mailhol
2021-06-28 15:54 ` [PATCH 2/6] can: etas_es58x: use error pointer during device probing Vincent Mailhol
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Vincent Mailhol @ 2021-06-28 15:54 UTC (permalink / raw)
To: Marc Kleine-Budde, linux-can; +Cc: Vincent Mailhol
Change the author name from "lastname firstname" to "firstname
lastname".
Fix a typo in a variable name in the documentation of struct
es58x_parameters::fifo_mask.
Fix a typo in the title of the datasheet (E701 -> E70) and re-indent
the comments.
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
drivers/net/can/usb/etas_es58x/es58x_core.c | 2 +-
drivers/net/can/usb/etas_es58x/es58x_core.h | 2 +-
drivers/net/can/usb/etas_es58x/es58x_fd.c | 16 ++++++++--------
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c
index 8e9102482c52..4758f793627a 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_core.c
+++ b/drivers/net/can/usb/etas_es58x/es58x_core.c
@@ -19,7 +19,7 @@
#include "es58x_core.h"
#define DRV_VERSION "1.00"
-MODULE_AUTHOR("Mailhol Vincent <mailhol.vincent@wanadoo.fr>");
+MODULE_AUTHOR("Vincent Mailhol <mailhol.vincent@wanadoo.fr>");
MODULE_AUTHOR("Arunachalam Santhanam <arunachalam.santhanam@in.bosch.com>");
MODULE_DESCRIPTION("Socket CAN driver for ETAS ES58X USB adapters");
MODULE_VERSION(DRV_VERSION);
diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.h b/drivers/net/can/usb/etas_es58x/es58x_core.h
index fcf219e727bf..826a15871573 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_core.h
+++ b/drivers/net/can/usb/etas_es58x/es58x_core.h
@@ -287,7 +287,7 @@ struct es58x_priv {
* @rx_urb_cmd_max_len: Maximum length of a RX URB command.
* @fifo_mask: Bit mask to quickly convert the tx_tail and tx_head
* field of the struct es58x_priv into echo_skb
- * indexes. Properties: @fifo_mask = echos_skb_max - 1 where
+ * indexes. Properties: @fifo_mask = echo_skb_max - 1 where
* echo_skb_max must be a power of two. Also, echo_skb_max must
* not exceed the maximum size of the device internal TX FIFO
* length. This parameter is used to control the network queue
diff --git a/drivers/net/can/usb/etas_es58x/es58x_fd.c b/drivers/net/can/usb/etas_es58x/es58x_fd.c
index 15652132e315..f19022ca8f25 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_fd.c
+++ b/drivers/net/can/usb/etas_es58x/es58x_fd.c
@@ -463,9 +463,9 @@ static int es58x_fd_get_timestamp(struct es58x_device *es58x_dev)
}
/* Nominal bittiming constants for ES582.1 and ES584.1 as specified in
- * the microcontroller datasheet: "SAM E701/S70/V70/V71 Family"
- * section 49.6.8 "MCAN Nominal Bit Timing and Prescaler Register"
- * from Microchip.
+ * the microcontroller datasheet: "SAM E70/S70/V70/V71 Family" section
+ * 49.6.8 "MCAN Nominal Bit Timing and Prescaler Register" from
+ * Microchip.
*
* The values from the specification are the hardware register
* values. To convert them to the functional values, all ranges were
@@ -484,8 +484,8 @@ static const struct can_bittiming_const es58x_fd_nom_bittiming_const = {
};
/* Data bittiming constants for ES582.1 and ES584.1 as specified in
- * the microcontroller datasheet: "SAM E701/S70/V70/V71 Family"
- * section 49.6.4 "MCAN Data Bit Timing and Prescaler Register" from
+ * the microcontroller datasheet: "SAM E70/S70/V70/V71 Family" section
+ * 49.6.4 "MCAN Data Bit Timing and Prescaler Register" from
* Microchip.
*/
static const struct can_bittiming_const es58x_fd_data_bittiming_const = {
@@ -501,9 +501,9 @@ static const struct can_bittiming_const es58x_fd_data_bittiming_const = {
};
/* Transmission Delay Compensation constants for ES582.1 and ES584.1
- * as specified in the microcontroller datasheet: "SAM
- * E701/S70/V70/V71 Family" section 49.6.15 "MCAN Transmitter Delay
- * Compensation Register" from Microchip.
+ * as specified in the microcontroller datasheet: "SAM E70/S70/V70/V71
+ * Family" section 49.6.15 "MCAN Transmitter Delay Compensation
+ * Register" from Microchip.
*/
static const struct can_tdc_const es58x_tdc_const = {
.tdcv_min = 0,
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/6] can: etas_es58x: use error pointer during device probing
2021-06-28 15:54 [PATCH 0/6] Miscellaneous small fix and improvements on driver etas_es58x Vincent Mailhol
2021-06-28 15:54 ` [PATCH 1/6] can: etas_es58x: fix three typos in author name and documentation Vincent Mailhol
@ 2021-06-28 15:54 ` Vincent Mailhol
2021-06-28 15:54 ` [PATCH 3/6] can: etas_es58x: use devm_kzalloc() to allocate device resources Vincent Mailhol
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Vincent Mailhol @ 2021-06-28 15:54 UTC (permalink / raw)
To: Marc Kleine-Budde, linux-can; +Cc: Vincent Mailhol
Make es58x_init_es58x_dev return a pointer to the allocated structure
instead of returning an integer. Errors are handled through the helper
function ERR_PTR and IS_ERR.
This slightly simplifies the code.
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
drivers/net/can/usb/etas_es58x/es58x_core.c | 23 +++++++++------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c
index 4758f793627a..7650e349cae1 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_core.c
+++ b/drivers/net/can/usb/etas_es58x/es58x_core.c
@@ -2152,14 +2152,13 @@ static int es58x_get_product_info(struct es58x_device *es58x_dev)
/**
* es58x_init_es58x_dev() - Initialize the ES58X device.
* @intf: USB interface.
- * @p_es58x_dev: pointer to the address of the ES58X device.
* @driver_info: Quirks of the device.
*
- * Return: zero on success, errno when any error occurs.
+ * Return: pointer to an ES58X device on success, error pointer when
+ * any error occurs.
*/
-static int es58x_init_es58x_dev(struct usb_interface *intf,
- struct es58x_device **p_es58x_dev,
- kernel_ulong_t driver_info)
+static struct es58x_device *es58x_init_es58x_dev(struct usb_interface *intf,
+ kernel_ulong_t driver_info)
{
struct device *dev = &intf->dev;
struct es58x_device *es58x_dev;
@@ -2176,7 +2175,7 @@ static int es58x_init_es58x_dev(struct usb_interface *intf,
ret = usb_find_common_endpoints(intf->cur_altsetting, &ep_in, &ep_out,
NULL, NULL);
if (ret)
- return ret;
+ return ERR_PTR(ret);
if (driver_info & ES58X_FD_FAMILY) {
param = &es58x_fd_param;
@@ -2188,7 +2187,7 @@ static int es58x_init_es58x_dev(struct usb_interface *intf,
es58x_dev = kzalloc(es58x_sizeof_es58x_device(param), GFP_KERNEL);
if (!es58x_dev)
- return -ENOMEM;
+ return ERR_PTR(-ENOMEM);
es58x_dev->param = param;
es58x_dev->ops = ops;
@@ -2213,9 +2212,7 @@ static int es58x_init_es58x_dev(struct usb_interface *intf,
ep_out->bEndpointAddress);
es58x_dev->rx_max_packet_size = le16_to_cpu(ep_in->wMaxPacketSize);
- *p_es58x_dev = es58x_dev;
-
- return 0;
+ return es58x_dev;
}
/**
@@ -2232,9 +2229,9 @@ static int es58x_probe(struct usb_interface *intf,
struct es58x_device *es58x_dev;
int ch_idx, ret;
- ret = es58x_init_es58x_dev(intf, &es58x_dev, id->driver_info);
- if (ret)
- return ret;
+ es58x_dev = es58x_init_es58x_dev(intf, id->driver_info);
+ if (IS_ERR(es58x_dev))
+ return PTR_ERR(es58x_dev);
ret = es58x_get_product_info(es58x_dev);
if (ret)
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/6] can: etas_es58x: use devm_kzalloc() to allocate device resources
2021-06-28 15:54 [PATCH 0/6] Miscellaneous small fix and improvements on driver etas_es58x Vincent Mailhol
2021-06-28 15:54 ` [PATCH 1/6] can: etas_es58x: fix three typos in author name and documentation Vincent Mailhol
2021-06-28 15:54 ` [PATCH 2/6] can: etas_es58x: use error pointer during device probing Vincent Mailhol
@ 2021-06-28 15:54 ` Vincent Mailhol
2021-06-28 15:54 ` [PATCH 4/6] can: etas_es58x: add es58x_free_netdevs() to factorize code Vincent Mailhol
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Vincent Mailhol @ 2021-06-28 15:54 UTC (permalink / raw)
To: Marc Kleine-Budde, linux-can; +Cc: Vincent Mailhol
Replace kzalloc() with devm_kzalloc(). By doing this, we do not need
to care anymore about having to call kfree(). This result in a
simpler and more easy to read code.
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
drivers/net/can/usb/etas_es58x/es58x_core.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c
index 7650e349cae1..d2bb1b56f962 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_core.c
+++ b/drivers/net/can/usb/etas_es58x/es58x_core.c
@@ -2185,7 +2185,8 @@ static struct es58x_device *es58x_init_es58x_dev(struct usb_interface *intf,
ops = &es581_4_ops;
}
- es58x_dev = kzalloc(es58x_sizeof_es58x_device(param), GFP_KERNEL);
+ es58x_dev = devm_kzalloc(dev, es58x_sizeof_es58x_device(param),
+ GFP_KERNEL);
if (!es58x_dev)
return ERR_PTR(-ENOMEM);
@@ -2235,7 +2236,7 @@ static int es58x_probe(struct usb_interface *intf,
ret = es58x_get_product_info(es58x_dev);
if (ret)
- goto cleanup_es58x_dev;
+ return ret;
for (ch_idx = 0; ch_idx < es58x_dev->num_can_ch; ch_idx++) {
ret = es58x_init_netdev(es58x_dev, ch_idx);
@@ -2251,8 +2252,6 @@ static int es58x_probe(struct usb_interface *intf,
unregister_candev(es58x_dev->netdev[ch_idx]);
free_candev(es58x_dev->netdev[ch_idx]);
}
- cleanup_es58x_dev:
- kfree(es58x_dev);
return ret;
}
@@ -2283,8 +2282,6 @@ static void es58x_disconnect(struct usb_interface *intf)
}
es58x_free_urbs(es58x_dev);
-
- kfree(es58x_dev);
usb_set_intfdata(intf, NULL);
}
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/6] can: etas_es58x: add es58x_free_netdevs() to factorize code
2021-06-28 15:54 [PATCH 0/6] Miscellaneous small fix and improvements on driver etas_es58x Vincent Mailhol
` (2 preceding siblings ...)
2021-06-28 15:54 ` [PATCH 3/6] can: etas_es58x: use devm_kzalloc() to allocate device resources Vincent Mailhol
@ 2021-06-28 15:54 ` Vincent Mailhol
2021-07-24 21:22 ` Marc Kleine-Budde
2021-06-28 15:54 ` [PATCH 5/6] can: etas_es58x: use sizeof and sizeof_field macros instead of constant values Vincent Mailhol
` (2 subsequent siblings)
6 siblings, 1 reply; 9+ messages in thread
From: Vincent Mailhol @ 2021-06-28 15:54 UTC (permalink / raw)
To: Marc Kleine-Budde, linux-can; +Cc: Vincent Mailhol
Both es58x_probe() and es58x_disconnect() use a similar code snippet
to release the netdev resources. Factorize it in an helper function
named es58x_free_netdevs().
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
drivers/net/can/usb/etas_es58x/es58x_core.c | 46 +++++++++++----------
1 file changed, 24 insertions(+), 22 deletions(-)
diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c
index d2bb1b56f962..dbc4f75336a1 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_core.c
+++ b/drivers/net/can/usb/etas_es58x/es58x_core.c
@@ -2107,6 +2107,25 @@ static int es58x_init_netdev(struct es58x_device *es58x_dev, int channel_idx)
return ret;
}
+/**
+ * es58x_free_netdevs() - Release all network resorces of the device.
+ * @es58x_dev: ES58X device.
+ */
+static void es58x_free_netdevs(struct es58x_device *es58x_dev)
+{
+ int i;
+
+ for (i = 0; i < es58x_dev->num_can_ch; i++) {
+ struct net_device *netdev = es58x_dev->netdev[i];
+
+ if (!netdev)
+ continue;
+ unregister_candev(netdev);
+ es58x_dev->netdev[i] = NULL;
+ free_candev(netdev);
+ }
+}
+
/**
* es58x_get_product_info() - Get the product information and print them.
* @es58x_dev: ES58X device.
@@ -2240,18 +2259,11 @@ static int es58x_probe(struct usb_interface *intf,
for (ch_idx = 0; ch_idx < es58x_dev->num_can_ch; ch_idx++) {
ret = es58x_init_netdev(es58x_dev, ch_idx);
- if (ret)
- goto cleanup_candev;
- }
-
- return ret;
-
- cleanup_candev:
- for (ch_idx = 0; ch_idx < es58x_dev->num_can_ch; ch_idx++)
- if (es58x_dev->netdev[ch_idx]) {
- unregister_candev(es58x_dev->netdev[ch_idx]);
- free_candev(es58x_dev->netdev[ch_idx]);
+ if (ret) {
+ es58x_free_netdevs(es58x_dev);
+ return ret;
}
+ }
return ret;
}
@@ -2266,21 +2278,11 @@ static int es58x_probe(struct usb_interface *intf,
static void es58x_disconnect(struct usb_interface *intf)
{
struct es58x_device *es58x_dev = usb_get_intfdata(intf);
- struct net_device *netdev;
- int i;
dev_info(&intf->dev, "Disconnecting %s %s\n",
es58x_dev->udev->manufacturer, es58x_dev->udev->product);
- for (i = 0; i < es58x_dev->num_can_ch; i++) {
- netdev = es58x_dev->netdev[i];
- if (!netdev)
- continue;
- unregister_candev(netdev);
- es58x_dev->netdev[i] = NULL;
- free_candev(netdev);
- }
-
+ es58x_free_netdevs(es58x_dev);
es58x_free_urbs(es58x_dev);
usb_set_intfdata(intf, NULL);
}
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 4/6] can: etas_es58x: add es58x_free_netdevs() to factorize code
2021-06-28 15:54 ` [PATCH 4/6] can: etas_es58x: add es58x_free_netdevs() to factorize code Vincent Mailhol
@ 2021-07-24 21:22 ` Marc Kleine-Budde
0 siblings, 0 replies; 9+ messages in thread
From: Marc Kleine-Budde @ 2021-07-24 21:22 UTC (permalink / raw)
To: Vincent Mailhol; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 1258 bytes --]
On 29.06.2021 00:54:18, Vincent Mailhol wrote:
> Both es58x_probe() and es58x_disconnect() use a similar code snippet
> to release the netdev resources. Factorize it in an helper function
> named es58x_free_netdevs().
>
> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> ---
> drivers/net/can/usb/etas_es58x/es58x_core.c | 46 +++++++++++----------
> 1 file changed, 24 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c
> index d2bb1b56f962..dbc4f75336a1 100644
> --- a/drivers/net/can/usb/etas_es58x/es58x_core.c
> +++ b/drivers/net/can/usb/etas_es58x/es58x_core.c
> @@ -2107,6 +2107,25 @@ static int es58x_init_netdev(struct es58x_device *es58x_dev, int channel_idx)
> return ret;
> }
>
> +/**
> + * es58x_free_netdevs() - Release all network resorces of the device.
^^^^^^^^
fixed typo
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 5/6] can: etas_es58x: use sizeof and sizeof_field macros instead of constant values
2021-06-28 15:54 [PATCH 0/6] Miscellaneous small fix and improvements on driver etas_es58x Vincent Mailhol
` (3 preceding siblings ...)
2021-06-28 15:54 ` [PATCH 4/6] can: etas_es58x: add es58x_free_netdevs() to factorize code Vincent Mailhol
@ 2021-06-28 15:54 ` Vincent Mailhol
2021-06-28 15:54 ` [PATCH 6/6] can: etas_es58x: rewrite the message cast in es58{1,_fd}_tx_can_msg to increase readability Vincent Mailhol
2021-07-14 19:31 ` [PATCH 0/6] Miscellaneous small fix and improvements on driver etas_es58x Marc Kleine-Budde
6 siblings, 0 replies; 9+ messages in thread
From: Vincent Mailhol @ 2021-06-28 15:54 UTC (permalink / raw)
To: Marc Kleine-Budde, linux-can; +Cc: Vincent Mailhol
Replace two constant values by a call to sizeof{,_field} on the
relevant field to make the logic easier to understand.
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
drivers/net/can/usb/etas_es58x/es581_4.c | 2 +-
drivers/net/can/usb/etas_es58x/es58x_core.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/usb/etas_es58x/es581_4.c b/drivers/net/can/usb/etas_es58x/es581_4.c
index 1985f772fc3c..88dbfe41ba85 100644
--- a/drivers/net/can/usb/etas_es58x/es581_4.c
+++ b/drivers/net/can/usb/etas_es58x/es581_4.c
@@ -355,7 +355,7 @@ static int es581_4_tx_can_msg(struct es58x_priv *priv,
return -EMSGSIZE;
if (priv->tx_can_msg_cnt == 0) {
- msg_len = 1; /* struct es581_4_bulk_tx_can_msg:num_can_msg */
+ msg_len = sizeof(es581_4_urb_cmd->bulk_tx_can_msg.num_can_msg);
es581_4_fill_urb_header(urb_cmd, ES581_4_CAN_COMMAND_TYPE,
ES581_4_CMD_ID_TX_MSG,
priv->channel_idx, msg_len);
diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c
index dbc4f75336a1..49a32c1e6f27 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_core.c
+++ b/drivers/net/can/usb/etas_es58x/es58x_core.c
@@ -70,7 +70,7 @@ MODULE_DEVICE_TABLE(usb, es58x_id_table);
* bytes (the start of frame) are skipped and the CRC calculation
* starts on the third byte.
*/
-#define ES58X_CRC_CALC_OFFSET 2
+#define ES58X_CRC_CALC_OFFSET sizeof_field(union es58x_urb_cmd, sof)
/**
* es58x_calculate_crc() - Compute the crc16 of a given URB.
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6/6] can: etas_es58x: rewrite the message cast in es58{1,_fd}_tx_can_msg to increase readability
2021-06-28 15:54 [PATCH 0/6] Miscellaneous small fix and improvements on driver etas_es58x Vincent Mailhol
` (4 preceding siblings ...)
2021-06-28 15:54 ` [PATCH 5/6] can: etas_es58x: use sizeof and sizeof_field macros instead of constant values Vincent Mailhol
@ 2021-06-28 15:54 ` Vincent Mailhol
2021-07-14 19:31 ` [PATCH 0/6] Miscellaneous small fix and improvements on driver etas_es58x Marc Kleine-Budde
6 siblings, 0 replies; 9+ messages in thread
From: Vincent Mailhol @ 2021-06-28 15:54 UTC (permalink / raw)
To: Marc Kleine-Budde, linux-can; +Cc: Vincent Mailhol
The es581_tx_can_msg() does below cast:
| tx_can_msg = (struct es581_4_tx_can_msg *)
| &es581_4_urb_cmd->bulk_tx_can_msg.tx_can_msg_buf[msg_len - 1];
The -1 offset is to skip the first member of struct
es581_4_tx_can_msg. However, es581_4_urb_cmd already has a raw_msg
field which can be used instead without the use of an offset
calculation.
The function es58x_fd_tx_can_msg() is also modified to mirror
es581_tx_can_msg().
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
drivers/net/can/usb/etas_es58x/es581_4.c | 3 +--
drivers/net/can/usb/etas_es58x/es58x_fd.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/can/usb/etas_es58x/es581_4.c b/drivers/net/can/usb/etas_es58x/es581_4.c
index 88dbfe41ba85..14e360c9f2c9 100644
--- a/drivers/net/can/usb/etas_es58x/es581_4.c
+++ b/drivers/net/can/usb/etas_es58x/es581_4.c
@@ -371,8 +371,7 @@ static int es581_4_tx_can_msg(struct es58x_priv *priv,
return ret;
/* Fill message contents. */
- tx_can_msg = (struct es581_4_tx_can_msg *)
- &es581_4_urb_cmd->bulk_tx_can_msg.tx_can_msg_buf[msg_len - 1];
+ tx_can_msg = (typeof(tx_can_msg))&es581_4_urb_cmd->raw_msg[msg_len];
put_unaligned_le32(es58x_get_raw_can_id(cf), &tx_can_msg->can_id);
put_unaligned_le32(priv->tx_head, &tx_can_msg->packet_idx);
put_unaligned_le16((u16)es58x_get_flags(skb), &tx_can_msg->flags);
diff --git a/drivers/net/can/usb/etas_es58x/es58x_fd.c b/drivers/net/can/usb/etas_es58x/es58x_fd.c
index f19022ca8f25..4f0cae29f4d8 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_fd.c
+++ b/drivers/net/can/usb/etas_es58x/es58x_fd.c
@@ -357,8 +357,7 @@ static int es58x_fd_tx_can_msg(struct es58x_priv *priv,
return ret;
/* Fill message contents. */
- tx_can_msg = (struct es58x_fd_tx_can_msg *)
- &es58x_fd_urb_cmd->tx_can_msg_buf[msg_len];
+ tx_can_msg = (typeof(tx_can_msg))&es58x_fd_urb_cmd->raw_msg[msg_len];
tx_can_msg->packet_idx = (u8)priv->tx_head;
put_unaligned_le32(es58x_get_raw_can_id(cf), &tx_can_msg->can_id);
tx_can_msg->flags = (u8)es58x_get_flags(skb);
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 0/6] Miscellaneous small fix and improvements on driver etas_es58x
2021-06-28 15:54 [PATCH 0/6] Miscellaneous small fix and improvements on driver etas_es58x Vincent Mailhol
` (5 preceding siblings ...)
2021-06-28 15:54 ` [PATCH 6/6] can: etas_es58x: rewrite the message cast in es58{1,_fd}_tx_can_msg to increase readability Vincent Mailhol
@ 2021-07-14 19:31 ` Marc Kleine-Budde
6 siblings, 0 replies; 9+ messages in thread
From: Marc Kleine-Budde @ 2021-07-14 19:31 UTC (permalink / raw)
To: Vincent Mailhol; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 1036 bytes --]
On 29.06.2021 00:54:14, Vincent Mailhol wrote:
> This series fixes some issues on etas_es58x and add a few improvement,
> mostly on the code readability (i.e. no new features nor functional
> changes in this series).
>
> Vincent Mailhol (6):
> can: etas_es58x: fix three typos in author name and documentation
> can: etas_es58x: use error pointer during device probing
> can: etas_es58x: use devm_kzalloc() to allocate device resources
> can: etas_es58x: add es58x_free_netdevs() to factorize code
> can: etas_es58x: use sizeof and sizeof_field macros instead of
> constant values
> can: etas_es58x: rewrite the message cast in es58{1,_fd}_tx_can_msg to
> increase readability
Added to linux-can-next/testing
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread