Linux CAN drivers development
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: linux-can@vger.kernel.org
Cc: Jeroen Hofstee <jhofstee@victronenergy.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH 2/6] can: gs_usb: gs_can_open(): sort checks for ctrlmode
Date: Thu,  6 Oct 2022 18:24:48 +0200	[thread overview]
Message-ID: <20221006162452.200322-3-mkl@pengutronix.de> (raw)
In-Reply-To: <20221006162452.200322-1-mkl@pengutronix.de>

Sort the checks for dev->can.ctrlmode by values of CAN_CTRLMODE_*, so
that it's clear where to add new checks.

While there, remove the comment that the Atmel UC3C hardware doesn't
support One Shot Mode. One Shot Mode is only available to be activated
by the user, if the device specifies the GS_CAN_FEATURE_ONE_SHOT.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/usb/gs_usb.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c
index 53293086faf0..57daf46b2aec 100644
--- a/drivers/net/can/usb/gs_usb.c
+++ b/drivers/net/can/usb/gs_usb.c
@@ -843,8 +843,6 @@ static int gs_can_open(struct net_device *netdev)
 
 	ctrlmode = dev->can.ctrlmode;
 	if (ctrlmode & CAN_CTRLMODE_FD) {
-		flags |= GS_CAN_MODE_FD;
-
 		if (dev->feature & GS_CAN_FEATURE_REQ_USB_QUIRK_LPC546XX)
 			dev->hf_size_tx = struct_size(hf, canfd_quirk, 1);
 		else
@@ -915,14 +913,14 @@ static int gs_can_open(struct net_device *netdev)
 	if (ctrlmode & CAN_CTRLMODE_LISTENONLY)
 		flags |= GS_CAN_MODE_LISTEN_ONLY;
 
-	/* Controller is not allowed to retry TX
-	 * this mode is unavailable on atmels uc3c hardware
-	 */
+	if (ctrlmode & CAN_CTRLMODE_3_SAMPLES)
+		flags |= GS_CAN_MODE_TRIPLE_SAMPLE;
+
 	if (ctrlmode & CAN_CTRLMODE_ONE_SHOT)
 		flags |= GS_CAN_MODE_ONE_SHOT;
 
-	if (ctrlmode & CAN_CTRLMODE_3_SAMPLES)
-		flags |= GS_CAN_MODE_TRIPLE_SAMPLE;
+	if (ctrlmode & CAN_CTRLMODE_FD)
+		flags |= GS_CAN_MODE_FD;
 
 	/* if hardware supports timestamps, enable it */
 	if (dev->feature & GS_CAN_FEATURE_HW_TIMESTAMP)
-- 
2.35.1



  parent reply	other threads:[~2022-10-06 16:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 16:24 [PATCH 0/6] can: gs_usb: new features: GS_CAN_FEATURE_GET_STATE, GS_CAN_FEATURE_BERR_REPORTING Marc Kleine-Budde
2022-10-06 16:24 ` [PATCH 1/6] can: gs_usb: gs_can_open(): allow loopback and listen only at the same time Marc Kleine-Budde
2022-10-06 16:24 ` Marc Kleine-Budde [this message]
2022-10-06 16:24 ` [PATCH 3/6] can: gs_usb: gs_can_open(): merge setting of timestamp flags and init Marc Kleine-Budde
2022-10-06 16:24 ` [PATCH 4/6] can: gs_usb: add ability to enable / disable berr rerporting Marc Kleine-Budde
2022-10-06 16:36   ` Marc Kleine-Budde
2022-10-07 18:30     ` Jeroen Hofstee
2022-10-08 15:39       ` Jeroen Hofstee
2022-10-10  7:00       ` Marc Kleine-Budde
2022-10-08 22:11     ` Jeroen Hofstee
2022-10-10  7:03       ` Marc Kleine-Budde
2022-10-06 16:24 ` [PATCH 5/6] can: gs_usb: document GS_CAN_FEATURE_GET_STATE Marc Kleine-Budde
2022-10-06 16:24 ` [PATCH 6/6] can: gs_usb: support reading error counters Marc Kleine-Budde
2022-10-06 16:37   ` Marc Kleine-Budde
2022-10-06 16:28 ` [PATCH 0/6] can: gs_usb: new features: GS_CAN_FEATURE_GET_STATE, GS_CAN_FEATURE_BERR_REPORTING Marc Kleine-Budde
2022-10-07 18:59   ` Jeroen Hofstee
2022-10-10  6:30     ` Marc Kleine-Budde
2022-10-07 18:46 ` Jeroen Hofstee

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=20221006162452.200322-3-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=jhofstee@victronenergy.com \
    --cc=linux-can@vger.kernel.org \
    /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