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

Commit 5af08f0e authored by Himanshu Aggarwal's avatar Himanshu Aggarwal
Browse files

input: synaptics_i2c_rmi4: Reorganize the code



Reorganize the code related to debugfs that allows driver to compile
for different build environments. Remove dead code and also define
dummy functions that are needed when CONFIG_PM is not enabled in defconfig.

Change-Id: I385d194c7463cd06322f1b5124f1dc0ce72fc8a1
Signed-off-by: default avatarHimanshu Aggarwal <haggarwa@codeaurora.org>
parent 6e47bd57
Loading
Loading
Loading
Loading
+44 −29
Original line number Diff line number Diff line
@@ -113,16 +113,15 @@ static int synaptics_rmi4_reset_device(struct synaptics_rmi4_data *rmi4_data);

static void synaptics_rmi4_sensor_wake(struct synaptics_rmi4_data *rmi4_data);

static void synaptics_rmi4_sensor_sleep(struct synaptics_rmi4_data *rmi4_data);

static int synaptics_rmi4_check_configuration(struct synaptics_rmi4_data
		*rmi4_data);

#ifdef CONFIG_PM
static int synaptics_rmi4_suspend(struct device *dev);

static int synaptics_rmi4_resume(struct device *dev);

#ifdef CONFIG_PM
static ssize_t synaptics_rmi4_full_pm_cycle_show(struct device *dev,
		struct device_attribute *attr, char *buf);

@@ -425,29 +424,6 @@ static struct device_attribute attrs[] = {
static bool exp_fn_inited;
static struct mutex exp_fn_list_mutex;
static struct list_head exp_fn_list;
#ifdef CONFIG_PM
static ssize_t synaptics_rmi4_full_pm_cycle_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev);

	return snprintf(buf, PAGE_SIZE, "%u\n",
			rmi4_data->full_pm_cycle);
}

static ssize_t synaptics_rmi4_full_pm_cycle_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
{
	unsigned int input;
	struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev);

	if (sscanf(buf, "%u", &input) != 1)
		return -EINVAL;

	rmi4_data->full_pm_cycle = input > 0 ? 1 : 0;

	return count;
}

static int synaptics_rmi4_debug_suspend_set(void *_data, u64 val)
{
@@ -461,7 +437,7 @@ static int synaptics_rmi4_debug_suspend_set(void *_data, u64 val)
	return 0;
}

static ssize_t synaptics_rmi4_debug_suspend_get(void *_data, u64 *val)
static int synaptics_rmi4_debug_suspend_get(void *_data, u64 *val)
{
	struct synaptics_rmi4_data *rmi4_data = _data;

@@ -473,6 +449,30 @@ static ssize_t synaptics_rmi4_debug_suspend_get(void *_data, u64 *val)
DEFINE_SIMPLE_ATTRIBUTE(debug_suspend_fops, synaptics_rmi4_debug_suspend_get,
			synaptics_rmi4_debug_suspend_set, "%lld\n");

#ifdef CONFIG_PM
static ssize_t synaptics_rmi4_full_pm_cycle_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev);

	return snprintf(buf, PAGE_SIZE, "%u\n",
			rmi4_data->full_pm_cycle);
}

static ssize_t synaptics_rmi4_full_pm_cycle_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
{
	unsigned int input;
	struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev);

	if (sscanf(buf, "%u", &input) != 1)
		return -EINVAL;

	rmi4_data->full_pm_cycle = input > 0 ? 1 : 0;

	return count;
}

#ifdef CONFIG_FB
static void configure_sleep(struct synaptics_rmi4_data *rmi4_data)
{
@@ -502,6 +502,11 @@ static void configure_sleep(struct synaptics_rmi4_data *rmi4_data)
	return;
}
#endif
#else
static void configure_sleep(struct synaptics_rmi4_data *rmi4_data)
{
	return;
}
#endif

static ssize_t synaptics_rmi4_f01_reset_store(struct device *dev,
@@ -3678,18 +3683,28 @@ static const struct dev_pm_ops synaptics_rmi4_dev_pm_ops = {
static void synaptics_rmi4_sensor_wake(struct synaptics_rmi4_data *rmi4_data)
{
	return;
};
}

static void synaptics_rmi4_sensor_sleep(struct synaptics_rmi4_data *rmi4_data)
{
	return;
};
}

static int synaptics_rmi4_check_configuration(struct synaptics_rmi4_data
						*rmi4_data)
{
	return 0;
};
}

static int synaptics_rmi4_suspend(struct device *dev);
{
	return 0;
}

static int synaptics_rmi4_resume(struct device *dev);
{
	return 0;
}
#endif

static const struct i2c_device_id synaptics_rmi4_id_table[] = {
+1 −1
Original line number Diff line number Diff line
@@ -461,7 +461,7 @@ static void rmidev_device_cleanup(struct rmidev_data *dev_data)
	return;
}

static char *rmi_char_devnode(struct device *dev, mode_t *mode)
static char *rmi_char_devnode(struct device *dev, umode_t *mode)
{
	if (!mode)
		return NULL;