On Sun, 28 Feb 2021 16:22:47 +0800 Xuan Zhuo wrote:
> +static void virtnet_put_xdp_sq(struct virtnet_info *vi, struct send_queue 
> *sq)
> +{
> +     struct netdev_queue *txq;
> +     unsigned int qp;
> +
> +     if (vi->curr_queue_pairs <= nr_cpu_ids) {
> +             qp = sq - vi->sq;
> +             txq = netdev_get_tx_queue(vi->dev, qp);
> +             __netif_tx_unlock(txq);
> +     }
> +}

Could we potentially avoid sparse warnings on this patch by adding the
right annotations?

I've seen this pattern used in a few places:

void maybe_take_some_lock() 
        __acquires(lock)
{
        if (condition) {
                lock(lock); /* really take the lock */
        } else {
                /* tell sparse we took the lock, but don't really take it */
                __acquire(lock);
        }
}

Reply via email to