1
linux/drivers/misc/pvpanic/pvpanic-pci.c
Thomas Weißschuh ee59be35d7 misc/pvpanic-pci: register attributes via pci_driver
In __pci_register_driver(), the pci core overwrites the dev_groups field of
the embedded struct device_driver with the dev_groups from the outer
struct pci_driver unconditionally.

Set dev_groups in the pci_driver to make sure it is used.

This was broken since the introduction of pvpanic-pci.

Fixes: db3a4f0abe ("misc/pvpanic: add PCI driver")
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Fixes: ded13b9cfd ("PCI: Add support for dev_groups to struct pci_driver")
Link: https://lore.kernel.org/r/20240411-pvpanic-pci-dev-groups-v1-1-db8cb69f1b09@weissschuh.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-29 11:18:28 +02:00

50 lines
1.1 KiB
C

// SPDX-License-Identifier: GPL-2.0+
/*
* Pvpanic PCI Device Support
*
* Copyright (C) 2021 Oracle.
*/
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/types.h>
#include "pvpanic.h"
#define PCI_DEVICE_ID_REDHAT_PVPANIC 0x0011
MODULE_AUTHOR("Mihai Carabas <mihai.carabas@oracle.com>");
MODULE_DESCRIPTION("pvpanic device driver");
MODULE_LICENSE("GPL");
static int pvpanic_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
void __iomem *base;
int ret;
ret = pcim_enable_device(pdev);
if (ret < 0)
return ret;
base = pcim_iomap(pdev, 0, 0);
if (!base)
return -ENOMEM;
return devm_pvpanic_probe(&pdev->dev, base);
}
static const struct pci_device_id pvpanic_pci_id_tbl[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_PVPANIC)},
{}
};
MODULE_DEVICE_TABLE(pci, pvpanic_pci_id_tbl);
static struct pci_driver pvpanic_pci_driver = {
.name = "pvpanic-pci",
.id_table = pvpanic_pci_id_tbl,
.probe = pvpanic_pci_probe,
.dev_groups = pvpanic_dev_groups,
};
module_pci_driver(pvpanic_pci_driver);