drm/tests: hdmi: Fix memory leaks in drm_display_mode_from_cea_vic()
[drm/drm-misc.git] / drivers / scsi / snic / vnic_intr.c
blob23627f9591f26d29d2df854de540013b179676a5
1 // SPDX-License-Identifier: GPL-2.0-only
2 // Copyright 2014 Cisco Systems, Inc. All rights reserved.
4 #include <linux/kernel.h>
5 #include <linux/errno.h>
6 #include <linux/types.h>
7 #include <linux/pci.h>
8 #include <linux/delay.h>
9 #include "vnic_dev.h"
10 #include "vnic_intr.h"
12 void svnic_intr_free(struct vnic_intr *intr)
14 intr->ctrl = NULL;
17 int svnic_intr_alloc(struct vnic_dev *vdev, struct vnic_intr *intr,
18 unsigned int index)
20 intr->index = index;
21 intr->vdev = vdev;
23 intr->ctrl = svnic_dev_get_res(vdev, RES_TYPE_INTR_CTRL, index);
24 if (!intr->ctrl) {
25 pr_err("Failed to hook INTR[%d].ctrl resource\n",
26 index);
27 return -EINVAL;
30 return 0;
33 void svnic_intr_init(struct vnic_intr *intr, unsigned int coalescing_timer,
34 unsigned int coalescing_type, unsigned int mask_on_assertion)
36 iowrite32(coalescing_timer, &intr->ctrl->coalescing_timer);
37 iowrite32(coalescing_type, &intr->ctrl->coalescing_type);
38 iowrite32(mask_on_assertion, &intr->ctrl->mask_on_assertion);
39 iowrite32(0, &intr->ctrl->int_credits);
42 void svnic_intr_clean(struct vnic_intr *intr)
44 iowrite32(0, &intr->ctrl->int_credits);