From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Stephane Grosjean <s.grosjean@peak-system.com>
Cc: linux-can Mailing List <linux-can@vger.kernel.org>
Subject: Re: [PATCH 2/6] can: peak_usb: add callback to read user value of CANFD devices
Date: Sat, 29 Jan 2022 14:48:32 +0100 [thread overview]
Message-ID: <20220129134832.ig44ibvgcokj6g77@pengutronix.de> (raw)
In-Reply-To: <20220128150157.1222850-3-s.grosjean@peak-system.com>
[-- Attachment #1: Type: text/plain, Size: 1740 bytes --]
On 28.01.2022 16:01:53, Stephane Grosjean wrote:
> This patch adds the specific function that allows to read a user defined
> value from the non volatile memory of the USB CANFD interfaces of
> PEAK-System.
>
> Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
> ---
> drivers/net/can/usb/peak_usb/pcan_usb_fd.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> 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 65487ec33566..ab1a8b797ece 100644
> --- a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
> +++ b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
> @@ -420,6 +420,24 @@ static int pcan_usb_fd_set_bittiming_fast(struct peak_usb_device *dev,
> return pcan_usb_fd_send_cmd(dev, ++cmd);
> }
>
> +/* read user device id from device */
> +static int pcan_usb_fd_get_user_devid(struct peak_usb_device *dev,
> + u32 *device_id)
> +{
> + struct pcan_usb_fd_device *pdev =
> + container_of(dev, struct pcan_usb_fd_device, dev);
> + struct pcan_ufd_fw_info *fw_info = &pdev->usb_if->fw_info;
> + int err;
> +
> + err = pcan_usb_pro_send_req(dev, PCAN_USBPRO_REQ_INFO,
> + PCAN_USBPRO_INFO_FW,
> + fw_info, sizeof(*fw_info));
> + if (!err)
> + *device_id = le32_to_cpu(fw_info->dev_id[dev->ctrl_idx]);
Nitpick: please use the more common return on error:
if (err)
return err;
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 --]
next prev parent reply other threads:[~2022-01-29 13:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-28 15:01 [PATCH 0/6] can: peak_usb: add ethtool interface to flashed value Stephane Grosjean
2022-01-28 15:01 ` [PATCH 1/6] can: peak_usb: rename a callback to a more explicit name Stephane Grosjean
2022-01-28 15:01 ` [PATCH 2/6] can: peak_usb: add callback to read user value of CANFD devices Stephane Grosjean
2022-01-29 13:48 ` Marc Kleine-Budde [this message]
2022-01-28 15:01 ` [PATCH 3/6] can: peak_usb: correction of a wrong field name Stephane Grosjean
2022-01-28 15:01 ` [PATCH 4/6] can: peak_usb: allow flashing of user defined value Stephane Grosjean
2022-01-29 13:53 ` Marc Kleine-Budde
2022-01-28 15:01 ` [PATCH 5/6] can: peak_usb: replace unregister_netdev() with unregister_candev() Stephane Grosjean
2022-01-28 15:01 ` [PATCH 6/6] can: peak_usb: add ethtool interface to user defined flashed device number Stephane Grosjean
2022-01-29 13:58 ` Marc Kleine-Budde
-- strict thread matches above, loose matches on Subject: below --
2021-11-17 15:01 [PATCH 0/6] can: peak_usb: add sysfs interface to flashed value Stephane Grosjean
2021-11-17 15:01 ` [PATCH 2/6] can: peak_usb: add callback to read user value of CANFD devices Stephane Grosjean
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=20220129134832.ig44ibvgcokj6g77@pengutronix.de \
--to=mkl@pengutronix.de \
--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).