2 * System Trace Module (STM) infrastructure
3 * Copyright (c) 2014, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * STM class implements generic infrastructure for System Trace Module devices
15 * as defined in MIPI STPv2 specification.
18 #include <linux/uaccess.h>
19 #include <linux/kernel.h>
20 #include <linux/module.h>
21 #include <linux/device.h>
22 #include <linux/compat.h>
23 #include <linux/kdev_t.h>
24 #include <linux/srcu.h>
25 #include <linux/slab.h>
26 #include <linux/stm.h>
31 #include <uapi/linux/stm.h>
33 static unsigned int stm_core_up;
36 * The SRCU here makes sure that STM device doesn't disappear from under a
37 * stm_source_write() caller, which may want to have as little overhead as
40 static struct srcu_struct stm_source_srcu;
42 static ssize_t masters_show(struct device *dev,
43 struct device_attribute *attr,
46 struct stm_device *stm = to_stm_device(dev);
49 ret = sprintf(buf, "%u %u\n", stm->data->sw_start, stm->data->sw_end);
54 static DEVICE_ATTR_RO(masters);
56 static ssize_t channels_show(struct device *dev,
57 struct device_attribute *attr,
60 struct stm_device *stm = to_stm_device(dev);
63 ret = sprintf(buf, "%u\n", stm->data->sw_nchannels);
68 static DEVICE_ATTR_RO(channels);
70 static ssize_t hw_override_show(struct device *dev,
71 struct device_attribute *attr,
74 struct stm_device *stm = to_stm_device(dev);
77 ret = sprintf(buf, "%u\n", stm->data->hw_override);
82 static DEVICE_ATTR_RO(hw_override);
84 static struct attribute *stm_attrs[] = {
85 &dev_attr_masters.attr,
86 &dev_attr_channels.attr,
87 &dev_attr_hw_override.attr,
91 ATTRIBUTE_GROUPS(stm);
93 static struct class stm_class = {
95 .dev_groups = stm_groups,
98 static int stm_dev_match(struct device *dev, const void *data)
100 const char *name = data;
102 return sysfs_streq(name, dev_name(dev));
106 * stm_find_device() - find stm device by name
107 * @buf: character buffer containing the name
109 * This is called when either policy gets assigned to an stm device or an
110 * stm_source device gets linked to an stm device.
112 * This grabs device's reference (get_device()) and module reference, both
113 * of which the calling path needs to make sure to drop with stm_put_device().
115 * Return: stm device pointer or null if lookup failed.
117 struct stm_device *stm_find_device(const char *buf)
119 struct stm_device *stm;
125 dev = class_find_device(&stm_class, NULL, buf, stm_dev_match);
129 stm = to_stm_device(dev);
130 if (!try_module_get(stm->owner)) {
131 /* matches class_find_device() above */
140 * stm_put_device() - drop references on the stm device
141 * @stm: stm device, previously acquired by stm_find_device()
143 * This drops the module reference and device reference taken by
144 * stm_find_device() or stm_char_open().
146 void stm_put_device(struct stm_device *stm)
148 module_put(stm->owner);
149 put_device(&stm->dev);
153 * Internally we only care about software-writable masters here, that is the
154 * ones in the range [stm_data->sw_start..stm_data..sw_end], however we need
155 * original master numbers to be visible externally, since they are the ones
156 * that will appear in the STP stream. Thus, the internal bookkeeping uses
157 * $master - stm_data->sw_start to reference master descriptors and such.
160 #define __stm_master(_s, _m) \
161 ((_s)->masters[(_m) - (_s)->data->sw_start])
163 static inline struct stp_master *
164 stm_master(struct stm_device *stm, unsigned int idx)
166 if (idx < stm->data->sw_start || idx > stm->data->sw_end)
169 return __stm_master(stm, idx);
172 static int stp_master_alloc(struct stm_device *stm, unsigned int idx)
174 struct stp_master *master;
177 size = ALIGN(stm->data->sw_nchannels, 8) / 8;
178 size += sizeof(struct stp_master);
179 master = kzalloc(size, GFP_ATOMIC);
183 master->nr_free = stm->data->sw_nchannels;
184 __stm_master(stm, idx) = master;
189 static void stp_master_free(struct stm_device *stm, unsigned int idx)
191 struct stp_master *master = stm_master(stm, idx);
196 __stm_master(stm, idx) = NULL;
200 static void stm_output_claim(struct stm_device *stm, struct stm_output *output)
202 struct stp_master *master = stm_master(stm, output->master);
204 lockdep_assert_held(&stm->mc_lock);
205 lockdep_assert_held(&output->lock);
207 if (WARN_ON_ONCE(master->nr_free < output->nr_chans))
210 bitmap_allocate_region(&master->chan_map[0], output->channel,
211 ilog2(output->nr_chans));
213 master->nr_free -= output->nr_chans;
217 stm_output_disclaim(struct stm_device *stm, struct stm_output *output)
219 struct stp_master *master = stm_master(stm, output->master);
221 lockdep_assert_held(&stm->mc_lock);
222 lockdep_assert_held(&output->lock);
224 bitmap_release_region(&master->chan_map[0], output->channel,
225 ilog2(output->nr_chans));
227 output->nr_chans = 0;
228 master->nr_free += output->nr_chans;
232 * This is like bitmap_find_free_region(), except it can ignore @start bits
235 static int find_free_channels(unsigned long *bitmap, unsigned int start,
236 unsigned int end, unsigned int width)
241 for (pos = start; pos < end + 1; pos = ALIGN(pos, width)) {
242 pos = find_next_zero_bit(bitmap, end + 1, pos);
243 if (pos + width > end + 1)
246 if (pos & (width - 1))
249 for (i = 1; i < width && !test_bit(pos + i, bitmap); i++)
259 stm_find_master_chan(struct stm_device *stm, unsigned int width,
260 unsigned int *mstart, unsigned int mend,
261 unsigned int *cstart, unsigned int cend)
263 struct stp_master *master;
267 for (midx = *mstart; midx <= mend; midx++) {
268 if (!stm_master(stm, midx)) {
269 err = stp_master_alloc(stm, midx);
274 master = stm_master(stm, midx);
276 if (!master->nr_free)
279 pos = find_free_channels(master->chan_map, *cstart, cend,
292 static int stm_output_assign(struct stm_device *stm, unsigned int width,
293 struct stp_policy_node *policy_node,
294 struct stm_output *output)
296 unsigned int midx, cidx, mend, cend;
299 if (width > stm->data->sw_nchannels)
303 stp_policy_node_get_ranges(policy_node,
304 &midx, &mend, &cidx, &cend);
306 midx = stm->data->sw_start;
308 mend = stm->data->sw_end;
309 cend = stm->data->sw_nchannels - 1;
312 spin_lock(&stm->mc_lock);
313 spin_lock(&output->lock);
314 /* output is already assigned -- shouldn't happen */
315 if (WARN_ON_ONCE(output->nr_chans))
318 ret = stm_find_master_chan(stm, width, &midx, mend, &cidx, cend);
322 output->master = midx;
323 output->channel = cidx;
324 output->nr_chans = width;
325 stm_output_claim(stm, output);
326 dev_dbg(&stm->dev, "assigned %u:%u (+%u)\n", midx, cidx, width);
330 spin_unlock(&output->lock);
331 spin_unlock(&stm->mc_lock);
336 static void stm_output_free(struct stm_device *stm, struct stm_output *output)
338 spin_lock(&stm->mc_lock);
339 spin_lock(&output->lock);
340 if (output->nr_chans)
341 stm_output_disclaim(stm, output);
342 spin_unlock(&output->lock);
343 spin_unlock(&stm->mc_lock);
346 static void stm_output_init(struct stm_output *output)
348 spin_lock_init(&output->lock);
351 static int major_match(struct device *dev, const void *data)
353 unsigned int major = *(unsigned int *)data;
355 return MAJOR(dev->devt) == major;
358 static int stm_char_open(struct inode *inode, struct file *file)
360 struct stm_file *stmf;
362 unsigned int major = imajor(inode);
365 dev = class_find_device(&stm_class, NULL, &major, major_match);
369 stmf = kzalloc(sizeof(*stmf), GFP_KERNEL);
373 stm_output_init(&stmf->output);
374 stmf->stm = to_stm_device(dev);
376 if (!try_module_get(stmf->stm->owner))
379 file->private_data = stmf;
381 return nonseekable_open(inode, file);
384 /* matches class_find_device() above */
391 static int stm_char_release(struct inode *inode, struct file *file)
393 struct stm_file *stmf = file->private_data;
394 struct stm_device *stm = stmf->stm;
396 if (stm->data->unlink)
397 stm->data->unlink(stm->data, stmf->output.master,
398 stmf->output.channel);
400 stm_output_free(stm, &stmf->output);
403 * matches the stm_char_open()'s
404 * class_find_device() + try_module_get()
412 static int stm_file_assign(struct stm_file *stmf, char *id, unsigned int width)
414 struct stm_device *stm = stmf->stm;
417 stmf->policy_node = stp_policy_node_lookup(stm, id);
419 ret = stm_output_assign(stm, width, stmf->policy_node, &stmf->output);
421 if (stmf->policy_node)
422 stp_policy_node_put(stmf->policy_node);
427 static ssize_t stm_write(struct stm_data *data, unsigned int master,
428 unsigned int channel, const char *buf, size_t count)
430 unsigned int flags = STP_PACKET_TIMESTAMPED;
431 const unsigned char *p = buf, nil = 0;
435 for (pos = 0, p = buf; count > pos; pos += sz, p += sz) {
436 sz = min_t(unsigned int, count - pos, 8);
437 sz = data->packet(data, master, channel, STP_PACKET_DATA, flags,
445 data->packet(data, master, channel, STP_PACKET_FLAG, 0, 0, &nil);
450 static ssize_t stm_char_write(struct file *file, const char __user *buf,
451 size_t count, loff_t *ppos)
453 struct stm_file *stmf = file->private_data;
454 struct stm_device *stm = stmf->stm;
458 if (count + 1 > PAGE_SIZE)
459 count = PAGE_SIZE - 1;
462 * if no m/c have been assigned to this writer up to this
463 * point, use "default" policy entry
465 if (!stmf->output.nr_chans) {
466 err = stm_file_assign(stmf, "default", 1);
468 * EBUSY means that somebody else just assigned this
469 * output, which is just fine for write()
471 if (err && err != -EBUSY)
475 kbuf = kmalloc(count + 1, GFP_KERNEL);
479 err = copy_from_user(kbuf, buf, count);
485 count = stm_write(stm->data, stmf->output.master, stmf->output.channel,
493 static int stm_char_mmap(struct file *file, struct vm_area_struct *vma)
495 struct stm_file *stmf = file->private_data;
496 struct stm_device *stm = stmf->stm;
497 unsigned long size, phys;
499 if (!stm->data->mmio_addr)
505 size = vma->vm_end - vma->vm_start;
507 if (stmf->output.nr_chans * stm->data->sw_mmiosz != size)
510 phys = stm->data->mmio_addr(stm->data, stmf->output.master,
511 stmf->output.channel,
512 stmf->output.nr_chans);
517 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
518 vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
519 vm_iomap_memory(vma, phys, size);
524 static int stm_char_policy_set_ioctl(struct stm_file *stmf, void __user *arg)
526 struct stm_device *stm = stmf->stm;
527 struct stp_policy_id *id;
531 if (stmf->output.nr_chans)
534 if (copy_from_user(&size, arg, sizeof(size)))
537 if (size >= PATH_MAX + sizeof(*id))
541 * size + 1 to make sure the .id string at the bottom is terminated,
542 * which is also why memdup_user() is not useful here
544 id = kzalloc(size + 1, GFP_KERNEL);
548 if (copy_from_user(id, arg, size)) {
553 if (id->__reserved_0 || id->__reserved_1)
557 id->width > PAGE_SIZE / stm->data->sw_mmiosz)
560 ret = stm_file_assign(stmf, id->id, id->width);
565 ret = stm->data->link(stm->data, stmf->output.master,
566 stmf->output.channel);
569 stm_output_free(stmf->stm, &stmf->output);
577 static int stm_char_policy_get_ioctl(struct stm_file *stmf, void __user *arg)
579 struct stp_policy_id id = {
581 .master = stmf->output.master,
582 .channel = stmf->output.channel,
583 .width = stmf->output.nr_chans,
588 return copy_to_user(arg, &id, id.size) ? -EFAULT : 0;
592 stm_char_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
594 struct stm_file *stmf = file->private_data;
595 struct stm_data *stm_data = stmf->stm->data;
600 case STP_POLICY_ID_SET:
601 err = stm_char_policy_set_ioctl(stmf, (void __user *)arg);
605 return stm_char_policy_get_ioctl(stmf, (void __user *)arg);
607 case STP_POLICY_ID_GET:
608 return stm_char_policy_get_ioctl(stmf, (void __user *)arg);
610 case STP_SET_OPTIONS:
611 if (copy_from_user(&options, (u64 __user *)arg, sizeof(u64)))
614 if (stm_data->set_options)
615 err = stm_data->set_options(stm_data,
617 stmf->output.channel,
618 stmf->output.nr_chans,
631 stm_char_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
633 return stm_char_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
636 #define stm_char_compat_ioctl NULL
639 static const struct file_operations stm_fops = {
640 .open = stm_char_open,
641 .release = stm_char_release,
642 .write = stm_char_write,
643 .mmap = stm_char_mmap,
644 .unlocked_ioctl = stm_char_ioctl,
645 .compat_ioctl = stm_char_compat_ioctl,
649 static void stm_device_release(struct device *dev)
651 struct stm_device *stm = to_stm_device(dev);
656 int stm_register_device(struct device *parent, struct stm_data *stm_data,
657 struct module *owner)
659 struct stm_device *stm;
660 unsigned int nmasters;
664 return -EPROBE_DEFER;
666 if (!stm_data->packet || !stm_data->sw_nchannels)
669 nmasters = stm_data->sw_end - stm_data->sw_start + 1;
670 stm = kzalloc(sizeof(*stm) + nmasters * sizeof(void *), GFP_KERNEL);
674 stm->major = register_chrdev(0, stm_data->name, &stm_fops);
678 device_initialize(&stm->dev);
679 stm->dev.devt = MKDEV(stm->major, 0);
680 stm->dev.class = &stm_class;
681 stm->dev.parent = parent;
682 stm->dev.release = stm_device_release;
684 mutex_init(&stm->link_mutex);
685 spin_lock_init(&stm->link_lock);
686 INIT_LIST_HEAD(&stm->link_list);
688 /* initialize the object before it is accessible via sysfs */
689 spin_lock_init(&stm->mc_lock);
690 mutex_init(&stm->policy_mutex);
691 stm->sw_nmasters = nmasters;
693 stm->data = stm_data;
696 err = kobject_set_name(&stm->dev.kobj, "%s", stm_data->name);
700 err = device_add(&stm->dev);
707 unregister_chrdev(stm->major, stm_data->name);
709 /* matches device_initialize() above */
710 put_device(&stm->dev);
716 EXPORT_SYMBOL_GPL(stm_register_device);
718 static int __stm_source_link_drop(struct stm_source_device *src,
719 struct stm_device *stm);
721 void stm_unregister_device(struct stm_data *stm_data)
723 struct stm_device *stm = stm_data->stm;
724 struct stm_source_device *src, *iter;
727 mutex_lock(&stm->link_mutex);
728 list_for_each_entry_safe(src, iter, &stm->link_list, link_entry) {
729 ret = __stm_source_link_drop(src, stm);
731 * src <-> stm link must not change under the same
732 * stm::link_mutex, so complain loudly if it has;
733 * also in this situation ret!=0 means this src is
734 * not connected to this stm and it should be otherwise
735 * safe to proceed with the tear-down of stm.
739 mutex_unlock(&stm->link_mutex);
741 synchronize_srcu(&stm_source_srcu);
743 unregister_chrdev(stm->major, stm_data->name);
745 mutex_lock(&stm->policy_mutex);
747 stp_policy_unbind(stm->policy);
748 mutex_unlock(&stm->policy_mutex);
750 for (i = stm->data->sw_start; i <= stm->data->sw_end; i++)
751 stp_master_free(stm, i);
753 device_unregister(&stm->dev);
754 stm_data->stm = NULL;
756 EXPORT_SYMBOL_GPL(stm_unregister_device);
759 * stm::link_list access serialization uses a spinlock and a mutex; holding
760 * either of them guarantees that the list is stable; modification requires
761 * holding both of them.
763 * Lock ordering is as follows:
770 * stm_source_link_add() - connect an stm_source device to an stm device
771 * @src: stm_source device
774 * This function establishes a link from stm_source to an stm device so that
775 * the former can send out trace data to the latter.
777 * Return: 0 on success, -errno otherwise.
779 static int stm_source_link_add(struct stm_source_device *src,
780 struct stm_device *stm)
785 mutex_lock(&stm->link_mutex);
786 spin_lock(&stm->link_lock);
787 spin_lock(&src->link_lock);
789 /* src->link is dereferenced under stm_source_srcu but not the list */
790 rcu_assign_pointer(src->link, stm);
791 list_add_tail(&src->link_entry, &stm->link_list);
793 spin_unlock(&src->link_lock);
794 spin_unlock(&stm->link_lock);
795 mutex_unlock(&stm->link_mutex);
797 id = kstrdup(src->data->name, GFP_KERNEL);
800 stp_policy_node_lookup(stm, id);
805 err = stm_output_assign(stm, src->data->nr_chans,
806 src->policy_node, &src->output);
808 if (src->policy_node)
809 stp_policy_node_put(src->policy_node);
814 /* this is to notify the STM device that a new link has been made */
816 err = stm->data->link(stm->data, src->output.master,
817 src->output.channel);
820 goto fail_free_output;
822 /* this is to let the source carry out all necessary preparations */
824 src->data->link(src->data);
829 stm_output_free(stm, &src->output);
832 mutex_lock(&stm->link_mutex);
833 spin_lock(&stm->link_lock);
834 spin_lock(&src->link_lock);
836 rcu_assign_pointer(src->link, NULL);
837 list_del_init(&src->link_entry);
839 spin_unlock(&src->link_lock);
840 spin_unlock(&stm->link_lock);
841 mutex_unlock(&stm->link_mutex);
847 * __stm_source_link_drop() - detach stm_source from an stm device
848 * @src: stm_source device
851 * If @stm is @src::link, disconnect them from one another and put the
852 * reference on the @stm device.
854 * Caller must hold stm::link_mutex.
856 static int __stm_source_link_drop(struct stm_source_device *src,
857 struct stm_device *stm)
859 struct stm_device *link;
862 lockdep_assert_held(&stm->link_mutex);
864 /* for stm::link_list modification, we hold both mutex and spinlock */
865 spin_lock(&stm->link_lock);
866 spin_lock(&src->link_lock);
867 link = srcu_dereference_check(src->link, &stm_source_srcu, 1);
870 * The linked device may have changed since we last looked, because
871 * we weren't holding the src::link_lock back then; if this is the
872 * case, tell the caller to retry.
879 stm_output_free(link, &src->output);
880 list_del_init(&src->link_entry);
881 /* matches stm_find_device() from stm_source_link_store() */
882 stm_put_device(link);
883 rcu_assign_pointer(src->link, NULL);
886 spin_unlock(&src->link_lock);
887 spin_unlock(&stm->link_lock);
890 * Call the unlink callbacks for both source and stm, when we know
891 * that we have actually performed the unlinking.
894 if (src->data->unlink)
895 src->data->unlink(src->data);
897 if (stm->data->unlink)
898 stm->data->unlink(stm->data, src->output.master,
899 src->output.channel);
906 * stm_source_link_drop() - detach stm_source from its stm device
907 * @src: stm_source device
909 * Unlinking means disconnecting from source's STM device; after this
910 * writes will be unsuccessful until it is linked to a new STM device.
912 * This will happen on "stm_source_link" sysfs attribute write to undo
913 * the existing link (if any), or on linked STM device's de-registration.
915 static void stm_source_link_drop(struct stm_source_device *src)
917 struct stm_device *stm;
921 idx = srcu_read_lock(&stm_source_srcu);
923 * The stm device will be valid for the duration of this
924 * read section, but the link may change before we grab
925 * the src::link_lock in __stm_source_link_drop().
927 stm = srcu_dereference(src->link, &stm_source_srcu);
931 mutex_lock(&stm->link_mutex);
932 ret = __stm_source_link_drop(src, stm);
933 mutex_unlock(&stm->link_mutex);
936 srcu_read_unlock(&stm_source_srcu, idx);
938 /* if it did change, retry */
943 static ssize_t stm_source_link_show(struct device *dev,
944 struct device_attribute *attr,
947 struct stm_source_device *src = to_stm_source_device(dev);
948 struct stm_device *stm;
951 idx = srcu_read_lock(&stm_source_srcu);
952 stm = srcu_dereference(src->link, &stm_source_srcu);
953 ret = sprintf(buf, "%s\n",
954 stm ? dev_name(&stm->dev) : "<none>");
955 srcu_read_unlock(&stm_source_srcu, idx);
960 static ssize_t stm_source_link_store(struct device *dev,
961 struct device_attribute *attr,
962 const char *buf, size_t count)
964 struct stm_source_device *src = to_stm_source_device(dev);
965 struct stm_device *link;
968 stm_source_link_drop(src);
970 link = stm_find_device(buf);
974 err = stm_source_link_add(src, link);
976 /* matches the stm_find_device() above */
977 stm_put_device(link);
980 return err ? : count;
983 static DEVICE_ATTR_RW(stm_source_link);
985 static struct attribute *stm_source_attrs[] = {
986 &dev_attr_stm_source_link.attr,
990 ATTRIBUTE_GROUPS(stm_source);
992 static struct class stm_source_class = {
993 .name = "stm_source",
994 .dev_groups = stm_source_groups,
997 static void stm_source_device_release(struct device *dev)
999 struct stm_source_device *src = to_stm_source_device(dev);
1005 * stm_source_register_device() - register an stm_source device
1006 * @parent: parent device
1007 * @data: device description structure
1009 * This will create a device of stm_source class that can write
1010 * data to an stm device once linked.
1012 * Return: 0 on success, -errno otherwise.
1014 int stm_source_register_device(struct device *parent,
1015 struct stm_source_data *data)
1017 struct stm_source_device *src;
1021 return -EPROBE_DEFER;
1023 src = kzalloc(sizeof(*src), GFP_KERNEL);
1027 device_initialize(&src->dev);
1028 src->dev.class = &stm_source_class;
1029 src->dev.parent = parent;
1030 src->dev.release = stm_source_device_release;
1032 err = kobject_set_name(&src->dev.kobj, "%s", data->name);
1036 err = device_add(&src->dev);
1040 stm_output_init(&src->output);
1041 spin_lock_init(&src->link_lock);
1042 INIT_LIST_HEAD(&src->link_entry);
1049 put_device(&src->dev);
1054 EXPORT_SYMBOL_GPL(stm_source_register_device);
1057 * stm_source_unregister_device() - unregister an stm_source device
1058 * @data: device description that was used to register the device
1060 * This will remove a previously created stm_source device from the system.
1062 void stm_source_unregister_device(struct stm_source_data *data)
1064 struct stm_source_device *src = data->src;
1066 stm_source_link_drop(src);
1068 device_destroy(&stm_source_class, src->dev.devt);
1070 EXPORT_SYMBOL_GPL(stm_source_unregister_device);
1072 int stm_source_write(struct stm_source_data *data, unsigned int chan,
1073 const char *buf, size_t count)
1075 struct stm_source_device *src = data->src;
1076 struct stm_device *stm;
1079 if (!src->output.nr_chans)
1082 if (chan >= src->output.nr_chans)
1085 idx = srcu_read_lock(&stm_source_srcu);
1087 stm = srcu_dereference(src->link, &stm_source_srcu);
1089 count = stm_write(stm->data, src->output.master,
1090 src->output.channel + chan,
1095 srcu_read_unlock(&stm_source_srcu, idx);
1099 EXPORT_SYMBOL_GPL(stm_source_write);
1101 static int __init stm_core_init(void)
1105 err = class_register(&stm_class);
1109 err = class_register(&stm_source_class);
1113 err = stp_configfs_init();
1117 init_srcu_struct(&stm_source_srcu);
1124 class_unregister(&stm_source_class);
1126 class_unregister(&stm_class);
1131 module_init(stm_core_init);
1133 static void __exit stm_core_exit(void)
1135 cleanup_srcu_struct(&stm_source_srcu);
1136 class_unregister(&stm_source_class);
1137 class_unregister(&stm_class);
1138 stp_configfs_exit();
1141 module_exit(stm_core_exit);
1143 MODULE_LICENSE("GPL v2");
1144 MODULE_DESCRIPTION("System Trace Module device class");
1145 MODULE_AUTHOR("Alexander Shishkin <alexander.shishkin@linux.intel.com>");