Re: [PATCH v4 04/12] can: m_can: Add rx coalescing ethtool support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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) {
       |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

> +		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;
> +}

...



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux