#include "gasket_constants.h"
#include "gasket_core.h"
-#include "gasket_logging.h"
#include "gasket_sysfs.h"
+#include <linux/device.h>
#include <linux/interrupt.h>
+#include <linux/printk.h>
#include <linux/version.h>
#ifdef GASKET_KERNEL_TRACE_SUPPORT
#define CREATE_TRACE_POINTS
case PCI_MSI:
case PLATFORM_WIRE:
default:
- gasket_nodev_error(
- "Cannot handle unsupported interrupt type %d.",
+ dev_err(gasket_dev->dev,
+ "Cannot handle unsupported interrupt type %d\n",
interrupt_data->type);
ret = -EINVAL;
};
/* Failing to setup interrupts will cause the device to report
* GASKET_STATUS_LAMED. But it is not fatal.
*/
- gasket_log_warn(
- gasket_dev, "Couldn't initialize interrupts: %d", ret);
+ dev_warn(gasket_dev->dev,
+ "Couldn't initialize interrupts: %d\n", ret);
return 0;
}
interrupt_data);
if (ret) {
- gasket_nodev_error(
+ dev_err(&interrupt_data->pci_dev->dev,
"Cannot get IRQ for interrupt %d, vector %d; "
"%d\n",
i, interrupt_data->msix_entries[i].vector, ret);
int ret;
if (!gasket_dev->interrupt_data) {
- gasket_log_debug(
- gasket_dev,
- "Attempted to reinit uninitialized interrupt data.");
+ dev_dbg(gasket_dev->dev,
+ "Attempted to reinit uninitialized interrupt data\n");
return -EINVAL;
}
case PCI_MSI:
case PLATFORM_WIRE:
default:
- gasket_nodev_debug(
- "Cannot handle unsupported interrupt type %d.",
+ dev_dbg(gasket_dev->dev,
+ "Cannot handle unsupported interrupt type %d\n",
gasket_dev->interrupt_data->type);
ret = -EINVAL;
};
/* Failing to setup MSIx will cause the device
* to report GASKET_STATUS_LAMED, but is not fatal.
*/
- gasket_log_warn(gasket_dev, "Couldn't init msix: %d", ret);
+ dev_warn(gasket_dev->dev, "Couldn't init msix: %d\n", ret);
return 0;
}
/* See gasket_interrupt.h for description. */
int gasket_interrupt_reset_counts(struct gasket_dev *gasket_dev)
{
- gasket_log_debug(gasket_dev, "Clearing interrupt counts.");
+ dev_dbg(gasket_dev->dev, "Clearing interrupt counts\n");
memset(gasket_dev->interrupt_data->interrupt_counts, 0,
gasket_dev->interrupt_data->num_interrupts *
sizeof(*gasket_dev->interrupt_data->interrupt_counts));
gasket_dev->interrupt_data;
if (!interrupt_data) {
- gasket_log_debug(
- gasket_dev, "Interrupt data is not initialized.");
+ dev_dbg(gasket_dev->dev, "Interrupt data is not initialized\n");
return;
}
- gasket_log_debug(gasket_dev, "Running interrupt setup.");
+ dev_dbg(gasket_dev->dev, "Running interrupt setup\n");
if (interrupt_data->type == PLATFORM_WIRE ||
interrupt_data->type == PCI_MSI) {
}
if (interrupt_data->type != PCI_MSIX) {
- gasket_nodev_debug(
- "Cannot handle unsupported interrupt type %d.",
+ dev_dbg(gasket_dev->dev,
+ "Cannot handle unsupported interrupt type %d\n",
interrupt_data->type);
return;
}
* the register directly. If not, we need to deal with a read-
* modify-write and shift based on the packing index.
*/
- gasket_log_debug(
- gasket_dev,
+ dev_dbg(gasket_dev->dev,
"Setting up interrupt index %d with index 0x%llx and "
- "packing %d",
+ "packing %d\n",
interrupt_data->interrupts[i].index,
interrupt_data->interrupts[i].reg,
interrupt_data->interrupts[i].packing);
pack_shift = 3 * interrupt_data->pack_width;
break;
default:
- gasket_nodev_debug(
+ dev_dbg(gasket_dev->dev,
"Found interrupt description with "
- "unknown enum %d.",
+ "unknown enum %d\n",
interrupt_data->interrupts[i].packing);
return;
}
case PCI_MSI:
case PLATFORM_WIRE:
default:
- gasket_nodev_debug(
- "Cannot handle unsupported interrupt type %d.",
+ dev_dbg(gasket_dev->dev,
+ "Cannot handle unsupported interrupt type %d\n",
interrupt_data->type);
};
int gasket_interrupt_system_status(struct gasket_dev *gasket_dev)
{
if (!gasket_dev->interrupt_data) {
- gasket_nodev_debug("Interrupt data is null.");
+ dev_dbg(gasket_dev->dev, "Interrupt data is null\n");
return GASKET_STATUS_DEAD;
}
if (!gasket_dev->interrupt_data->msix_configured) {
- gasket_nodev_debug("Interrupt not initialized.");
+ dev_dbg(gasket_dev->dev, "Interrupt not initialized\n");
return GASKET_STATUS_LAMED;
}
if (gasket_dev->interrupt_data->num_configured !=
gasket_dev->interrupt_data->num_interrupts) {
- gasket_nodev_debug("Not all interrupts were configured.");
+ dev_dbg(gasket_dev->dev,
+ "Not all interrupts were configured\n");
return GASKET_STATUS_LAMED;
}
gasket_dev = gasket_sysfs_get_device_data(device);
if (!gasket_dev) {
- gasket_nodev_debug(
- "No sysfs mapping found for device 0x%p", device);
+ dev_dbg(device, "No sysfs mapping found for device\n");
return 0;
}
gasket_attr = gasket_sysfs_get_attr(device, attr);
if (!gasket_attr) {
- gasket_nodev_debug(
- "No sysfs attr data found for device 0x%p", device);
+ dev_dbg(device, "No sysfs attr data found for device\n");
gasket_sysfs_put_device_data(device, gasket_dev);
return 0;
}
ret = total_written;
break;
default:
- gasket_log_debug(
- gasket_dev, "Unknown attribute: %s", attr->attr.name);
+ dev_dbg(gasket_dev->dev, "Unknown attribute: %s\n",
+ attr->attr.name);
ret = 0;
break;
}
}
}
if (interrupt == -1) {
- gasket_nodev_error("Received unknown irq %d", irq);
+ pr_err("Received unknown irq %d\n", irq);
return IRQ_HANDLED;
}
trace_gasket_interrupt_event(interrupt_data->name, interrupt);