Linux CAN drivers development
 help / color / mirror / Atom feed
From: Markus Schneider-Pargmann <msp@baylibre.com>
To: Simon Horman <simon.horman@corigine.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
	Chandrasekar Ramakrishnan <rcsekar@samsung.com>,
	Wolfgang Grandegger <wg@grandegger.com>,
	Vincent MAILHOL <mailhol.vincent@wanadoo.fr>,
	"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, Julien Panis <jpanis@baylibre.com>
Subject: Re: [PATCH v4 04/12] can: m_can: Add rx coalescing ethtool support
Date: Thu, 22 Jun 2023 11:02:06 +0200	[thread overview]
Message-ID: <20230622090206.qkzts2qlbqeiukhs@blmsp> (raw)
In-Reply-To: <ZJMHlIp9x8HL97qT@corigine.com>

Hi Simon,

On Wed, Jun 21, 2023 at 04:22:12PM +0200, Simon Horman wrote:
> On Wed, Jun 21, 2023 at 11:23:42AM +0200, Markus Schneider-Pargmann wrote:
> 
> ...
> 
> > +static int m_can_set_coalesce(struct net_device *dev,
> > +			      struct ethtool_coalesce *ec,
> > +			      struct kernel_ethtool_coalesce *kec,
> > +			      struct netlink_ext_ack *ext_ack)
> > +{
> > +	struct m_can_classdev *cdev = netdev_priv(dev);
> > +
> > +	if (cdev->can.state != CAN_STATE_STOPPED) {
> > +		netdev_err(dev, "Device is in use, please shut it down first\n");
> > +		return -EBUSY;
> > +	}
> > +
> > +	if (ec->rx_max_coalesced_frames_irq > cdev->mcfg[MRAM_RXF0].num) {
> > +		netdev_err(dev, "rx-frames-irq %u greater than the RX FIFO %u\n",
> > +			   ec->rx_max_coalesced_frames_irq,
> > +			   cdev->mcfg[MRAM_RXF0].num);
> > +		return -EINVAL;
> > +	}
> > +	if (ec->rx_max_coalesced_frames_irq == 0 != ec->rx_coalesce_usecs_irq == 0) {
> 
> Hi Markus,
> 
> For a W=1 build GCC 12.3.0 suggests, rather forcefully, that it would like
> some more parentheses here.
> 
>  drivers/net/can/m_can/m_can.c: In function 'm_can_set_coalesce':
>  drivers/net/can/m_can/m_can.c:1978:45: warning: suggest parentheses around comparison in operand of '!=' [-Wparentheses]
>   1978 |         if (ec->rx_max_coalesced_frames_irq == 0 != ec->rx_coalesce_usecs_irq == 0) {
>        |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
>  drivers/net/can/m_can/m_can.c:1978:50: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
>   1978 |         if (ec->rx_max_coalesced_frames_irq == 0 != ec->rx_coalesce_usecs_irq == 0) {
>        |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thanks, yes I just changed it because checkpatch doesn't like it the
other way. I am going to change it back. Also I am wondering why clang
doesn't complain at this point.

Best,
Markus

> 
> > +		netdev_err(dev, "rx-frames-irq and rx-usecs-irq can only be set together\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	cdev->rx_max_coalesced_frames_irq = ec->rx_max_coalesced_frames_irq;
> > +	cdev->rx_coalesce_usecs_irq = ec->rx_coalesce_usecs_irq;
> > +
> > +	return 0;
> > +}
> 
> ...

  reply	other threads:[~2023-06-22  9:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-21  9:23 [PATCH v4 00/12] can: m_can: Optimizations for m_can/tcan part 2 Markus Schneider-Pargmann
2023-06-21  9:23 ` [PATCH v4 01/12] can: m_can: Write transmit header and data in one transaction Markus Schneider-Pargmann
2023-06-21 14:19   ` Simon Horman
2023-06-22  8:56     ` Markus Schneider-Pargmann
2023-06-21 17:49   ` kernel test robot
2023-06-21  9:23 ` [PATCH v4 02/12] can: m_can: Implement receive coalescing Markus Schneider-Pargmann
2023-06-21  9:23 ` [PATCH v4 03/12] can: m_can: Implement transmit coalescing Markus Schneider-Pargmann
2023-06-21  9:23 ` [PATCH v4 04/12] can: m_can: Add rx coalescing ethtool support Markus Schneider-Pargmann
2023-06-21 14:22   ` Simon Horman
2023-06-22  9:02     ` Markus Schneider-Pargmann [this message]
2023-06-21 18:00   ` kernel test robot
2023-06-21  9:23 ` [PATCH v4 05/12] can: m_can: Add tx " Markus Schneider-Pargmann
2023-06-21  9:23 ` [PATCH v4 06/12] can: m_can: Use u32 for putidx Markus Schneider-Pargmann
2023-06-21  9:23 ` [PATCH v4 07/12] can: m_can: Cache tx putidx Markus Schneider-Pargmann
2023-06-21  9:23 ` [PATCH v4 08/12] can: m_can: Use the workqueue as queue Markus Schneider-Pargmann
2023-06-21  9:23 ` [PATCH v4 09/12] can: m_can: Introduce a tx_fifo_in_flight counter Markus Schneider-Pargmann
2023-06-21  9:23 ` [PATCH v4 10/12] can: m_can: Use tx_fifo_in_flight for netif_queue control Markus Schneider-Pargmann
2023-06-21  9:23 ` [PATCH v4 11/12] can: m_can: Implement BQL Markus Schneider-Pargmann
2023-06-21  9:23 ` [PATCH v4 12/12] can: m_can: Implement transmit submission coalescing Markus Schneider-Pargmann

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=20230622090206.qkzts2qlbqeiukhs@blmsp \
    --to=msp@baylibre.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jpanis@baylibre.com \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rcsekar@samsung.com \
    --cc=simon.horman@corigine.com \
    --cc=wg@grandegger.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