From: Vincent Mailhol <hidden> Date: 2021-06-28 15:54:57
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
drivers/net/can/usb/etas_es58x/es581_4.c | 5 +-
drivers/net/can/usb/etas_es58x/es58x_core.c | 82 ++++++++++-----------
drivers/net/can/usb/etas_es58x/es58x_core.h | 2 +-
drivers/net/can/usb/etas_es58x/es58x_fd.c | 19 +++--
4 files changed, 51 insertions(+), 57 deletions(-)
--
2.31.1
From: Vincent Mailhol <hidden> Date: 2021-06-28 15:54:59
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 <redacted>
---
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(-)
@@ -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);
@@ -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-*themicrocontrollerdatasheet:"SAM E701/S70/V70/V71 Family"-*section49.6.8"MCAN Nominal Bit Timing and Prescaler Register"-*fromMicrochip.+*themicrocontrollerdatasheet:"SAM E70/S70/V70/V71 Family"section+*49.6.8"MCAN Nominal Bit Timing and Prescaler Register"from+*Microchip.**Thevaluesfromthespecificationarethehardwareregister*values.Toconvertthemtothefunctionalvalues,allrangeswere
@@ -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-*themicrocontrollerdatasheet:"SAM E701/S70/V70/V71 Family"-*section49.6.4"MCAN Data Bit Timing and Prescaler Register"from+*themicrocontrollerdatasheet:"SAM E70/S70/V70/V71 Family"section+*49.6.4"MCAN Data Bit Timing and Prescaler Register"from*Microchip.*/staticconststructcan_bittiming_constes58x_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-*asspecifiedinthemicrocontrollerdatasheet:"SAM-*E701/S70/V70/V71Family" section 49.6.15 "MCANTransmitterDelay-*CompensationRegister" from Microchip.+*asspecifiedinthemicrocontrollerdatasheet:"SAM E70/S70/V70/V71+*Family" section 49.6.15 "MCANTransmitterDelayCompensation+*Register" from Microchip.*/staticconststructcan_tdc_constes58x_tdc_const={.tdcv_min=0,
From: Vincent Mailhol <hidden> Date: 2021-06-28 15:55:06
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 <redacted>
---
drivers/net/can/usb/etas_es58x/es58x_core.c | 23 +++++++++------------
1 file changed, 10 insertions(+), 13 deletions(-)
From: Vincent Mailhol <hidden> Date: 2021-06-28 15:55:12
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 <redacted>
---
drivers/net/can/usb/etas_es58x/es58x_core.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
From: Vincent Mailhol <hidden> Date: 2021-06-28 15:55:19
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 <redacted>
---
drivers/net/can/usb/etas_es58x/es58x_core.c | 46 +++++++++++----------
1 file changed, 24 insertions(+), 22 deletions(-)
From: Vincent Mailhol <hidden> Date: 2021-06-28 15:55:20
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 <redacted>
---
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(-)
From: Vincent Mailhol <hidden> Date: 2021-06-28 15:55:26
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 <redacted>
---
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(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-14 19:31:07
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 |
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-07-24 21:23:05
On 29.06.2021 00:54:18, Vincent Mailhol wrote:
quoted hunk
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 <redacted>
---
drivers/net/can/usb/etas_es58x/es58x_core.c | 46 +++++++++++----------
1 file changed, 24 insertions(+), 22 deletions(-)