Skip to content

Commit

Permalink
soc: qcom: remove debugfs interface from ssr
Browse files Browse the repository at this point in the history
As debugfs interface is intended to test the respective ssr, remove
from the driver to make sure it won't be available by default.

CRs-Fixed: 2025661
Change-Id: I6af9a8333c8028611f889cc2f9b0beb37ef12c9b
Signed-off-by: Satya Durga Srinivasu Prabhala <[email protected]>
  • Loading branch information
Satya Durga Srinivasu Prabhala authored and Shreyas Narayan committed Apr 25, 2017
1 parent ef9d8a1 commit 332639f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 100 deletions.
101 changes: 2 additions & 99 deletions drivers/soc/qcom/subsystem_restart.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,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>
Expand Down Expand Up @@ -146,7 +145,6 @@ struct restart_log {
* @restart_level: restart level (0 - panic, 1 - related, 2 - independent, etc.)
* @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
Expand All @@ -168,9 +166,6 @@ struct subsys_device {
int restart_level;
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;
Expand Down Expand Up @@ -306,10 +301,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);

Expand Down Expand Up @@ -1052,87 +1048,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;
Expand Down Expand Up @@ -1544,10 +1459,6 @@ struct subsys_device *subsys_register(struct subsys_desc *desc)

mutex_init(&subsys->track.lock);

ret = subsys_debugfs_add(subsys);
if (ret)
goto err_debugfs;

ret = device_register(&subsys->dev);
if (ret) {
device_unregister(&subsys->dev);
Expand Down Expand Up @@ -1599,8 +1510,6 @@ struct subsys_device *subsys_register(struct subsys_desc *desc)
if (ofnode)
subsys_remove_restart_order(ofnode);
err_register:
subsys_debugfs_remove(subsys);
err_debugfs:
mutex_destroy(&subsys->track.lock);
ida_simple_remove(&subsys_ida, subsys->id);
err_ida:
Expand Down Expand Up @@ -1633,7 +1542,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);
put_device(&subsys->dev);
Expand Down Expand Up @@ -1671,9 +1579,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)) {
Expand All @@ -1692,8 +1597,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);
Expand Down
3 changes: 2 additions & 1 deletion include/soc/qcom/subsystem_restart.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-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
Expand All @@ -18,6 +18,7 @@
#include <linux/interrupt.h>

struct subsys_device;
extern struct bus_type subsys_bus_type;

enum {
RESET_SOC = 0,
Expand Down

0 comments on commit 332639f

Please sign in to comment.