soc: qcom: code cleanup for service-locator
Module parameter already exists to control enabling service-locator, which is enabled by default using kernel command line. Hence removing sysfs entry 'service_locator_status'. CRs-Fixed: 1025447 Change-Id: Ie302e79ff838837f214ac50ebfaa6e11f0055915 Signed-off-by: Puja Gupta <pujag@codeaurora.org>
This commit is contained in:
parent
d60cc82391
commit
06ab5bc8cf
1 changed files with 4 additions and 70 deletions
|
@ -39,15 +39,11 @@
|
||||||
|
|
||||||
#define LOCATOR_NOT_PRESENT 0
|
#define LOCATOR_NOT_PRESENT 0
|
||||||
#define LOCATOR_PRESENT 1
|
#define LOCATOR_PRESENT 1
|
||||||
#define LOCATOR_UNKNOWN -1
|
|
||||||
|
|
||||||
static u32 locator_status = LOCATOR_UNKNOWN;
|
static u32 locator_status = LOCATOR_NOT_PRESENT;
|
||||||
static bool service_inited;
|
static bool service_inited;
|
||||||
|
|
||||||
int enable;
|
module_param_named(enable, locator_status, uint, S_IRUGO | S_IWUSR);
|
||||||
module_param(enable, int, 0);
|
|
||||||
|
|
||||||
DECLARE_COMPLETION(locator_status_known);
|
|
||||||
|
|
||||||
static void service_locator_svc_arrive(struct work_struct *work);
|
static void service_locator_svc_arrive(struct work_struct *work);
|
||||||
static void service_locator_svc_exit(struct work_struct *work);
|
static void service_locator_svc_exit(struct work_struct *work);
|
||||||
|
@ -70,47 +66,6 @@ struct pd_qmi_data service_locator;
|
||||||
|
|
||||||
/* Please refer soc/qcom/service-locator.h for use about APIs defined here */
|
/* 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,
|
static int service_locator_svc_event_notify(struct notifier_block *this,
|
||||||
unsigned long code,
|
unsigned long code,
|
||||||
void *_cmd)
|
void *_cmd)
|
||||||
|
@ -338,30 +293,13 @@ static int init_service_locator(void)
|
||||||
|
|
||||||
mutex_lock(&service_init_mutex);
|
mutex_lock(&service_init_mutex);
|
||||||
if (locator_status == LOCATOR_NOT_PRESENT) {
|
if (locator_status == LOCATOR_NOT_PRESENT) {
|
||||||
pr_err("Service Locator not present\n");
|
pr_err("Service Locator not enabled\n");
|
||||||
rc = -ENODEV;
|
rc = -ENODEV;
|
||||||
goto inited;
|
goto inited;
|
||||||
}
|
}
|
||||||
if (service_inited)
|
if (service_inited)
|
||||||
goto inited;
|
goto inited;
|
||||||
|
|
||||||
if (locator_status != LOCATOR_PRESENT) {
|
|
||||||
mutex_unlock(&service_init_mutex);
|
|
||||||
rc = wait_for_completion_timeout(&locator_status_known,
|
|
||||||
msecs_to_jiffies(INITIAL_TIMEOUT));
|
|
||||||
if (!rc) {
|
|
||||||
locator_status = LOCATOR_NOT_PRESENT;
|
|
||||||
pr_err("Timed out waiting for Service Locator\n");
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
mutex_lock(&service_init_mutex);
|
|
||||||
if (locator_status == LOCATOR_NOT_PRESENT) {
|
|
||||||
pr_err("Service Locator not present\n");
|
|
||||||
rc = -ENODEV;
|
|
||||||
goto inited;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
service_locator.notifier.notifier_call =
|
service_locator.notifier.notifier_call =
|
||||||
service_locator_svc_event_notify;
|
service_locator_svc_event_notify;
|
||||||
init_completion(&service_locator.service_available);
|
init_completion(&service_locator.service_available);
|
||||||
|
@ -509,10 +447,7 @@ static struct dentry *test_servloc_file;
|
||||||
|
|
||||||
static int __init service_locator_init(void)
|
static int __init service_locator_init(void)
|
||||||
{
|
{
|
||||||
if (!enable)
|
pr_debug("service_locator_status = %d\n", locator_status);
|
||||||
locator_status = LOCATOR_NOT_PRESENT;
|
|
||||||
|
|
||||||
class_register(&service_locator_class);
|
|
||||||
test_servloc_file = debugfs_create_file("test_servloc",
|
test_servloc_file = debugfs_create_file("test_servloc",
|
||||||
S_IRUGO | S_IWUSR, NULL, NULL,
|
S_IRUGO | S_IWUSR, NULL, NULL,
|
||||||
&servloc_fops);
|
&servloc_fops);
|
||||||
|
@ -523,7 +458,6 @@ static int __init service_locator_init(void)
|
||||||
|
|
||||||
static void __exit service_locator_exit(void)
|
static void __exit service_locator_exit(void)
|
||||||
{
|
{
|
||||||
class_unregister(&service_locator_class);
|
|
||||||
debugfs_remove(test_servloc_file);
|
debugfs_remove(test_servloc_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue