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

Commit d0d6a47d authored by Ravi Aravamudhan's avatar Ravi Aravamudhan
Browse files

diag: dci: Initialize diag dci channels correctly



Diag driver initializes the DCI channel workqueues after
registering with SMD. In some cases, the driver can be notified
of channel open before the intialization is complete. This path
initializes the DCI channel workqueues before registering with
SMD.

Change-Id: I93c74a14e5aff0b9eadc2bff3da859fc4aa49891
Signed-off-by: default avatarRavi Aravamudhan <aravamud@codeaurora.org>
parent d5265a85
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -2515,7 +2515,6 @@ err:
int diag_dci_init(void)
{
	int ret = 0;
	uint8_t peripheral;

	driver->dci_tag = 0;
	driver->dci_client_id = 0;
@@ -2529,11 +2528,6 @@ int diag_dci_init(void)
	if (ret)
		goto err;

	for (peripheral = 0; peripheral < NUM_PERIPHERALS; peripheral++) {
		diagfwd_open(peripheral, TYPE_DCI);
		diagfwd_open(peripheral, TYPE_DCI_CMD);
	}

	if (driver->apps_dci_buf == NULL) {
		driver->apps_dci_buf = kzalloc(DCI_BUF_SIZE, GFP_KERNEL);
		if (driver->apps_dci_buf == NULL)
@@ -2563,6 +2557,16 @@ err:
	return DIAG_DCI_NO_REG;
}

void diag_dci_channel_init(void)
{
	uint8_t peripheral;

	for (peripheral = 0; peripheral < NUM_PERIPHERALS; peripheral++) {
		diagfwd_open(peripheral, TYPE_DCI);
		diagfwd_open(peripheral, TYPE_DCI_CMD);
	}
}

void diag_dci_exit(void)
{
	kfree(partial_pkt.data);
+1 −0
Original line number Diff line number Diff line
@@ -262,6 +262,7 @@ extern struct mutex dci_stat_mutex;
#endif

int diag_dci_init(void);
void diag_dci_channel_init(void);
void diag_dci_exit(void);
int diag_dci_register_client(struct diag_dci_reg_tbl_t *reg_entry);
int diag_dci_deinit_client(struct diag_dci_client_tbl *entry);
+3 −1
Original line number Diff line number Diff line
@@ -2961,11 +2961,13 @@ static int __init diagchar_init(void)
	ret = diagfwd_cntl_init();
	if (ret)
		goto fail;
	driver->dci_state = diag_dci_init();
	ret = diagfwd_peripheral_init();
	if (ret)
		goto fail;
	diagfwd_cntl_channel_init();
	driver->dci_state = diag_dci_init();
	if (driver->dci_state == DIAG_DCI_NO_ERROR)
		diag_dci_channel_init();
	pr_debug("diagchar initializing ..\n");
	driver->num = 1;
	driver->name = ((void *)driver) + sizeof(struct diagchar_dev);