Loading drivers/soc/qcom/service-locator.c +0 −122 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ #include <linux/device.h> #include <linux/delay.h> #include <linux/workqueue.h> #include <linux/debugfs.h> #include <soc/qcom/msm_qmi_interface.h> #include <soc/qcom/service-locator.h> Loading Loading @@ -68,48 +67,6 @@ struct pd_qmi_data { DEFINE_MUTEX(service_init_mutex); struct pd_qmi_data service_locator; /* Please refer soc/qcom/service-locator.h for use about APIs defined here */ static ssize_t show_service_locator_status(struct class *cl, struct class_attribute *attr, char *buf) { return scnprintf(buf, PAGE_SIZE, "%x\n", locator_status); } static ssize_t store_service_locator_status(struct class *cl, struct class_attribute *attr, const char *buf, size_t size) { u32 val; if (kstrtos32(buf, 10, &val) < 0) goto err; if (val != LOCATOR_NOT_PRESENT && val != LOCATOR_PRESENT) goto err; mutex_lock(&service_init_mutex); locator_status = val; complete_all(&locator_status_known); mutex_unlock(&service_init_mutex); return size; err: pr_err("Invalid input parameters\n"); return -EINVAL; } static struct class_attribute service_locator_class_attr[] = { __ATTR(service_locator_status, S_IRUGO | S_IWUSR, show_service_locator_status, store_service_locator_status), __ATTR_NULL, }; static struct class service_locator_class = { .name = "service_locator", .owner = THIS_MODULE, .class_attrs = service_locator_class_attr, }; static int service_locator_svc_event_notify(struct notifier_block *this, unsigned long code, Loading Loading @@ -455,82 +412,3 @@ int find_subsys(const char *pd_path, char *subsys) return 0; } EXPORT_SYMBOL(find_subsys); static struct pd_qmi_client_data test_data; static ssize_t show_servloc(struct seq_file *f, void *unused) { int rc = 0, i = 0; char subsys[QMI_SERVREG_LOC_NAME_LENGTH_V01]; rc = get_service_location(&test_data); if (rc) { seq_printf(f, "Failed to get process domain!, rc = %d\n", rc); return -EIO; } seq_printf(f, "Service Name: %s\tTotal Domains: %d\n", test_data.service_name, test_data.total_domains); for (i = 0; i < test_data.total_domains; i++) { seq_printf(f, "Instance ID: %d\t ", test_data.domain_list[i].instance_id); seq_printf(f, "Domain Name: %s\n", test_data.domain_list[i].name); rc = find_subsys(test_data.domain_list[i].name, subsys); if (rc < 0) seq_printf(f, "No valid subsys found for %s!\n", test_data.domain_list[i].name); else seq_printf(f, "Subsys: %s\n", subsys); } return 0; } static ssize_t store_servloc(struct file *fp, const char __user *buf, size_t count, loff_t *unused) { if (!buf) return -EIO; snprintf(test_data.service_name, sizeof(test_data.service_name), "%.*s", (int) min((size_t)count - 1, (sizeof(test_data.service_name) - 1)), buf); return count; } static int servloc_open(struct inode *inode, struct file *file) { return single_open(file, (void *)show_servloc, inode->i_private); } static const struct file_operations servloc_fops = { .open = servloc_open, .read = seq_read, .write = store_servloc, .llseek = seq_lseek, .release = seq_release, }; static struct dentry *test_servloc_file; static int __init service_locator_init(void) { if (!enable) locator_status = LOCATOR_NOT_PRESENT; class_register(&service_locator_class); test_servloc_file = debugfs_create_file("test_servloc", S_IRUGO | S_IWUSR, NULL, NULL, &servloc_fops); if (!test_servloc_file) pr_err("Could not create test_servloc debugfs entry!"); return 0; } static void __exit service_locator_exit(void) { class_unregister(&service_locator_class); debugfs_remove(test_servloc_file); } module_init(service_locator_init); module_exit(service_locator_exit); drivers/soc/qcom/service-notifier.c +1 −178 Original line number Diff line number Diff line /* * Copyright (c) 2015, The Linux Foundation. All rights reserved. * Copyright (c) 2015, 2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading @@ -21,7 +21,6 @@ #include <linux/slab.h> #include <linux/of.h> #include <linux/err.h> #include <linux/debugfs.h> #include <linux/uaccess.h> #include <soc/qcom/subsystem_restart.h> Loading Loading @@ -662,179 +661,3 @@ int service_notif_unregister_notifier(void *service_notif_handle, &service_notif->service_notif_rcvr_list, nb); } EXPORT_SYMBOL(service_notif_unregister_notifier); struct service_notifier_test_data { char service_path[MAX_STRING_LEN]; int instance_id; struct notifier_block nb; void *service_notif_handle; }; static struct service_notifier_test_data test_data; static void print_service_provider_state(int notification, char *type) { if (notification == SERVREG_NOTIF_SERVICE_STATE_DOWN_V01) pr_info("%s: Service %s down!\n", type, test_data.service_path); else if (notification == SERVREG_NOTIF_SERVICE_STATE_UP_V01) pr_info("%s: Service %s up!\n", type, test_data.service_path); else if (notification == SERVREG_NOTIF_SERVICE_STATE_UNINIT_V01) pr_info("%s: Service %s state uninit!\n", type, test_data.service_path); else pr_info("%s: Service %s state Unknown 0x%x!\n", type, test_data.service_path, notification); } static int nb_callback(struct notifier_block *nb, unsigned long notification, void *data) { print_service_provider_state((int)notification, "Notification:"); return 0; } static ssize_t show_service_path(struct seq_file *f, void *unused) { if (test_data.service_notif_handle) seq_printf(f, "Service Path: %s\n", test_data.service_path); else seq_puts(f, "No existing notifier\n"); return 0; } static ssize_t set_service_notifier_register(struct file *fp, const char __user *buf, size_t count, loff_t *ppos) { int curr_state = INT_MAX, rc; if (!buf) return -EIO; if (test_data.service_notif_handle) { service_notif_unregister_notifier( test_data.service_notif_handle, &test_data.nb); test_data.service_notif_handle = NULL; pr_info("Unregistering existing notifier for %s\n", test_data.service_path); } rc = simple_write_to_buffer(test_data.service_path, MAX_STRING_LEN, ppos, buf, count - 1); if (rc != count - 1) { pr_err("Unable to read data into kernel buffer\n"); goto err; } test_data.nb.notifier_call = nb_callback; test_data.service_notif_handle = service_notif_register_notifier( test_data.service_path, test_data.instance_id, &test_data.nb, &curr_state); if (!IS_ERR(test_data.service_notif_handle)) { pr_info("Notifier Registered for service %s\n", test_data.service_path); print_service_provider_state(curr_state, "Initial State"); return count; } err: test_data.service_notif_handle = NULL; pr_err("Unable to register notifier for %s\n", test_data.service_path); return -EIO; } static int open_service_notifier_register(struct inode *inode, struct file *f) { return single_open(f, (void *) show_service_path, inode->i_private); } static const struct file_operations service_notifier_register_fops = { .open = open_service_notifier_register, .read = seq_read, .write = set_service_notifier_register, .llseek = seq_lseek, .release = seq_release, }; static ssize_t show_service_notifier_id(struct seq_file *f, void *unused) { seq_printf(f, "Service instance ID: %d\n", test_data.instance_id); return 0; } static ssize_t set_service_notifier_id(struct file *fp, const char __user *buf, size_t count, loff_t *unused) { int val, rc; char kbuf[MAX_STRING_LEN]; if (MAX_STRING_LEN < count) { rc = -EIO; goto err; } rc = copy_from_user(kbuf, buf, count); if (rc != 0) { rc = -EFAULT; goto err; } kbuf[count - 1] = '\0'; rc = kstrtoint(kbuf, 0, &val); if (rc < 0) goto err; test_data.instance_id = val; return count; err: pr_err("Invalid input parameters: rc = %d\n", rc); return rc; } static int open_service_notifier_id(struct inode *inode, struct file *f) { return single_open(f, (void *) show_service_notifier_id, inode->i_private); } static const struct file_operations service_notifier_id_fops = { .open = open_service_notifier_id, .read = seq_read, .write = set_service_notifier_id, .llseek = seq_lseek, .release = seq_release, }; static struct dentry *service_notifier_dir; static struct dentry *service_path_file; static struct dentry *service_id_file; static int __init service_notifier_init(void) { service_notifier_dir = debugfs_create_dir("service_notifier", NULL); if (service_notifier_dir) { service_path_file = debugfs_create_file("service_path", S_IRUGO | S_IWUSR, service_notifier_dir, NULL, &service_notifier_register_fops); if (!service_path_file) goto err; service_id_file = debugfs_create_file("service_id", S_IRUGO | S_IWUSR, service_notifier_dir, NULL, &service_notifier_id_fops); if (!service_id_file) goto err; } return 0; err: debugfs_remove_recursive(service_notifier_dir); return 0; } static void __exit service_notifier_exit(void) { debugfs_remove_recursive(service_notifier_dir); test_data.nb.notifier_call = nb_callback; } module_init(service_notifier_init); module_exit(service_notifier_exit); drivers/soc/qcom/subsystem_restart.c +2 −103 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ #include <linux/spinlock.h> #include <linux/device.h> #include <linux/idr.h> #include <linux/debugfs.h> #include <linux/interrupt.h> #include <linux/of_gpio.h> #include <linux/cdev.h> Loading Loading @@ -151,7 +150,6 @@ struct restart_log { * @keep_alive: whether keep alive during AP's panic * @restart_order: order of other devices this devices restarts with * @crash_count: number of times the device has crashed * @dentry: debugfs directory for this device * @do_ramdump_on_put: ramdump on subsystem_put() if true * @err_ready: completion variable to record error ready from subsystem * @crashed: indicates if subsystem has crashed Loading @@ -174,9 +172,6 @@ struct subsys_device { bool keep_alive; int crash_count; struct subsys_soc_restart_order *restart_order; #ifdef CONFIG_DEBUG_FS struct dentry *dentry; #endif bool do_ramdump_on_put; struct cdev char_dev; dev_t dev_no; Loading Loading @@ -381,10 +376,11 @@ static struct device_attribute subsys_attrs[] = { __ATTR_NULL, }; static struct bus_type subsys_bus_type = { struct bus_type subsys_bus_type = { .name = "msm_subsys", .dev_attrs = subsys_attrs, }; EXPORT_SYMBOL(subsys_bus_type); static DEFINE_IDA(subsys_ida); Loading Loading @@ -1212,87 +1208,6 @@ void notify_proxy_unvote(struct device *device) notify_each_subsys_device(&dev, 1, SUBSYS_PROXY_UNVOTE, NULL); } #ifdef CONFIG_DEBUG_FS static ssize_t subsys_debugfs_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) { int r; char buf[40]; struct subsys_device *subsys = filp->private_data; r = snprintf(buf, sizeof(buf), "%d\n", subsys->count); return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); } static ssize_t subsys_debugfs_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) { struct subsys_device *subsys = filp->private_data; char buf[10]; char *cmp; cnt = min(cnt, sizeof(buf) - 1); if (copy_from_user(&buf, ubuf, cnt)) return -EFAULT; buf[cnt] = '\0'; cmp = strstrip(buf); if (!strcmp(cmp, "restart")) { if (subsystem_restart_dev(subsys)) return -EIO; } else if (!strcmp(cmp, "get")) { if (subsystem_get(subsys->desc->name)) return -EIO; } else if (!strcmp(cmp, "put")) { subsystem_put(subsys); } else { return -EINVAL; } return cnt; } static const struct file_operations subsys_debugfs_fops = { .open = simple_open, .read = subsys_debugfs_read, .write = subsys_debugfs_write, }; static struct dentry *subsys_base_dir; static int __init subsys_debugfs_init(void) { subsys_base_dir = debugfs_create_dir("msm_subsys", NULL); return !subsys_base_dir ? -ENOMEM : 0; } static void subsys_debugfs_exit(void) { debugfs_remove_recursive(subsys_base_dir); } static int subsys_debugfs_add(struct subsys_device *subsys) { if (!subsys_base_dir) return -ENOMEM; subsys->dentry = debugfs_create_file(subsys->desc->name, S_IRUGO | S_IWUSR, subsys_base_dir, subsys, &subsys_debugfs_fops); return !subsys->dentry ? -ENOMEM : 0; } static void subsys_debugfs_remove(struct subsys_device *subsys) { debugfs_remove(subsys->dentry); } #else static int __init subsys_debugfs_init(void) { return 0; }; static void subsys_debugfs_exit(void) { } static int subsys_debugfs_add(struct subsys_device *subsys) { return 0; } static void subsys_debugfs_remove(struct subsys_device *subsys) { } #endif static int subsys_device_open(struct inode *inode, struct file *file) { struct subsys_device *device, *subsys_dev = 0; Loading Loading @@ -1732,17 +1647,8 @@ struct subsys_device *subsys_register(struct subsys_desc *desc) mutex_init(&subsys->track.lock); ret = subsys_debugfs_add(subsys); if (ret) { ida_simple_remove(&subsys_ida, subsys->id); wakeup_source_trash(&subsys->ssr_wlock); kfree(subsys); return ERR_PTR(ret); } ret = device_register(&subsys->dev); if (ret) { subsys_debugfs_remove(subsys); put_device(&subsys->dev); return ERR_PTR(ret); } Loading Loading @@ -1804,7 +1710,6 @@ err_setup_irqs: if (ofnode) subsys_remove_restart_order(ofnode); err_register: subsys_debugfs_remove(subsys); device_unregister(&subsys->dev); return ERR_PTR(ret); } Loading Loading @@ -1833,7 +1738,6 @@ void subsys_unregister(struct subsys_device *subsys) WARN_ON(subsys->count); device_unregister(&subsys->dev); mutex_unlock(&subsys->track.lock); subsys_debugfs_remove(subsys); subsys_char_device_remove(subsys); sysmon_notifier_unregister(subsys->desc); if (subsys->desc->edge) Loading Loading @@ -1879,9 +1783,6 @@ static int __init subsys_restart_init(void) ret = bus_register(&subsys_bus_type); if (ret) goto err_bus; ret = subsys_debugfs_init(); if (ret) goto err_debugfs; char_class = class_create(THIS_MODULE, "subsys"); if (IS_ERR(char_class)) { Loading @@ -1900,8 +1801,6 @@ static int __init subsys_restart_init(void) err_soc: class_destroy(char_class); err_class: subsys_debugfs_exit(); err_debugfs: bus_unregister(&subsys_bus_type); err_bus: destroy_workqueue(ssr_wq); Loading include/soc/qcom/subsystem_restart.h +1 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <linux/interrupt.h> struct subsys_device; extern struct bus_type subsys_bus_type; enum { RESET_SOC = 0, Loading Loading
drivers/soc/qcom/service-locator.c +0 −122 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ #include <linux/device.h> #include <linux/delay.h> #include <linux/workqueue.h> #include <linux/debugfs.h> #include <soc/qcom/msm_qmi_interface.h> #include <soc/qcom/service-locator.h> Loading Loading @@ -68,48 +67,6 @@ struct pd_qmi_data { DEFINE_MUTEX(service_init_mutex); struct pd_qmi_data service_locator; /* Please refer soc/qcom/service-locator.h for use about APIs defined here */ static ssize_t show_service_locator_status(struct class *cl, struct class_attribute *attr, char *buf) { return scnprintf(buf, PAGE_SIZE, "%x\n", locator_status); } static ssize_t store_service_locator_status(struct class *cl, struct class_attribute *attr, const char *buf, size_t size) { u32 val; if (kstrtos32(buf, 10, &val) < 0) goto err; if (val != LOCATOR_NOT_PRESENT && val != LOCATOR_PRESENT) goto err; mutex_lock(&service_init_mutex); locator_status = val; complete_all(&locator_status_known); mutex_unlock(&service_init_mutex); return size; err: pr_err("Invalid input parameters\n"); return -EINVAL; } static struct class_attribute service_locator_class_attr[] = { __ATTR(service_locator_status, S_IRUGO | S_IWUSR, show_service_locator_status, store_service_locator_status), __ATTR_NULL, }; static struct class service_locator_class = { .name = "service_locator", .owner = THIS_MODULE, .class_attrs = service_locator_class_attr, }; static int service_locator_svc_event_notify(struct notifier_block *this, unsigned long code, Loading Loading @@ -455,82 +412,3 @@ int find_subsys(const char *pd_path, char *subsys) return 0; } EXPORT_SYMBOL(find_subsys); static struct pd_qmi_client_data test_data; static ssize_t show_servloc(struct seq_file *f, void *unused) { int rc = 0, i = 0; char subsys[QMI_SERVREG_LOC_NAME_LENGTH_V01]; rc = get_service_location(&test_data); if (rc) { seq_printf(f, "Failed to get process domain!, rc = %d\n", rc); return -EIO; } seq_printf(f, "Service Name: %s\tTotal Domains: %d\n", test_data.service_name, test_data.total_domains); for (i = 0; i < test_data.total_domains; i++) { seq_printf(f, "Instance ID: %d\t ", test_data.domain_list[i].instance_id); seq_printf(f, "Domain Name: %s\n", test_data.domain_list[i].name); rc = find_subsys(test_data.domain_list[i].name, subsys); if (rc < 0) seq_printf(f, "No valid subsys found for %s!\n", test_data.domain_list[i].name); else seq_printf(f, "Subsys: %s\n", subsys); } return 0; } static ssize_t store_servloc(struct file *fp, const char __user *buf, size_t count, loff_t *unused) { if (!buf) return -EIO; snprintf(test_data.service_name, sizeof(test_data.service_name), "%.*s", (int) min((size_t)count - 1, (sizeof(test_data.service_name) - 1)), buf); return count; } static int servloc_open(struct inode *inode, struct file *file) { return single_open(file, (void *)show_servloc, inode->i_private); } static const struct file_operations servloc_fops = { .open = servloc_open, .read = seq_read, .write = store_servloc, .llseek = seq_lseek, .release = seq_release, }; static struct dentry *test_servloc_file; static int __init service_locator_init(void) { if (!enable) locator_status = LOCATOR_NOT_PRESENT; class_register(&service_locator_class); test_servloc_file = debugfs_create_file("test_servloc", S_IRUGO | S_IWUSR, NULL, NULL, &servloc_fops); if (!test_servloc_file) pr_err("Could not create test_servloc debugfs entry!"); return 0; } static void __exit service_locator_exit(void) { class_unregister(&service_locator_class); debugfs_remove(test_servloc_file); } module_init(service_locator_init); module_exit(service_locator_exit);
drivers/soc/qcom/service-notifier.c +1 −178 Original line number Diff line number Diff line /* * Copyright (c) 2015, The Linux Foundation. All rights reserved. * Copyright (c) 2015, 2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading @@ -21,7 +21,6 @@ #include <linux/slab.h> #include <linux/of.h> #include <linux/err.h> #include <linux/debugfs.h> #include <linux/uaccess.h> #include <soc/qcom/subsystem_restart.h> Loading Loading @@ -662,179 +661,3 @@ int service_notif_unregister_notifier(void *service_notif_handle, &service_notif->service_notif_rcvr_list, nb); } EXPORT_SYMBOL(service_notif_unregister_notifier); struct service_notifier_test_data { char service_path[MAX_STRING_LEN]; int instance_id; struct notifier_block nb; void *service_notif_handle; }; static struct service_notifier_test_data test_data; static void print_service_provider_state(int notification, char *type) { if (notification == SERVREG_NOTIF_SERVICE_STATE_DOWN_V01) pr_info("%s: Service %s down!\n", type, test_data.service_path); else if (notification == SERVREG_NOTIF_SERVICE_STATE_UP_V01) pr_info("%s: Service %s up!\n", type, test_data.service_path); else if (notification == SERVREG_NOTIF_SERVICE_STATE_UNINIT_V01) pr_info("%s: Service %s state uninit!\n", type, test_data.service_path); else pr_info("%s: Service %s state Unknown 0x%x!\n", type, test_data.service_path, notification); } static int nb_callback(struct notifier_block *nb, unsigned long notification, void *data) { print_service_provider_state((int)notification, "Notification:"); return 0; } static ssize_t show_service_path(struct seq_file *f, void *unused) { if (test_data.service_notif_handle) seq_printf(f, "Service Path: %s\n", test_data.service_path); else seq_puts(f, "No existing notifier\n"); return 0; } static ssize_t set_service_notifier_register(struct file *fp, const char __user *buf, size_t count, loff_t *ppos) { int curr_state = INT_MAX, rc; if (!buf) return -EIO; if (test_data.service_notif_handle) { service_notif_unregister_notifier( test_data.service_notif_handle, &test_data.nb); test_data.service_notif_handle = NULL; pr_info("Unregistering existing notifier for %s\n", test_data.service_path); } rc = simple_write_to_buffer(test_data.service_path, MAX_STRING_LEN, ppos, buf, count - 1); if (rc != count - 1) { pr_err("Unable to read data into kernel buffer\n"); goto err; } test_data.nb.notifier_call = nb_callback; test_data.service_notif_handle = service_notif_register_notifier( test_data.service_path, test_data.instance_id, &test_data.nb, &curr_state); if (!IS_ERR(test_data.service_notif_handle)) { pr_info("Notifier Registered for service %s\n", test_data.service_path); print_service_provider_state(curr_state, "Initial State"); return count; } err: test_data.service_notif_handle = NULL; pr_err("Unable to register notifier for %s\n", test_data.service_path); return -EIO; } static int open_service_notifier_register(struct inode *inode, struct file *f) { return single_open(f, (void *) show_service_path, inode->i_private); } static const struct file_operations service_notifier_register_fops = { .open = open_service_notifier_register, .read = seq_read, .write = set_service_notifier_register, .llseek = seq_lseek, .release = seq_release, }; static ssize_t show_service_notifier_id(struct seq_file *f, void *unused) { seq_printf(f, "Service instance ID: %d\n", test_data.instance_id); return 0; } static ssize_t set_service_notifier_id(struct file *fp, const char __user *buf, size_t count, loff_t *unused) { int val, rc; char kbuf[MAX_STRING_LEN]; if (MAX_STRING_LEN < count) { rc = -EIO; goto err; } rc = copy_from_user(kbuf, buf, count); if (rc != 0) { rc = -EFAULT; goto err; } kbuf[count - 1] = '\0'; rc = kstrtoint(kbuf, 0, &val); if (rc < 0) goto err; test_data.instance_id = val; return count; err: pr_err("Invalid input parameters: rc = %d\n", rc); return rc; } static int open_service_notifier_id(struct inode *inode, struct file *f) { return single_open(f, (void *) show_service_notifier_id, inode->i_private); } static const struct file_operations service_notifier_id_fops = { .open = open_service_notifier_id, .read = seq_read, .write = set_service_notifier_id, .llseek = seq_lseek, .release = seq_release, }; static struct dentry *service_notifier_dir; static struct dentry *service_path_file; static struct dentry *service_id_file; static int __init service_notifier_init(void) { service_notifier_dir = debugfs_create_dir("service_notifier", NULL); if (service_notifier_dir) { service_path_file = debugfs_create_file("service_path", S_IRUGO | S_IWUSR, service_notifier_dir, NULL, &service_notifier_register_fops); if (!service_path_file) goto err; service_id_file = debugfs_create_file("service_id", S_IRUGO | S_IWUSR, service_notifier_dir, NULL, &service_notifier_id_fops); if (!service_id_file) goto err; } return 0; err: debugfs_remove_recursive(service_notifier_dir); return 0; } static void __exit service_notifier_exit(void) { debugfs_remove_recursive(service_notifier_dir); test_data.nb.notifier_call = nb_callback; } module_init(service_notifier_init); module_exit(service_notifier_exit);
drivers/soc/qcom/subsystem_restart.c +2 −103 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ #include <linux/spinlock.h> #include <linux/device.h> #include <linux/idr.h> #include <linux/debugfs.h> #include <linux/interrupt.h> #include <linux/of_gpio.h> #include <linux/cdev.h> Loading Loading @@ -151,7 +150,6 @@ struct restart_log { * @keep_alive: whether keep alive during AP's panic * @restart_order: order of other devices this devices restarts with * @crash_count: number of times the device has crashed * @dentry: debugfs directory for this device * @do_ramdump_on_put: ramdump on subsystem_put() if true * @err_ready: completion variable to record error ready from subsystem * @crashed: indicates if subsystem has crashed Loading @@ -174,9 +172,6 @@ struct subsys_device { bool keep_alive; int crash_count; struct subsys_soc_restart_order *restart_order; #ifdef CONFIG_DEBUG_FS struct dentry *dentry; #endif bool do_ramdump_on_put; struct cdev char_dev; dev_t dev_no; Loading Loading @@ -381,10 +376,11 @@ static struct device_attribute subsys_attrs[] = { __ATTR_NULL, }; static struct bus_type subsys_bus_type = { struct bus_type subsys_bus_type = { .name = "msm_subsys", .dev_attrs = subsys_attrs, }; EXPORT_SYMBOL(subsys_bus_type); static DEFINE_IDA(subsys_ida); Loading Loading @@ -1212,87 +1208,6 @@ void notify_proxy_unvote(struct device *device) notify_each_subsys_device(&dev, 1, SUBSYS_PROXY_UNVOTE, NULL); } #ifdef CONFIG_DEBUG_FS static ssize_t subsys_debugfs_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos) { int r; char buf[40]; struct subsys_device *subsys = filp->private_data; r = snprintf(buf, sizeof(buf), "%d\n", subsys->count); return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); } static ssize_t subsys_debugfs_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) { struct subsys_device *subsys = filp->private_data; char buf[10]; char *cmp; cnt = min(cnt, sizeof(buf) - 1); if (copy_from_user(&buf, ubuf, cnt)) return -EFAULT; buf[cnt] = '\0'; cmp = strstrip(buf); if (!strcmp(cmp, "restart")) { if (subsystem_restart_dev(subsys)) return -EIO; } else if (!strcmp(cmp, "get")) { if (subsystem_get(subsys->desc->name)) return -EIO; } else if (!strcmp(cmp, "put")) { subsystem_put(subsys); } else { return -EINVAL; } return cnt; } static const struct file_operations subsys_debugfs_fops = { .open = simple_open, .read = subsys_debugfs_read, .write = subsys_debugfs_write, }; static struct dentry *subsys_base_dir; static int __init subsys_debugfs_init(void) { subsys_base_dir = debugfs_create_dir("msm_subsys", NULL); return !subsys_base_dir ? -ENOMEM : 0; } static void subsys_debugfs_exit(void) { debugfs_remove_recursive(subsys_base_dir); } static int subsys_debugfs_add(struct subsys_device *subsys) { if (!subsys_base_dir) return -ENOMEM; subsys->dentry = debugfs_create_file(subsys->desc->name, S_IRUGO | S_IWUSR, subsys_base_dir, subsys, &subsys_debugfs_fops); return !subsys->dentry ? -ENOMEM : 0; } static void subsys_debugfs_remove(struct subsys_device *subsys) { debugfs_remove(subsys->dentry); } #else static int __init subsys_debugfs_init(void) { return 0; }; static void subsys_debugfs_exit(void) { } static int subsys_debugfs_add(struct subsys_device *subsys) { return 0; } static void subsys_debugfs_remove(struct subsys_device *subsys) { } #endif static int subsys_device_open(struct inode *inode, struct file *file) { struct subsys_device *device, *subsys_dev = 0; Loading Loading @@ -1732,17 +1647,8 @@ struct subsys_device *subsys_register(struct subsys_desc *desc) mutex_init(&subsys->track.lock); ret = subsys_debugfs_add(subsys); if (ret) { ida_simple_remove(&subsys_ida, subsys->id); wakeup_source_trash(&subsys->ssr_wlock); kfree(subsys); return ERR_PTR(ret); } ret = device_register(&subsys->dev); if (ret) { subsys_debugfs_remove(subsys); put_device(&subsys->dev); return ERR_PTR(ret); } Loading Loading @@ -1804,7 +1710,6 @@ err_setup_irqs: if (ofnode) subsys_remove_restart_order(ofnode); err_register: subsys_debugfs_remove(subsys); device_unregister(&subsys->dev); return ERR_PTR(ret); } Loading Loading @@ -1833,7 +1738,6 @@ void subsys_unregister(struct subsys_device *subsys) WARN_ON(subsys->count); device_unregister(&subsys->dev); mutex_unlock(&subsys->track.lock); subsys_debugfs_remove(subsys); subsys_char_device_remove(subsys); sysmon_notifier_unregister(subsys->desc); if (subsys->desc->edge) Loading Loading @@ -1879,9 +1783,6 @@ static int __init subsys_restart_init(void) ret = bus_register(&subsys_bus_type); if (ret) goto err_bus; ret = subsys_debugfs_init(); if (ret) goto err_debugfs; char_class = class_create(THIS_MODULE, "subsys"); if (IS_ERR(char_class)) { Loading @@ -1900,8 +1801,6 @@ static int __init subsys_restart_init(void) err_soc: class_destroy(char_class); err_class: subsys_debugfs_exit(); err_debugfs: bus_unregister(&subsys_bus_type); err_bus: destroy_workqueue(ssr_wq); Loading
include/soc/qcom/subsystem_restart.h +1 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <linux/interrupt.h> struct subsys_device; extern struct bus_type subsys_bus_type; enum { RESET_SOC = 0, Loading