Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c2f35ab authored by Gaurav Kohli's avatar Gaurav Kohli Committed by Gerrit - the friendly Code Review server
Browse files

soc: qcom: service-notifier: Create qmi_client per service path



As per current design each different pd service running on same
subsytem are using same qmi connection from HLOS pil, but it
has own disadvantages if each service crashed simultaneously and
using the same per client workqueue and override each other's data. To
overcome the same and to avoid much driver change creating qmi client
per service.

Change-Id: I45096798fb35d50903d7c99d42ae5ce16becf063
Signed-off-by: default avatarGaurav Kohli <gkohli@codeaurora.org>
parent d4a4e3c2
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2018, 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
@@ -98,6 +98,7 @@ struct ind_req_resp {
 */
struct qmi_client_info {
	int instance_id;
	char service_path[SERVREG_NOTIF_NAME_LENGTH];
	enum pd_subsys_state subsys_state;
	struct work_struct svc_arrive;
	struct work_struct svc_exit;
@@ -390,7 +391,8 @@ static void root_service_service_arrive(struct work_struct *work)
	mutex_lock(&notif_add_lock);
	mutex_lock(&service_list_lock);
	list_for_each_entry(service_notif, &service_list, list) {
		if (service_notif->instance_id == data->instance_id) {
		if (service_notif->instance_id == data->instance_id && !strcmp
			(service_notif->service_path, data->service_path)) {
			enum pd_subsys_state state = ROOT_PD_UP;
			rc = register_notif_listener(service_notif, data,
								&curr_state);
@@ -424,7 +426,8 @@ static void root_service_service_exit(struct qmi_client_info *data,
	mutex_lock(&notif_add_lock);
	mutex_lock(&service_list_lock);
	list_for_each_entry(service_notif, &service_list, list) {
		if (service_notif->instance_id == data->instance_id) {
		if (service_notif->instance_id == data->instance_id && !strcmp
			(data->service_path, service_notif->service_path)) {
			rc = service_notif_queue_notification(service_notif,
					SERVREG_NOTIF_SERVICE_STATE_DOWN_V01,
					&state);
@@ -534,7 +537,8 @@ static void *add_service_notif(const char *service_path, int instance_id,
	 */
	mutex_lock(&qmi_list_lock);
	list_for_each_entry(tmp, &qmi_client_list, list) {
		if (tmp->instance_id == instance_id) {
		if (tmp->instance_id == instance_id && !strcmp
				(tmp->service_path, service_path)) {
			if (tmp->service_connected) {
				rc = register_notif_listener(service_notif, tmp,
								curr_state);
@@ -560,6 +564,8 @@ static void *add_service_notif(const char *service_path, int instance_id,
	}

	qmi_data->instance_id = instance_id;
	strlcpy(qmi_data->service_path, service_path,
		ARRAY_SIZE(service_notif->service_path));
	init_rwsem(&qmi_data->qmi_client_handle_rwlock);
	qmi_data->clnt_handle = NULL;
	qmi_data->notifier.notifier_call = service_event_notify;
@@ -680,7 +686,8 @@ int service_notif_pd_restart(const char *service_path, int instance_id)
	int rc = 0;

	list_for_each_entry(tmp, &qmi_client_list, list) {
		if (tmp->instance_id == instance_id) {
		if (tmp->instance_id == instance_id && !strcmp
				(tmp->service_path, service_path)) {
			if (tmp->service_connected) {
				pr_info("Restarting service %s, instance-id %d\n",
						service_path, instance_id);