From: Rakuram Eswaran <rakuram.e96@gmail.com>
To: mailhol@kernel.org
Cc: linux-can@vger.kernel.org, linux-kernel@vger.kernel.org,
mkl@pengutronix.de, rakuram.e96@gmail.com,
socketcan@hartkopp.net
Subject: Re: [RFC PATCH 1/2] can: dummy_can: add CAN termination support
Date: Thu, 25 Dec 2025 12:58:54 +0530 [thread overview]
Message-ID: <20251225072857.53085-1-rakuram.e96@gmail.com> (raw)
In-Reply-To: a85b8659-d4c8-443b-abb1-ae557a2a9896@kernel.org
Hi Vincent,
Thank you for the review and the detailed feedback.
On Wed, 24 Dec 2025 at 03:03, Vincent Mailhol <mailhol@kernel.org> wrote:
>
> Hi Rakuram,
>
> Thanks for the patch. My comments are only on the cosmetic aspect.
>
> Le 27/11/2025 à 20:18, Rakuram Eswaran a écrit :
> > Add support for configuring bus termination in the dummy_can driver.
> > This allows users to emulate a properly terminated CAN bus when
> > setting up virtual test environments.
> >
> > Signed-off-by: Rakuram Eswaran <rakuram.e96@gmail.com>
> > ---
> > Tested the termination setting using below iproute commands:
> >
> > ip link set can0 type can termination 120
> > ip link set can0 type can termination off
>
> When you test, do not forget to also try incorrect values ;)
>
> ip link set can0 type can termination 100
Noted. I did test with invalid numeric values and observed that
they were ignored.
> ip link set can0 type can termination potato
Good point — I had not explicitly tested non-numeric inputs.
I will verify this case as well.
>
> (I think that the code is correct, just see this as a generic
> comment).
>
> > drivers/net/can/dummy_can.c | 21 +++++++++++++++++++++
> > 1 file changed, 21 insertions(+)
> >
> > diff --git a/drivers/net/can/dummy_can.c b/drivers/net/can/dummy_can.c
> > index 41953655e3d3..2949173547e6 100644
> > --- a/drivers/net/can/dummy_can.c
> > +++ b/drivers/net/can/dummy_can.c
> > @@ -23,6 +23,21 @@ struct dummy_can {
> >
> > static struct dummy_can *dummy_can;
> >
> > +static const u16 dummy_can_termination_const[] = {
> > + CAN_TERMINATION_DISABLED, /* 0 = off */
> > + 120, /* 120 Ohms */
> > +};
> > +
> > +static int dummy_can_set_termination(struct net_device *dev, u16 term)
> > +{
> > + struct dummy_can *priv = netdev_priv(dev);
> > +
> > + netdev_dbg(dev, "set termination to %u Ohms\n", term);
> > + priv->can.termination = term;
> > +
> > + return 0;
> > +}
>
> The driver has a kind of structure:
>
> - first the const bittiming struct declarations
> - then the dummy_can_print_*() functions
> - finally the actual code
>
> Try to preserve this structure when adding your changes.
Acknowledged. I will reorder the termination-related additions to match
the existing structure in the next revision.
>
> > static const struct can_bittiming_const dummy_can_bittiming_const = {
> > .name = "dummy_can CC",
> > .tseg1_min = 2,
> > @@ -250,6 +265,12 @@ static int __init dummy_can_init(void)
> > priv->can.xl.data_bittiming_const = &dummy_can_xl_databittiming_const;
> > priv->can.xl.tdc_const = &dummy_can_xl_tdc_const;
> > priv->can.xl.pwm_const = &dummy_can_pwm_const;
> > +
> > + /* Advertise software termination support */
>
> This comment doesn't add much value. You may omit it.
>
Ack. Will remove it.
> > + priv->can.termination_const = dummy_can_termination_const;
> > + priv->can.termination_const_cnt = ARRAY_SIZE(dummy_can_termination_const);
> > + priv->can.do_set_termination = dummy_can_set_termination;
>
> Here also try to maintain so kind of order: your declaration of
> dummy_can_termination_const is before the other const struct
> declarations, but the priv->can assignment is done after the other
> assignments. Not a big deal but it is nicer to keep the declaration
> and the assignments in the same order.
>
Ack. I will align the declaration and the corresponding assignments to
keep the ordering consistent.
I will address these points and send an updated version. Is it okay to send
the next version without the RFC tag?
Best Regards,
Rakuram
next prev parent reply other threads:[~2025-12-25 7:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-27 19:18 [RFC PATCH 0/2] can: add dummy_can termination and update SocketCAN docs for CAN XL Rakuram Eswaran
2025-11-27 19:18 ` [RFC PATCH 1/2] can: dummy_can: add CAN termination support Rakuram Eswaran
2025-12-23 21:33 ` Vincent Mailhol
2025-12-25 7:28 ` Rakuram Eswaran [this message]
2025-12-25 11:10 ` Vincent Mailhol
2025-11-27 19:18 ` [RFC PATCH 2/2] docs: can: update SocketCAN documentation for CAN XL Rakuram Eswaran
2025-12-08 14:19 ` [RFC PATCH 0/2] can: add dummy_can termination and update SocketCAN docs " Rakuram Eswaran
2025-12-09 16:17 ` Oliver Hartkopp
2025-12-18 16:06 ` Rakuram Eswaran
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=20251225072857.53085-1-rakuram.e96@gmail.com \
--to=rakuram.e96@gmail.com \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=mkl@pengutronix.de \
--cc=socketcan@hartkopp.net \
/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