]> Git Repo - J-linux.git/blobdiff - drivers/fpga/fpga-region.c
Merge tag 'input-for-v6.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor...
[J-linux.git] / drivers / fpga / fpga-region.c
index ccf6fdab1360896122e475fde1435ab65f826070..b364a929425ce9b54345a0098e28837894359495 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/spinlock.h>
 
 static DEFINE_IDA(fpga_region_ida);
-static struct class *fpga_region_class;
+static const struct class fpga_region_class;
 
 struct fpga_region *
 fpga_region_class_find(struct device *start, const void *data,
@@ -24,7 +24,7 @@ fpga_region_class_find(struct device *start, const void *data,
 {
        struct device *dev;
 
-       dev = class_find_device(fpga_region_class, start, data, match);
+       dev = class_find_device(&fpga_region_class, start, data, match);
        if (!dev)
                return NULL;
 
@@ -38,9 +38,10 @@ EXPORT_SYMBOL_GPL(fpga_region_class_find);
  *
  * Caller should call fpga_region_put() when done with region.
  *
- * Return fpga_region struct if successful.
- * Return -EBUSY if someone already has a reference to the region.
- * Return -ENODEV if @np is not an FPGA Region.
+ * Return:
+ * * fpga_region struct if successful.
+ * * -EBUSY if someone already has a reference to the region.
+ * * -ENODEV if can't take parent driver module refcount.
  */
 static struct fpga_region *fpga_region_get(struct fpga_region *region)
 {
@@ -91,7 +92,7 @@ static void fpga_region_put(struct fpga_region *region)
  * The caller will need to call fpga_bridges_put() before attempting to
  * reprogram the region.
  *
- * Return 0 for success or negative error code.
+ * Return: 0 for success or negative error code.
  */
 int fpga_region_program_fpga(struct fpga_region *region)
 {
@@ -216,7 +217,7 @@ fpga_region_register_full(struct device *parent, const struct fpga_region_info *
        mutex_init(&region->mutex);
        INIT_LIST_HEAD(&region->bridge_list);
 
-       region->dev.class = fpga_region_class;
+       region->dev.class = &fpga_region_class;
        region->dev.parent = parent;
        region->dev.of_node = parent->of_node;
        region->dev.id = id;
@@ -287,25 +288,25 @@ static void fpga_region_dev_release(struct device *dev)
        kfree(region);
 }
 
+static const struct class fpga_region_class = {
+       .name = "fpga_region",
+       .dev_groups = fpga_region_groups,
+       .dev_release = fpga_region_dev_release,
+};
+
 /**
- * fpga_region_init - init function for fpga_region class
- * Creates the fpga_region class and registers a reconfig notifier.
+ * fpga_region_init - creates the fpga_region class.
+ *
+ * Return: 0 on success or ERR_PTR() on error.
  */
 static int __init fpga_region_init(void)
 {
-       fpga_region_class = class_create("fpga_region");
-       if (IS_ERR(fpga_region_class))
-               return PTR_ERR(fpga_region_class);
-
-       fpga_region_class->dev_groups = fpga_region_groups;
-       fpga_region_class->dev_release = fpga_region_dev_release;
-
-       return 0;
+       return class_register(&fpga_region_class);
 }
 
 static void __exit fpga_region_exit(void)
 {
-       class_destroy(fpga_region_class);
+       class_unregister(&fpga_region_class);
        ida_destroy(&fpga_region_ida);
 }
 
This page took 0.029537 seconds and 4 git commands to generate.