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

Commit 9c33d608 authored by Utkarsh Saxena's avatar Utkarsh Saxena
Browse files

msm: rndis_ipa: fix to debug file system init failure



Do not consider debug file system init failure as
functional failure.

Modify the code to proceed further
driver initialization.

Change-Id: I821af8970b6c2ced55d6464b8a7b56a458fa7d79
Acked-by: default avatarJavid Mohammed <mjavid@qti.qualcomm.com>
Signed-off-by: default avatarUtkarsh Saxena <usaxena@codeaurora.org>
parent 92317fb0
Loading
Loading
Loading
Loading
+16 −11
Original line number Diff line number Diff line
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2016, 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
@@ -188,7 +188,7 @@ static ssize_t ecm_ipa_debugfs_enable_read(struct file *file,
		char __user *ubuf, size_t count, loff_t *ppos);
static ssize_t ecm_ipa_debugfs_atomic_read(struct file *file,
		char __user *ubuf, size_t count, loff_t *ppos);
static int ecm_ipa_debugfs_init(struct ecm_ipa_dev *ecm_ipa_ctx);
static void ecm_ipa_debugfs_init(struct ecm_ipa_dev *ecm_ipa_ctx);
static void ecm_ipa_debugfs_destroy(struct ecm_ipa_dev *ecm_ipa_ctx);
static int ecm_ipa_ep_registers_cfg(u32 usb_to_ipa_hdl, u32 ipa_to_usb_hdl);
static int ecm_ipa_ep_registers_dma_cfg(u32 usb_to_ipa_hdl,
@@ -301,10 +301,7 @@ int ecm_ipa_init(struct ecm_ipa_params *params)
		ECM_IPA_DEBUG("device_ready_notify() was not supplied");
	ecm_ipa_ctx->device_ready_notify = params->device_ready_notify;

	result = ecm_ipa_debugfs_init(ecm_ipa_ctx);
	if (result)
		goto fail_debugfs;
	ECM_IPA_DEBUG("debugfs entries were created\n");
	ecm_ipa_debugfs_init(ecm_ipa_ctx);

	result = ecm_ipa_set_device_ethernet_addr(net->dev_addr,
			params->device_ethaddr);
@@ -353,7 +350,6 @@ fail_register_netdev:
fail_set_device_ethernet:
fail_rules_cfg:
	ecm_ipa_debugfs_destroy(ecm_ipa_ctx);
fail_debugfs:
fail_netdev_priv:
	free_netdev(net);
fail_alloc_etherdev:
@@ -1389,8 +1385,9 @@ static ssize_t ecm_ipa_debugfs_atomic_read(struct file *file,
	return simple_read_from_buffer(ubuf, count, ppos, atomic_str, nbytes);
}

#ifdef CONFIG_DEBUG_FS

static int ecm_ipa_debugfs_init(struct ecm_ipa_dev *ecm_ipa_ctx)
static void ecm_ipa_debugfs_init(struct ecm_ipa_dev *ecm_ipa_ctx)
{
	const mode_t flags_read_write = S_IRUGO | S_IWUGO;
	const mode_t flags_read_only = S_IRUGO;
@@ -1400,7 +1397,7 @@ static int ecm_ipa_debugfs_init(struct ecm_ipa_dev *ecm_ipa_ctx)
	ECM_IPA_LOG_ENTRY();

	if (!ecm_ipa_ctx)
		return -EINVAL;
		return;

	ecm_ipa_ctx->directory = debugfs_create_dir("ecm_ipa", NULL);
	if (!ecm_ipa_ctx->directory) {
@@ -1460,13 +1457,14 @@ static int ecm_ipa_debugfs_init(struct ecm_ipa_dev *ecm_ipa_ctx)
		goto fail_file;
	}

	ECM_IPA_DEBUG("debugfs entries were created\n");
	ECM_IPA_LOG_EXIT();

	return 0;
	return;
fail_file:
	debugfs_remove_recursive(ecm_ipa_ctx->directory);
fail_directory:
	return -EFAULT;
	return;
}

static void ecm_ipa_debugfs_destroy(struct ecm_ipa_dev *ecm_ipa_ctx)
@@ -1474,6 +1472,13 @@ static void ecm_ipa_debugfs_destroy(struct ecm_ipa_dev *ecm_ipa_ctx)
	debugfs_remove_recursive(ecm_ipa_ctx->directory);
}

#else /* !CONFIG_DEBUG_FS*/

