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

Commit 5c9e4285 authored by Larry Finger's avatar Larry Finger
Browse files

staging: rtl8192e: Remove dead code associated with CONFIG_RTLWIFI_DEBUGFS

parent 25d289fb
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -1718,9 +1718,6 @@ void rtl819x_watchdog_wqcallback(void *data)
		if ((ieee->iw_mode == IW_MODE_INFRA) && (ieee->state == RTLLIB_NOLINK) &&\
		    (ieee->eRFPowerState == eRfOn)&&!ieee->is_set_key &&\
		    (!ieee->proto_stoppping) && !ieee->wx_set_enc
#ifdef CONFIG_RTLWIFI_DEBUGFS
		    && (!priv->debug->hw_holding)
#endif
		 ){
			if ((ieee->PowerSaveControl.ReturnPoint == IPS_CALLBACK_NONE)&&
			    (!ieee->bNetPromiscuousMode))
+0 −4
Original line number Diff line number Diff line
@@ -590,10 +590,6 @@ typedef struct r8192_priv
	struct rtl819x_ops			*ops;
	struct rtllib_device			*rtllib;

#ifdef CONFIG_RTLWIFI_DEBUGFS
	rtl_fs_debug				*debug;
#endif /* CONFIG_IWLWIFI_DEBUGFS */

	work_struct_rsl				reset_wq;

	LOG_INTERRUPT_8190_T	InterruptLog;
+0 −174
Original line number Diff line number Diff line
@@ -109,180 +109,6 @@ void rtl8192_dump_reg(struct net_device *dev)
	printk("\n");
}

#ifdef CONFIG_RTLWIFI_DEBUGFS
/* debugfs related stuff */
static struct dentry *rtl_debugfs_root;
static int rtl_dbgfs_open(struct inode *inode, struct file *file)
{
	file->private_data = inode->i_private;
	return 0;
}

static ssize_t rtl_dbgfs_register_write(struct file *file,
		const char __user *user_buf,
		size_t count,
		loff_t *ppos)
{
	struct r8192_priv *priv = (struct r8192_priv *)file->private_data;
	char buf[32];
	int buf_size;
	u32 type, offset;

	memset(buf, 0, sizeof(buf));
	buf_size = min(count, sizeof(buf) -  1);
	if (copy_from_user(buf, user_buf, buf_size))
		return -EFAULT;

	if (sscanf(buf, "%x,%x", &type, &offset ) == 2) {
		priv->debug->hw_type = type;
		priv->debug->hw_offset = offset;
	} else {
		priv->debug->hw_type = 0;
		priv->debug->hw_offset = 0;
	}

	return count;
}

void  rtl_hardware_grab(struct net_device *dev)
{
	struct r8192_priv *priv = rtllib_priv(dev);
	int t = 0;
	int timeout = 20;
	u32 mask = RF_CHANGE_BY_HW|RF_CHANGE_BY_PS|RF_CHANGE_BY_IPS;

	priv->debug->hw_holding = true;
	rtllib_ips_leave_wq(dev);
	do {
		if ((priv->rtllib->RfOffReason & mask)) {
			msleep(100);
			t++;
		} else {
			return;
		}
	} while (t < timeout);

	return;
}

static ssize_t rtl_dbgfs_register_read(struct file *file,
		char __user *user_buf,
		size_t count,
		loff_t *ppos)
{
	struct r8192_priv *priv = (struct r8192_priv *)file->private_data;
	struct net_device *dev = priv->rtllib->dev;
	ssize_t ret = 0;
	char buf[2048];
	int n,i;
	u32 len = 0;
	u32 max = 0xff;
	u32 page_no, path;

	rtl_hardware_grab(dev);

	if (!priv->debug->hw_type) {
		page_no = (priv->debug->hw_offset > 0x0f)? 0x0f: priv->debug->hw_offset;
		{
			len += snprintf(buf + len,count - len,
					"\n#################### MAC page- %x##################\n ", page_no);
			for (n=0;n<=max;) {
				len += snprintf(buf + len, count - len, "\nD:  %2x > ",n);
				for (i=0;i<16 && n<=max;i++,n++)
					len += snprintf(buf + len, count - len,
							"%2.2x ",read_nic_byte(dev,((page_no<<8)|n)));
			}
		}
	} else {
		path = (priv->debug->hw_offset < RF90_PATH_MAX)? priv->debug->hw_offset:(RF90_PATH_MAX - 1);
		len += snprintf(buf + len, count - len,
				"\n#################### RF-PATH-%x ##################\n ", 0x0a+path);
		for (n=0;n<=max;) {
			len += snprintf(buf+ len, count - len, "\nD:  %2x > ",n);
			for (i=0;i<4 && n<=max;n+=4,i++)
				len += snprintf(buf + len, count - len,
					"%8.8x ",rtl8192_phy_QueryRFReg(dev, (RF90_RADIO_PATH_E)path,\
						n, bMaskDWord));
		}
	}

	priv->debug->hw_holding = false;

	len += snprintf(buf + len, count - len, "\n");
	ret = simple_read_from_buffer(user_buf, count, ppos, buf, len);
	return ret;
}

