Commit 62a1e416 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'isdn-constify-struct-class-usage'

Ricardo B. Marliere says:

====================
isdn: constify struct class usage

This is a simple and straight forward cleanup series that aims to make the
class structures in isdn constant. This has been possible since 2023 [1].

[1]: https://lore.kernel.org/all/2023040248-customary-release-4aec@gregkh/
====================

Link: https://lore.kernel.org/r/20240305-class_cleanup-isdn-v1-0-6f0edca75b61@marliere.netSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents b7241321 12fbd67e
......@@ -49,7 +49,9 @@ MODULE_LICENSE("GPL");
/* -------- driver information -------------------------------------- */
static DEFINE_MUTEX(capi_mutex);
static struct class *capi_class;
static const struct class capi_class = {
.name = "capi",
};
static int capi_major = 68; /* allocated */
module_param_named(major, capi_major, uint, 0);
......@@ -1393,18 +1395,19 @@ static int __init capi_init(void)
kcapi_exit();
return major_ret;
}
capi_class = class_create("capi");
if (IS_ERR(capi_class)) {
ret = class_register(&capi_class);
if (ret) {
unregister_chrdev(capi_major, "capi20");
kcapi_exit();
return PTR_ERR(capi_class);
return ret;
}
device_create(capi_class, NULL, MKDEV(capi_major, 0), NULL, "capi20");
device_create(&capi_class, NULL, MKDEV(capi_major, 0), NULL, "capi20");
if (capinc_tty_init() < 0) {
device_destroy(capi_class, MKDEV(capi_major, 0));
class_destroy(capi_class);
device_destroy(&capi_class, MKDEV(capi_major, 0));
class_unregister(&capi_class);
unregister_chrdev(capi_major, "capi20");
kcapi_exit();
return -ENOMEM;
......@@ -1427,8 +1430,8 @@ static void __exit capi_exit(void)
{
proc_exit();
device_destroy(capi_class, MKDEV(capi_major, 0));
class_destroy(capi_class);
device_destroy(&capi_class, MKDEV(capi_major, 0));
class_unregister(&capi_class);
unregister_chrdev(capi_major, "capi20");
capinc_tty_exit();
......
......@@ -31,7 +31,9 @@ struct dsp_element_entry {
static LIST_HEAD(dsp_elements);
/* sysfs */
static struct class *elements_class;
static const struct class elements_class = {
.name = "dsp_pipeline",
};
static ssize_t
attr_show_args(struct device *dev, struct device_attribute *attr, char *buf)
......@@ -80,7 +82,7 @@ int mISDN_dsp_element_register(struct mISDN_dsp_element *elem)
INIT_LIST_HEAD(&entry->list);
entry->elem = elem;
entry->dev.class = elements_class;
entry->dev.class = &elements_class;
entry->dev.release = mISDN_dsp_dev_release;
dev_set_drvdata(&entry->dev, elem);
dev_set_name(&entry->dev, "%s", elem->name);
......@@ -131,9 +133,11 @@ EXPORT_SYMBOL(mISDN_dsp_element_unregister);
int dsp_pipeline_module_init(void)
{
elements_class = class_create("dsp_pipeline");
if (IS_ERR(elements_class))
return PTR_ERR(elements_class);
int err;
err = class_register(&elements_class);
if (err)
return err;
dsp_hwec_init();
......@@ -146,7 +150,7 @@ void dsp_pipeline_module_exit(void)
dsp_hwec_exit();
class_destroy(elements_class);
class_unregister(&elements_class);
list_for_each_entry_safe(entry, n, &dsp_elements, list) {
list_del(&entry->list);
......
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