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

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

input: synaptics: Correct sysfs permissions



Set correct permissions for write-only sysfs nodes. Show method of such
attributes is set to NULL since the attributes are write-only.

This patch is propagated from msm-3.10 kernel
(commit: 430d55ec97e13f08d829f567831b9d3f47697db0
input: synaptics: Correct sysfs permissions)

Change-Id: Ic37b2c5c67f9e68f9a2f06e379e0aed5cdb756bd
CRs-Fixed: 573711
Signed-off-by: default avatarHimanshu Aggarwal <haggarwa@codeaurora.org>
parent d1865b1c
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -2050,26 +2050,26 @@ static struct device_attribute attrs[] = {
	__ATTR(fw_name, S_IRUGO | S_IWUSR | S_IWGRP,
			fwu_sysfs_image_name_show,
			fwu_sysfs_image_name_store),
	__ATTR(force_update_fw, S_IRUGO | S_IWUSR | S_IWGRP,
			synaptics_rmi4_show_error,
	__ATTR(force_update_fw, S_IWUSR | S_IWGRP,
			NULL,
			fwu_sysfs_force_reflash_store),
	__ATTR(update_fw, S_IRUGO | S_IWUSR | S_IWGRP,
			synaptics_rmi4_show_error,
	__ATTR(update_fw, S_IWUSR | S_IWGRP,
			NULL,
			fwu_sysfs_do_reflash_store),
	__ATTR(writeconfig, S_IRUGO | S_IWUSR | S_IWGRP,
			synaptics_rmi4_show_error,
	__ATTR(writeconfig, S_IWUSR | S_IWGRP,
			NULL,
			fwu_sysfs_write_config_store),
	__ATTR(writelockdown, S_IRUGO | S_IWUSR | S_IWGRP,
			synaptics_rmi4_show_error,
	__ATTR(writelockdown, S_IWUSR | S_IWGRP,
			NULL,
			fwu_sysfs_write_lockdown_store),
	__ATTR(readconfig, S_IRUGO | S_IWUSR | S_IWGRP,
			synaptics_rmi4_show_error,
	__ATTR(readconfig, S_IWUSR | S_IWGRP,
			NULL,
			fwu_sysfs_read_config_store),
	__ATTR(configarea, S_IRUGO | S_IWUSR | S_IWGRP,
			synaptics_rmi4_show_error,
	__ATTR(configarea, S_IWUSR | S_IWGRP,
			NULL,
			fwu_sysfs_config_area_store),
	__ATTR(imagesize, S_IRUGO | S_IWUSR | S_IWGRP,
			synaptics_rmi4_show_error,
	__ATTR(imagesize, S_IWUSR | S_IWGRP,
			NULL,
			fwu_sysfs_image_size_store),
	__ATTR(blocksize, S_IRUGO,
			fwu_sysfs_block_size_show,
+2 −2
Original line number Diff line number Diff line
@@ -399,8 +399,8 @@ static struct device_attribute attrs[] = {
			synaptics_rmi4_full_pm_cycle_show,
			synaptics_rmi4_full_pm_cycle_store),
#endif
	__ATTR(reset, S_IRUGO | S_IWUSR | S_IWGRP,
			synaptics_rmi4_show_error,
	__ATTR(reset, S_IWUSR | S_IWGRP,
			NULL,
			synaptics_rmi4_f01_reset_store),
	__ATTR(productinfo, S_IRUGO,
			synaptics_rmi4_f01_productinfo_show,
+0 −8
Original line number Diff line number Diff line
@@ -286,14 +286,6 @@ void synaptics_rmi4_new_function(enum exp_fn fn_type, bool insert,
		void (*func_attn)(struct synaptics_rmi4_data *rmi4_data,
				unsigned char intr_mask));

static inline ssize_t synaptics_rmi4_show_error(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	dev_warn(dev, "%s Attempted to read from write-only attribute %s\n",
			__func__, attr->attr.name);
	return -EPERM;
}

static inline ssize_t synaptics_rmi4_store_error(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
{
+9 −9
Original line number Diff line number Diff line
@@ -73,19 +73,19 @@ struct rmidev_data {
};

static struct device_attribute attrs[] = {
	__ATTR(open, S_IRUGO | S_IWUSR | S_IWGRP,
			synaptics_rmi4_show_error,
	__ATTR(open, S_IWUSR | S_IWGRP,
			NULL,
			rmidev_sysfs_open_store),
	__ATTR(release, S_IRUGO | S_IWUSR | S_IWGRP,
			synaptics_rmi4_show_error,
	__ATTR(release, S_IWUSR | S_IWGRP,
			NULL,
			rmidev_sysfs_release_store),
	__ATTR(address, S_IRUGO | S_IWUSR | S_IWGRP,
			synaptics_rmi4_show_error,
	__ATTR(address, S_IWUSR | S_IWGRP,
			NULL,
			rmidev_sysfs_address_store),
	__ATTR(length, S_IRUGO | S_IWUSR | S_IWGRP,
			synaptics_rmi4_show_error,
	__ATTR(length, S_IWUSR | S_IWGRP,
			NULL,
			rmidev_sysfs_length_store),
	__ATTR(data, (S_IRUGO | S_IWUSR | S_IWGRP),
	__ATTR(data, (S_IWUSR | S_IWGRP),
			rmidev_sysfs_data_show,
			rmidev_sysfs_data_store),
};