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

Commit ca5291b0 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "input: synaptics_dsx: correct sysfs permissions"

parents 15e3d7d4 35d51741
Loading
Loading
Loading
Loading
+4 −28
Original line number Diff line number Diff line
@@ -136,9 +136,6 @@ static ssize_t synaptics_rmi4_0dbutton_show(struct device *dev,
static ssize_t synaptics_rmi4_0dbutton_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count);

static ssize_t synaptics_rmi4_suspend_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count);

static irqreturn_t synaptics_rmi4_irq(int irq, void *data);

#if defined(CONFIG_SECURE_TOUCH)
@@ -359,11 +356,11 @@ struct synaptics_rmi4_exp_fn_data {
static struct synaptics_rmi4_exp_fn_data exp_data;

static struct device_attribute attrs[] = {
	__ATTR(full_pm_cycle, (S_IRUGO | S_IWUGO),
	__ATTR(full_pm_cycle, (S_IRUGO | S_IWUSR | S_IWGRP),
			synaptics_rmi4_full_pm_cycle_show,
			synaptics_rmi4_full_pm_cycle_store),
	__ATTR(reset, S_IWUGO,
			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,
@@ -374,12 +371,9 @@ static struct device_attribute attrs[] = {
	__ATTR(flashprog, S_IRUGO,
			synaptics_rmi4_f01_flashprog_show,
			synaptics_rmi4_store_error),
	__ATTR(0dbutton, (S_IRUGO | S_IWUGO),
	__ATTR(0dbutton, (S_IRUGO | S_IWUSR | S_IWGRP),
			synaptics_rmi4_0dbutton_show,
			synaptics_rmi4_0dbutton_store),
	__ATTR(suspend, S_IWUGO,
			synaptics_rmi4_show_error,
			synaptics_rmi4_suspend_store),
#if defined(CONFIG_SECURE_TOUCH)
	__ATTR(secure_touch_enable, (S_IRUGO | S_IWUGO),
			synaptics_secure_touch_enable_show,
@@ -733,24 +727,6 @@ static ssize_t synaptics_rmi4_0dbutton_store(struct device *dev,
	return count;
}

static ssize_t synaptics_rmi4_suspend_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
{
	unsigned int input;

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

	if (input == 1)
		synaptics_rmi4_suspend(dev);
	else if (input == 0)
		synaptics_rmi4_resume(dev);
	else
		return -EINVAL;

	return count;
}

 /**
 * synaptics_rmi4_f11_abs_report()
 *
+0 −8
Original line number Diff line number Diff line
@@ -351,14 +351,6 @@ static inline void synaptics_rmi4_bus_put(struct synaptics_rmi4_data *rmi4_data)
}
#endif

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)
{
+40 −8
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#define LOCKDOWN_OFFSET 0xb0
#define FW_IMAGE_OFFSET 0x100

#define PACKAGE_ID_OFFSET 17
#define BOOTLOADER_ID_OFFSET 0
#define BLOCK_NUMBER_OFFSET 0

@@ -142,6 +143,9 @@ static ssize_t fwu_sysfs_disp_config_block_count_show(struct device *dev,
static ssize_t fwu_sysfs_config_id_show(struct device *dev,
		struct device_attribute *attr, char *buf);

static ssize_t fwu_sysfs_package_id_show(struct device *dev,
		struct device_attribute *attr, char *buf);

enum bl_version {
	V5 = 5,
	V6 = 6,
@@ -298,20 +302,20 @@ static struct device_attribute attrs[] = {
	__ATTR(update_fw, S_IWUSR | S_IWGRP,
			NULL,
			fwu_sysfs_do_reflash_store),
	__ATTR(writeconfig, S_IWUGO,
			synaptics_rmi4_show_error,
	__ATTR(writeconfig, S_IWUSR | S_IWGRP,
			NULL,
			fwu_sysfs_write_config_store),
	__ATTR(readconfig, S_IWUGO,
			synaptics_rmi4_show_error,
	__ATTR(readconfig, S_IWUSR | S_IWGRP,
			NULL,
			fwu_sysfs_read_config_store),
	__ATTR(configarea, S_IWUGO,
			synaptics_rmi4_show_error,
	__ATTR(configarea, S_IWUSR | S_IWGRP,
			NULL,
			fwu_sysfs_config_area_store),
	__ATTR(fw_name, S_IRUGO | S_IWUSR | S_IWGRP,
			fwu_sysfs_image_name_show,
			fwu_sysfs_image_name_store),
	__ATTR(imagesize, S_IWUGO,
			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,
@@ -334,6 +338,9 @@ static struct device_attribute attrs[] = {
	__ATTR(config_id, S_IRUGO,
			fwu_sysfs_config_id_show,
			synaptics_rmi4_store_error),
	__ATTR(package_id, S_IRUGO,
			fwu_sysfs_package_id_show,
			synaptics_rmi4_store_error),
};

static struct synaptics_rmi4_fwu_handle *fwu;
@@ -1775,6 +1782,31 @@ static ssize_t fwu_sysfs_config_id_show(struct device *dev,
		config_id[0], config_id[1], config_id[2], config_id[3]);
}

static ssize_t fwu_sysfs_package_id_show(struct device *dev,
			struct device_attribute *attr, char *buf)
{
	int retval;
	unsigned char package_id[4];
	struct synaptics_rmi4_data *rmi4_data = fwu->rmi4_data;

	/* read device package id */
	retval = synaptics_rmi4_reg_read(rmi4_data,
			rmi4_data->f01_query_base_addr + PACKAGE_ID_OFFSET,
			package_id,
			sizeof(package_id));

	if (retval < 0) {
		dev_err(rmi4_data->pdev->dev.parent,
				"%s: Failed to read device package ID\n",
				__func__);
		return retval;
	}

	return snprintf(buf, PAGE_SIZE, "%d rev %d\n",
			(package_id[1] << 8) | package_id[0],
			(package_id[3] << 8) | package_id[2]);
}

static void synaptics_rmi4_fwu_attn(struct synaptics_rmi4_data *rmi4_data,
		unsigned char intr_mask)
{
+4 −4
Original line number Diff line number Diff line
@@ -80,11 +80,11 @@ static struct bin_attribute attr_data = {
};

static struct device_attribute attrs[] = {
	__ATTR(open, S_IWUGO,
			synaptics_rmi4_show_error,
	__ATTR(open, S_IWUSR | S_IWGRP,
			NULL,
			rmidev_sysfs_open_store),
	__ATTR(release, S_IWUGO,
			synaptics_rmi4_show_error,
	__ATTR(release, S_IWUSR | S_IWGRP,
			NULL,
			rmidev_sysfs_release_store),
	__ATTR(attn_state, S_IRUGO,
			rmidev_sysfs_attn_state_show,