static const struct file_operations rtl_register_debug = {
	.read   = rtl_dbgfs_register_read,
	.write  = rtl_dbgfs_register_write,
	.open   = rtl_dbgfs_open,
	.owner  = THIS_MODULE
};

int rtl_debug_module_init(struct r8192_priv *priv, const char *name)
{
	rtl_fs_debug *debug;
	int ret = 0;

	if (!rtl_debugfs_root)
		return -ENOENT;

	debug = kzalloc(sizeof(rtl_fs_debug), GFP_KERNEL);
	if (!debug) {
		ret = -ENOMEM;
		goto err;
	}
	priv->debug = debug;

	debug->name = name;
	debug->dir_drv = debugfs_create_dir(name, rtl_debugfs_root);
	if (!debug->dir_drv ) {
		ret = -ENOENT;
		goto err;
	}

	debug->debug_register = debugfs_create_file("debug_register", S_IRUGO,
			 debug->dir_drv, priv, &rtl_register_debug);
	if (!debug->debug_register) {
		ret = -ENOENT;
		goto err;
	}

	return 0;
err:
        RT_TRACE(COMP_DBG, "Can't open the debugfs directory\n");
        rtl_debug_module_remove(priv);
        return ret;

}

void rtl_debug_module_remove(struct r8192_priv *priv)
{
	if (!priv->debug)
		return;
	debugfs_remove(priv->debug->debug_register);
	debugfs_remove(priv->debug->dir_drv);
	kfree(priv->debug);
	priv->debug = NULL;
}

int rtl_create_debugfs_root(void)
{
	rtl_debugfs_root = debugfs_create_dir(DRV_NAME, NULL);
	if (!rtl_debugfs_root)
		return -ENOENT;

	return 0;
}

void rtl_remove_debugfs_root(void)
{
	debugfs_remove(rtl_debugfs_root);
	rtl_debugfs_root = NULL;
}
#endif

/****************************************************************************
   -----------------------------PROCFS STUFF-------------------------
*****************************************************************************/
+0 −7
Original line number Diff line number Diff line
@@ -272,12 +272,6 @@ void dump_eprom(struct net_device *dev);
void rtl8192_dump_reg(struct net_device *dev);

/* debugfs stuff */
#ifdef CONFIG_RTLWIFI_DEBUGFS
int rtl_debug_module_init(struct r8192_priv *priv, const char *name);
void rtl_debug_module_remove(struct r8192_priv *priv);
int rtl_create_debugfs_root(void);
void rtl_remove_debugfs_root(void);
#else
static inline int rtl_debug_module_init(struct r8192_priv *priv, const char *name) {
	return 0;
}
@@ -289,7 +283,6 @@ static inline int rtl_create_debugfs_root(void) {
}
static inline void rtl_remove_debugfs_root(void) {
}
#endif

/* proc stuff */
void rtl8192_proc_init_one(struct net_device *dev);
+0 −5
Original line number Diff line number Diff line
@@ -42,11 +42,6 @@ void rtl8192_hw_sleep_down(struct net_device *dev)
	spin_unlock_irqrestore(&priv->rf_ps_lock,flags);
	RT_TRACE(COMP_DBG, "%s()============>come to sleep down\n", __func__);

#ifdef CONFIG_RTLWIFI_DEBUGFS
	if (priv->debug->hw_holding) {
		return;
	}
#endif
	MgntActSet_RF_State(dev, eRfSleep, RF_CHANGE_BY_PS,false);
}