|
14 | 14 | #include <linux/pci-epf.h>
|
15 | 15 | #include <linux/pci-ep-cfs.h>
|
16 | 16 |
|
17 |
| -static struct class *pci_epc_class; |
| 17 | +static const struct class pci_epc_class = { |
| 18 | + .name = "pci_epc", |
| 19 | +}; |
18 | 20 |
|
19 | 21 | static void devm_pci_epc_release(struct device *dev, void *res)
|
20 | 22 | {
|
@@ -60,7 +62,7 @@ struct pci_epc *pci_epc_get(const char *epc_name)
|
60 | 62 | struct device *dev;
|
61 | 63 | struct class_dev_iter iter;
|
62 | 64 |
|
63 |
| - class_dev_iter_init(&iter, pci_epc_class, NULL, NULL); |
| 65 | + class_dev_iter_init(&iter, &pci_epc_class, NULL, NULL); |
64 | 66 | while ((dev = class_dev_iter_next(&iter))) {
|
65 | 67 | if (strcmp(epc_name, dev_name(dev)))
|
66 | 68 | continue;
|
@@ -893,7 +895,7 @@ __pci_epc_create(struct device *dev, const struct pci_epc_ops *ops,
|
893 | 895 | INIT_LIST_HEAD(&epc->pci_epf);
|
894 | 896 |
|
895 | 897 | device_initialize(&epc->dev);
|
896 |
| - epc->dev.class = pci_epc_class; |
| 898 | + epc->dev.class = &pci_epc_class; |
897 | 899 | epc->dev.parent = dev;
|
898 | 900 | epc->dev.release = pci_epc_release;
|
899 | 901 | epc->ops = ops;
|
@@ -953,20 +955,13 @@ EXPORT_SYMBOL_GPL(__devm_pci_epc_create);
|
953 | 955 |
|
954 | 956 | static int __init pci_epc_init(void)
|
955 | 957 | {
|
956 |
| - pci_epc_class = class_create("pci_epc"); |
957 |
| - if (IS_ERR(pci_epc_class)) { |
958 |
| - pr_err("failed to create pci epc class --> %ld\n", |
959 |
| - PTR_ERR(pci_epc_class)); |
960 |
| - return PTR_ERR(pci_epc_class); |
961 |
| - } |
962 |
| - |
963 |
| - return 0; |
| 958 | + return class_register(&pci_epc_class); |
964 | 959 | }
|
965 | 960 | module_init(pci_epc_init);
|
966 | 961 |
|
967 | 962 | static void __exit pci_epc_exit(void)
|
968 | 963 | {
|
969 |
| - class_destroy(pci_epc_class); |
| 964 | + class_unregister(&pci_epc_class); |
970 | 965 | }
|
971 | 966 | module_exit(pci_epc_exit);
|
972 | 967 |
|
|
0 commit comments