drm/tests: hdmi: Fix memory leaks in drm_display_mode_from_cea_vic()
[drm/drm-misc.git] / drivers / scsi / fnic / vnic_intr.c
blobdf7f63acd8797a69ea4daeed5fd5e46b561b920c
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright 2008 Cisco Systems, Inc. All rights reserved.
4 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
5 */
7 #include <linux/kernel.h>
8 #include <linux/errno.h>
9 #include <linux/types.h>
10 #include <linux/pci.h>
11 #include <linux/delay.h>
12 #include "vnic_dev.h"
13 #include "vnic_intr.h"
15 void vnic_intr_free(struct vnic_intr *intr)
17 intr->ctrl = NULL;
20 int vnic_intr_alloc(struct vnic_dev *vdev, struct vnic_intr *intr,
21 unsigned int index)
23 intr->index = index;
24 intr->vdev = vdev;
26 intr->ctrl = vnic_dev_get_res(vdev, RES_TYPE_INTR_CTRL, index);
27 if (!intr->ctrl) {
28 printk(KERN_ERR "Failed to hook INTR[%d].ctrl resource\n",
29 index);
30 return -EINVAL;
33 return 0;
36 void vnic_intr_init(struct vnic_intr *intr, unsigned int coalescing_timer,
37 unsigned int coalescing_type, unsigned int mask_on_assertion)
39 iowrite32(coalescing_timer, &intr->ctrl->coalescing_timer);
40 iowrite32(coalescing_type, &intr->ctrl->coalescing_type);
41 iowrite32(mask_on_assertion, &intr->ctrl->mask_on_assertion);
42 iowrite32(0, &intr->ctrl->int_credits);
45 void vnic_intr_clean(struct vnic_intr *intr)
47 iowrite32(0, &intr->ctrl->int_credits);