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

Commit 174f3bce authored by Himanshu Aggarwal's avatar Himanshu Aggarwal Committed by Gerrit - the friendly Code Review server
Browse files

input: synaptics_i2c_rmi4: silence compiler warnings



Many functions in the driver are called only from PM suspend/resume
callbacks. When CONFIG_PM is not enabled in defconfig, compiler
warns about these functions being defined but unused. While a #ifdef
can be added around the function declaration to avoid this warning,
a clean solution is to mark it as  __maybe_unused, which will let
gcc silently drop the function definition when it is not needed.
Prototypes of these functions are marked with '__maybe_unused'
annotation in order to remove this warning. Also remove dead
code from the driver.

This patch is propagated from msm-3.10 kernel
(commit: d93dfef67dff2fde5523e7f548410068df1cdda0
input: synaptics_i2c_rmi4: silence compiler warnings)

Change-Id: I29b9f3e687fb68dc7e75824017f21a570a90e703
Signed-off-by: default avatarHimanshu Aggarwal <haggarwa@codeaurora.org>
parent 772422a0
Loading
Loading
Loading
Loading
+11 −29
Original line number Diff line number Diff line
@@ -113,6 +113,14 @@ 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 __maybe_unused synaptics_rmi4_sensor_sleep(
			struct synaptics_rmi4_data *rmi4_data);

static int __maybe_unused synaptics_rmi4_regulator_lpm(
			struct synaptics_rmi4_data *rmi4_data, bool on);

static void __maybe_unused synaptics_rmi4_release_all(
			struct synaptics_rmi4_data *rmi4_data);

static int synaptics_rmi4_check_configuration(struct synaptics_rmi4_data
		*rmi4_data);
@@ -121,7 +129,6 @@ 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);

@@ -136,7 +143,6 @@ static void synaptics_rmi4_early_suspend(struct early_suspend *h);

static void synaptics_rmi4_late_resume(struct early_suspend *h);
#endif
#endif

static ssize_t synaptics_rmi4_f01_reset_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count);
@@ -393,11 +399,9 @@ struct synaptics_rmi4_exp_fn {
};

static struct device_attribute attrs[] = {
#ifdef CONFIG_PM
	__ATTR(full_pm_cycle, (S_IRUGO | S_IWUSR | S_IWGRP),
			synaptics_rmi4_full_pm_cycle_show,
			synaptics_rmi4_full_pm_cycle_store),
#endif
	__ATTR(reset, S_IWUSR | S_IWGRP,
			NULL,
			synaptics_rmi4_f01_reset_store),
@@ -449,7 +453,6 @@ static int 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)
{
@@ -499,11 +502,6 @@ static void configure_sleep(struct synaptics_rmi4_data *rmi4_data)
{
}
#endif
#else
static void configure_sleep(struct synaptics_rmi4_data *rmi4_data)
{
}
#endif

static ssize_t synaptics_rmi4_f01_reset_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
@@ -3165,7 +3163,6 @@ static int synaptics_rmi4_remove(struct i2c_client *client)
	return 0;
}

#ifdef CONFIG_PM
 /**
 * synaptics_rmi4_sensor_sleep()
 *
@@ -3504,6 +3501,7 @@ static int synaptics_rmi4_check_configuration(struct synaptics_rmi4_data
 * sleep (if not already done so during the early suspend phase),
 * disables the interrupt, and turns off the power to the sensor.
 */
#ifdef CONFIG_PM
static int synaptics_rmi4_suspend(struct device *dev)
{
	struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev);
@@ -3639,28 +3637,12 @@ static const struct dev_pm_ops synaptics_rmi4_dev_pm_ops = {
};
#endif
#else
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);
static int synaptics_rmi4_suspend(struct device *dev)
{
	return 0;
}

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