static void ecm_ipa_debugfs_init(struct ecm_ipa_dev *ecm_ipa_ctx) {}

static void ecm_ipa_debugfs_destroy(struct ecm_ipa_dev *ecm_ipa_ctx) {}

#endif /* CONFIG_DEBUG_FS */
/**
 * ecm_ipa_ep_cfg() - configure the USB endpoints for ECM
 *
+15 −10
Original line number Diff line number Diff line
@@ -307,7 +307,7 @@ static ssize_t rndis_ipa_debugfs_loopback_read(struct file *file,
static ssize_t rndis_ipa_debugfs_atomic_read(struct file *file,
		char __user *ubuf, size_t count, loff_t *ppos);
static void rndis_ipa_dump_skb(struct sk_buff *skb);
static int rndis_ipa_debugfs_init(struct rndis_ipa_dev *rndis_ipa_ctx);
static void rndis_ipa_debugfs_init(struct rndis_ipa_dev *rndis_ipa_ctx);
static void rndis_ipa_debugfs_destroy(struct rndis_ipa_dev *rndis_ipa_ctx);
static int rndis_ipa_ep_registers_cfg(u32 usb_to_ipa_hdl,
		u32 ipa_to_usb_hdl, u32 max_xfer_size_bytes_to_dev,
@@ -602,10 +602,7 @@ int rndis_ipa_init(struct ipa_usb_init_params *params)
	RNDIS_IPA_DEBUG("Needed headroom for RNDIS header set to %d\n",
		net->needed_headroom);

	result = rndis_ipa_debugfs_init(rndis_ipa_ctx);
	if (result)
		goto fail_debugfs;
	RNDIS_IPA_DEBUG("debugfs entries were created\n");
	rndis_ipa_debugfs_init(rndis_ipa_ctx);

	result = rndis_ipa_set_device_ethernet_addr(net->dev_addr,
			rndis_ipa_ctx->device_ethaddr);
@@ -662,7 +659,6 @@ fail_register_tx:
fail_set_device_ethernet:
fail_hdrs_cfg:
	rndis_ipa_debugfs_destroy(rndis_ipa_ctx);
fail_debugfs:
fail_netdev_priv:
	free_netdev(net);
fail_alloc_etherdev:
@@ -2182,10 +2178,11 @@ static void rndis_ipa_dump_skb(struct sk_buff *skb)
		skb->len);
}

#ifdef CONFIG_DEBUG_FS
/**
 * Creates the root folder for the driver
 */
static int rndis_ipa_debugfs_init(struct rndis_ipa_dev *rndis_ipa_ctx)
static void rndis_ipa_debugfs_init(struct rndis_ipa_dev *rndis_ipa_ctx)
{
	const mode_t flags_read_write = S_IRUGO | S_IWUGO;
	const mode_t flags_read_only = S_IRUGO;
@@ -2196,7 +2193,7 @@ static int rndis_ipa_debugfs_init(struct rndis_ipa_dev *rndis_ipa_ctx)
	RNDIS_IPA_LOG_ENTRY();

	if (!rndis_ipa_ctx)
		return -EINVAL;
		return;

	rndis_ipa_ctx->directory = debugfs_create_dir(DEBUGFS_DIR_NAME, NULL);
	if (!rndis_ipa_ctx->directory) {
@@ -2378,13 +2375,14 @@ static int rndis_ipa_debugfs_init(struct rndis_ipa_dev *rndis_ipa_ctx)
		goto fail_file;
	}

	RNDIS_IPA_DEBUG("debugfs entries were created\n");
	RNDIS_IPA_LOG_EXIT();

	return 0;
	return;
fail_file:
	debugfs_remove_recursive(rndis_ipa_ctx->directory);
fail_directory:
	return -EFAULT;
	return;
}

static void rndis_ipa_debugfs_destroy(struct rndis_ipa_dev *rndis_ipa_ctx)
@@ -2392,6 +2390,13 @@ static void rndis_ipa_debugfs_destroy(struct rndis_ipa_dev *rndis_ipa_ctx)
	debugfs_remove_recursive(rndis_ipa_ctx->directory);
}

#else /* !CONFIG_DEBUG_FS */

static void rndis_ipa_debugfs_init(struct rndis_ipa_dev *rndis_ipa_ctx) {}

static void rndis_ipa_debugfs_destroy(struct rndis_ipa_dev *rndis_ipa_ctx) {}

#endif /* CONFIG_DEBUG_FS*/

static int rndis_ipa_debugfs_aggr_open(struct inode *inode,
		struct file *file)