Skip to content

Commit 19a3eec

Browse files
committed
Merge branch 'pci/switchtec'
- Make switchtec_class constant (Greg Kroah-Hartman) * pci/switchtec: PCI: switchtec: Make switchtec_class constant
2 parents d098215 + 8a74e4e commit 19a3eec

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

drivers/ntb/hw/mscc/ntb_hw_switchtec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1565,7 +1565,7 @@ static struct class_interface switchtec_interface = {
15651565

15661566
static int __init switchtec_ntb_init(void)
15671567
{
1568-
switchtec_interface.class = switchtec_class;
1568+
switchtec_interface.class = &switchtec_class;
15691569
return class_interface_register(&switchtec_interface);
15701570
}
15711571
module_init(switchtec_ntb_init);

drivers/pci/switch/switchtec.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ MODULE_PARM_DESC(nirqs, "number of interrupts to allocate (more may be useful fo
3737
static dev_t switchtec_devt;
3838
static DEFINE_IDA(switchtec_minor_ida);
3939

40-
struct class *switchtec_class;
40+
const struct class switchtec_class = {
41+
.name = "switchtec",
42+
};
4143
EXPORT_SYMBOL_GPL(switchtec_class);
4244

4345
enum mrpc_state {
@@ -1363,7 +1365,7 @@ static struct switchtec_dev *stdev_create(struct pci_dev *pdev)
13631365

13641366
dev = &stdev->dev;
13651367
device_initialize(dev);
1366-
dev->class = switchtec_class;
1368+
dev->class = &switchtec_class;
13671369
dev->parent = &pdev->dev;
13681370
dev->groups = switchtec_device_groups;
13691371
dev->release = stdev_release;
@@ -1851,11 +1853,9 @@ static int __init switchtec_init(void)
18511853
if (rc)
18521854
return rc;
18531855

1854-
switchtec_class = class_create("switchtec");
1855-
if (IS_ERR(switchtec_class)) {
1856-
rc = PTR_ERR(switchtec_class);
1856+
rc = class_register(&switchtec_class);
1857+
if (rc)
18571858
goto err_create_class;
1858-
}
18591859

18601860
rc = pci_register_driver(&switchtec_pci_driver);
18611861
if (rc)
@@ -1866,7 +1866,7 @@ static int __init switchtec_init(void)
18661866
return 0;
18671867

18681868
err_pci_register:
1869-
class_destroy(switchtec_class);
1869+
class_unregister(&switchtec_class);
18701870

18711871
err_create_class:
18721872
unregister_chrdev_region(switchtec_devt, max_devices);
@@ -1878,7 +1878,7 @@ module_init(switchtec_init);
18781878
static void __exit switchtec_exit(void)
18791879
{
18801880
pci_unregister_driver(&switchtec_pci_driver);
1881-
class_destroy(switchtec_class);
1881+
class_unregister(&switchtec_class);
18821882
unregister_chrdev_region(switchtec_devt, max_devices);
18831883
ida_destroy(&switchtec_minor_ida);
18841884

include/linux/switchtec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,6 @@ static inline struct switchtec_dev *to_stdev(struct device *dev)
521521
return container_of(dev, struct switchtec_dev, dev);
522522
}
523523

524-
extern struct class *switchtec_class;
524+
extern const struct class switchtec_class;
525525

526526
#endif

0 commit comments

Comments
 (0)