/* bcm_delete_rx_op - find and remove a rx op (returns number of removed ops)  */
static int bcm_delete_rx_op(struct list_head *ops, canid_t can_id, int ifindex)
/* bcm_delete_rx_op - find and remove a rx op (returns number of removed ops)  */
static int bcm_delete_rx_op(struct list_head *ops, canid_t can_id, int ifindex)
{
	struct bcm_op *op, *n;
	list_for_each_entry_safe(op, n, ops, list) {
		if ((op->can_id == can_id) && (op->ifindex == ifindex)) {
			if (op->ifindex) {
				if (op->rx_reg_dev) {
					struct net_device *dev;
					dev = dev_get_by_index(&init_net,
							       op->ifindex);
					if (dev) {
						bcm_rx_unreg(dev, op);
						dev_put(dev);
					}
				}
			} else
				can_rx_unregister(NULL, op->can_id,
						  REGMASK(op->can_id),
						  bcm_rx_handler, op);
			list_del(&op->list);
			bcm_remove_op(op);
			return 1;
		}
	}
	return 0;
}