linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Mailhol <vincent.mailhol@gmail.com>
To: Yasushi SHOJI <yasushi.shoji@gmail.com>
Cc: Yasushi SHOJI <yashi@spacecubics.com>,
	Wolfgang Grandegger <wg@grandegger.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	linux-can@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] can: mcba_usb: Fix termination command argument
Date: Thu, 24 Nov 2022 18:54:25 +0900	[thread overview]
Message-ID: <CAMZ6Rq+-ya9VxSGUD4aP=N58gZ1CmDbFFGQ9Oys0aTKm1rWN0A@mail.gmail.com> (raw)
In-Reply-To: <CAELBRWLOKW8NCLpV=MG0_=XY4N3BaozsZCacfgaXEs-tyfzoAA@mail.gmail.com>

On Thu. 24 Nov. 2022 at 18:52, Yasushi SHOJI <yasushi.shoji@gmail.com> wrote:
> On Thu, Nov 24, 2022 at 9:53 AM Vincent Mailhol
> <vincent.mailhol@gmail.com> wrote:
> > > diff --git a/drivers/net/can/usb/mcba_usb.c b/drivers/net/can/usb/mcba_usb.c
> > > index 218b098b261d..67beff1a3876 100644
> > > --- a/drivers/net/can/usb/mcba_usb.c
> > > +++ b/drivers/net/can/usb/mcba_usb.c
> > > @@ -785,9 +785,9 @@ static int mcba_set_termination(struct net_device *netdev, u16 term)
> > >         };
> > >
> > >         if (term == MCBA_TERMINATION_ENABLED)
> > > -               usb_msg.termination = 1;
> > > -       else
> > >                 usb_msg.termination = 0;
> > > +       else
> > > +               usb_msg.termination = 1;
> > >
> > >         mcba_usb_xmit_cmd(priv, (struct mcba_usb_msg *)&usb_msg);
> >
> > Nitpick: does it make sense to rename the field to something like
> > usb_msg.termination_disable or usb_msg.termination_off? This would
> > make it more explicit that this is a "reverse" boolean.
>
> I'd rather define the values like
>
> #define TERMINATION_ON (0)
> #define TERMINATION_OFF (1)
>
> So the block becomes
>
> if (term == MCBA_TERMINATION_ENABLED)
>     usb_msg.termination = TERMINATION_ON;
> else
>     usb_msg.termination = TERMINATION_OFF;

That also works! Thank you.

  reply	other threads:[~2022-11-24  9:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 19:44 [PATCH] can: mcba_usb: Fix termination command argument Yasushi SHOJI
2022-11-23 22:34 ` Marc Kleine-Budde
2022-11-24  9:50   ` Yasushi SHOJI
2022-11-24  0:53 ` Vincent Mailhol
2022-11-24  9:52   ` Yasushi SHOJI
2022-11-24  9:54     ` Vincent Mailhol [this message]
2022-11-24 14:38     ` Marc Kleine-Budde

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='CAMZ6Rq+-ya9VxSGUD4aP=N58gZ1CmDbFFGQ9Oys0aTKm1rWN0A@mail.gmail.com' \
    --to=vincent.mailhol@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=wg@grandegger.com \
    --cc=yashi@spacecubics.com \
    --cc=yasushi.shoji@gmail.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).