[core] mark the configuration table as const

This commit is contained in:
Geoffrey McRae 2020-11-15 15:12:01 +11:00
parent 8ea3ae46fc
commit d88aecfc00
7 changed files with 17 additions and 14 deletions

View File

@ -28,7 +28,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include "common.h" #include "common.h"
#include "compat.h" #include "compat.h"
int amd_common_probe(struct vendor_reset_cfg *cfg, struct pci_dev *dev) int amd_common_probe(const struct vendor_reset_cfg *cfg, struct pci_dev *dev)
{ {
/* disable bus reset for the card, seems to be an issue with all of them */ /* disable bus reset for the card, seems to be an issue with all of them */
dev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET; dev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET;

View File

@ -123,7 +123,7 @@ static inline struct amd_vendor_private *amd_private(struct vendor_reset_dev *vd
return vdev->vendor_private; return vdev->vendor_private;
} }
int amd_common_probe(struct vendor_reset_cfg *cfg, struct pci_dev *dev); int amd_common_probe(const struct vendor_reset_cfg *cfg, struct pci_dev *dev);
int amd_common_pre_reset(struct vendor_reset_dev *); int amd_common_pre_reset(struct vendor_reset_dev *);
int amd_common_post_reset(struct vendor_reset_dev *); int amd_common_post_reset(struct vendor_reset_dev *);

View File

@ -102,7 +102,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
{PCI_VENDOR_ID_ATI, 0x7360, op, DEVICE_INFO(AMD_NAVI12)}, \ {PCI_VENDOR_ID_ATI, 0x7360, op, DEVICE_INFO(AMD_NAVI12)}, \
{PCI_VENDOR_ID_ATI, 0x7362, op, DEVICE_INFO(AMD_NAVI12)} {PCI_VENDOR_ID_ATI, 0x7362, op, DEVICE_INFO(AMD_NAVI12)}
static struct vendor_reset_cfg vendor_reset_devices[] = { static const struct vendor_reset_cfg vendor_reset_devices[] = {
_AMD_POLARIS10(&amd_polaris10_ops), _AMD_POLARIS10(&amd_polaris10_ops),
_AMD_POLARIS11(&amd_polaris10_ops), _AMD_POLARIS11(&amd_polaris10_ops),
_AMD_POLARIS12(&amd_polaris10_ops), _AMD_POLARIS12(&amd_polaris10_ops),

View File

@ -32,7 +32,7 @@ static int (*orig_pci_dev_specific_reset)(struct pci_dev *dev, int probe);
static int hooked_pci_dev_specific_reset(struct pci_dev *dev, int probe) static int hooked_pci_dev_specific_reset(struct pci_dev *dev, int probe)
{ {
int ret; int ret;
struct vendor_reset_cfg *cfg; const struct vendor_reset_cfg *cfg;
cfg = vendor_reset_cfg_find(dev->vendor, dev->device); cfg = vendor_reset_cfg_find(dev->vendor, dev->device);
if (!cfg) if (!cfg)

View File

@ -27,7 +27,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
static long vendor_reset_ioctl_reset(struct file * filp, unsigned long arg) static long vendor_reset_ioctl_reset(struct file * filp, unsigned long arg)
{ {
struct vendor_reset_ioctl iodev; struct vendor_reset_ioctl iodev;
struct vendor_reset_cfg *cfg; const struct vendor_reset_cfg *cfg;
struct pci_dev * dev; struct pci_dev * dev;
int ret; int ret;

View File

@ -20,10 +20,10 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include "vendor-reset-dev.h" #include "vendor-reset-dev.h"
#include "device-db.h" #include "device-db.h"
struct vendor_reset_cfg * vendor_reset_cfg_find(unsigned int vendor, const struct vendor_reset_cfg * vendor_reset_cfg_find(unsigned int vendor,
unsigned int device) unsigned int device)
{ {
struct vendor_reset_cfg * cfg; const struct vendor_reset_cfg * cfg;
for(cfg = vendor_reset_devices; cfg->vendor; ++cfg) for(cfg = vendor_reset_devices; cfg->vendor; ++cfg)
{ {
@ -40,7 +40,8 @@ struct vendor_reset_cfg * vendor_reset_cfg_find(unsigned int vendor,
return cfg; return cfg;
} }
long vendor_reset_dev_locked(struct vendor_reset_cfg *cfg, struct pci_dev *dev) long vendor_reset_dev_locked(const struct vendor_reset_cfg *cfg,
struct pci_dev *dev)
{ {
struct vendor_reset_dev vdev = struct vendor_reset_dev vdev =
{ {
@ -78,7 +79,8 @@ long vendor_reset_dev_locked(struct vendor_reset_cfg *cfg, struct pci_dev *dev)
return ret; return ret;
} }
long vendor_reset_dev(struct vendor_reset_cfg *cfg, struct pci_dev *dev) long vendor_reset_dev(const struct vendor_reset_cfg *cfg,
struct pci_dev *dev)
{ {
int ret; int ret;

View File

@ -26,7 +26,7 @@ struct vendor_reset_cfg;
struct vendor_reset_dev struct vendor_reset_dev
{ {
struct vendor_reset_cfg *cfg; const struct vendor_reset_cfg *cfg;
struct pci_dev *pdev; struct pci_dev *pdev;
unsigned long info; unsigned long info;
@ -46,7 +46,7 @@ struct vendor_reset_ops
/* version of the reset operations for logging */ /* version of the reset operations for logging */
const struct vendor_reset_ver version; const struct vendor_reset_ver version;
/* called when the kernel is probing for a working reset function */ /* called when the kernel is probing for a working reset function */
int (*probe)(struct vendor_reset_cfg *, struct pci_dev *); int (*probe)(const struct vendor_reset_cfg *, struct pci_dev *);
/* any pre-reset ops to do, i.e., common code between devices */ /* any pre-reset ops to do, i.e., common code between devices */
int (*pre_reset)(struct vendor_reset_dev *); int (*pre_reset)(struct vendor_reset_dev *);
/* the reset method for the device at the specified address */ /* the reset method for the device at the specified address */
@ -74,12 +74,13 @@ struct vendor_reset_cfg
}; };
/* search the device table for the specified vendor and device id and return it */ /* search the device table for the specified vendor and device id and return it */
struct vendor_reset_cfg * vendor_reset_cfg_find(unsigned int vendor, const struct vendor_reset_cfg * vendor_reset_cfg_find(unsigned int vendor,
unsigned int device); unsigned int device);
/* perform the device reset */ /* perform the device reset */
long vendor_reset_dev_locked(struct vendor_reset_cfg *cfg, struct pci_dev *dev); long vendor_reset_dev_locked(const struct vendor_reset_cfg *cfg,
long vendor_reset_dev(struct vendor_reset_cfg *cfg, struct pci_dev *dev); struct pci_dev *dev);
long vendor_reset_dev(const struct vendor_reset_cfg *cfg, struct pci_dev *dev);
#define vr_info(vdev, fmt, arg...) \ #define vr_info(vdev, fmt, arg...) \
pci_info ((vdev)->pdev, "%s: " fmt, (vdev)->cfg->info_str, ##arg) pci_info ((vdev)->pdev, "%s: " fmt, (vdev)->cfg->info_str, ##arg)