Commit 19a3eec1 authored by Bjorn Helgaas's avatar Bjorn Helgaas

Merge branch 'pci/switchtec'

- Make switchtec_class constant (Greg Kroah-Hartman)

* pci/switchtec:
  PCI: switchtec: Make switchtec_class constant
parents d098215a 8a74e4ea
...@@ -1565,7 +1565,7 @@ static struct class_interface switchtec_interface = { ...@@ -1565,7 +1565,7 @@ static struct class_interface switchtec_interface = {
static int __init switchtec_ntb_init(void) static int __init switchtec_ntb_init(void)
{ {
switchtec_interface.class = switchtec_class; switchtec_interface.class = &switchtec_class;
return class_interface_register(&switchtec_interface); return class_interface_register(&switchtec_interface);
} }
module_init(switchtec_ntb_init); module_init(switchtec_ntb_init);
......
...@@ -37,7 +37,9 @@ MODULE_PARM_DESC(nirqs, "number of interrupts to allocate (more may be useful fo ...@@ -37,7 +37,9 @@ MODULE_PARM_DESC(nirqs, "number of interrupts to allocate (more may be useful fo
static dev_t switchtec_devt; static dev_t switchtec_devt;
static DEFINE_IDA(switchtec_minor_ida); static DEFINE_IDA(switchtec_minor_ida);
struct class *switchtec_class; const struct class switchtec_class = {
.name = "switchtec",
};
EXPORT_SYMBOL_GPL(switchtec_class); EXPORT_SYMBOL_GPL(switchtec_class);
enum mrpc_state { enum mrpc_state {
...@@ -1363,7 +1365,7 @@ static struct switchtec_dev *stdev_create(struct pci_dev *pdev) ...@@ -1363,7 +1365,7 @@ static struct switchtec_dev *stdev_create(struct pci_dev *pdev)
dev = &stdev->dev; dev = &stdev->dev;
device_initialize(dev); device_initialize(dev);
dev->class = switchtec_class; dev->class = &switchtec_class;
dev->parent = &pdev->dev; dev->parent = &pdev->dev;
dev->groups = switchtec_device_groups; dev->groups = switchtec_device_groups;
dev->release = stdev_release; dev->release = stdev_release;
...@@ -1851,11 +1853,9 @@ static int __init switchtec_init(void) ...@@ -1851,11 +1853,9 @@ static int __init switchtec_init(void)
if (rc) if (rc)
return rc; return rc;
switchtec_class = class_create("switchtec"); rc = class_register(&switchtec_class);
if (IS_ERR(switchtec_class)) { if (rc)
rc = PTR_ERR(switchtec_class);
goto err_create_class; goto err_create_class;
}
rc = pci_register_driver(&switchtec_pci_driver); rc = pci_register_driver(&switchtec_pci_driver);
if (rc) if (rc)
...@@ -1866,7 +1866,7 @@ static int __init switchtec_init(void) ...@@ -1866,7 +1866,7 @@ static int __init switchtec_init(void)
return 0; return 0;
err_pci_register: err_pci_register:
class_destroy(switchtec_class); class_unregister(&switchtec_class);
err_create_class: err_create_class:
unregister_chrdev_region(switchtec_devt, max_devices); unregister_chrdev_region(switchtec_devt, max_devices);
...@@ -1878,7 +1878,7 @@ module_init(switchtec_init); ...@@ -1878,7 +1878,7 @@ module_init(switchtec_init);
static void __exit switchtec_exit(void) static void __exit switchtec_exit(void)
{ {
pci_unregister_driver(&switchtec_pci_driver); pci_unregister_driver(&switchtec_pci_driver);
class_destroy(switchtec_class); class_unregister(&switchtec_class);
unregister_chrdev_region(switchtec_devt, max_devices); unregister_chrdev_region(switchtec_devt, max_devices);
ida_destroy(&switchtec_minor_ida); ida_destroy(&switchtec_minor_ida);
......
...@@ -521,6 +521,6 @@ static inline struct switchtec_dev *to_stdev(struct device *dev) ...@@ -521,6 +521,6 @@ static inline struct switchtec_dev *to_stdev(struct device *dev)
return container_of(dev, struct switchtec_dev, dev); return container_of(dev, struct switchtec_dev, dev);
} }
extern struct class *switchtec_class; extern const struct class switchtec_class;
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment