input: synaptics_dsx_2.6: correct sysfs permissions
Set correct permissions for sysfs nodes. 1. Show method of write only sysfs attributes is set to NULL since the attributes are write-only. 2. Store method of read only sysfs attributes is set to NULL since the attributes are read-only. Change-Id: I93b14e22da57a8a47a02080a05a9b8c666970272 Signed-off-by: Abinaya P <abinayap@codeaurora.org>
This commit is contained in:
parent
29e0ce3c54
commit
546640e83f
7 changed files with 54 additions and 80 deletions
|
@ -610,23 +610,23 @@ static struct synaptics_rmi4_exp_fn_data exp_data;
|
|||
static struct synaptics_dsx_button_map *vir_button_map;
|
||||
|
||||
static struct device_attribute attrs[] = {
|
||||
__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,
|
||||
synaptics_rmi4_store_error),
|
||||
NULL),
|
||||
__ATTR(buildid, S_IRUGO,
|
||||
synaptics_rmi4_f01_buildid_show,
|
||||
synaptics_rmi4_store_error),
|
||||
NULL),
|
||||
__ATTR(flashprog, S_IRUGO,
|
||||
synaptics_rmi4_f01_flashprog_show,
|
||||
synaptics_rmi4_store_error),
|
||||
NULL),
|
||||
__ATTR(0dbutton, (S_IRUGO | S_IWUSR | S_IWGRP),
|
||||
synaptics_rmi4_0dbutton_show,
|
||||
synaptics_rmi4_0dbutton_store),
|
||||
__ATTR(suspend, S_IRUGO | S_IWUSR | S_IWGRP,
|
||||
synaptics_rmi4_show_error,
|
||||
__ATTR(suspend, S_IWUSR | S_IWGRP,
|
||||
NULL,
|
||||
synaptics_rmi4_suspend_store),
|
||||
__ATTR(wake_gesture, (S_IRUGO | S_IWUSR | S_IWGRP),
|
||||
synaptics_rmi4_wake_gesture_show,
|
||||
|
|
|
@ -464,22 +464,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)
|
||||
{
|
||||
dev_warn(dev, "%s Attempted to write to read-only attribute %s\n",
|
||||
__func__, attr->attr.name);
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
static inline int secure_memcpy(unsigned char *dest, unsigned int dest_size,
|
||||
const unsigned char *src, unsigned int src_size,
|
||||
unsigned int count)
|
||||
|
|
|
@ -661,50 +661,50 @@ static struct bin_attribute dev_attr_data = {
|
|||
};
|
||||
|
||||
static struct device_attribute attrs[] = {
|
||||
__ATTR(dorecovery, S_IRUGO | S_IWUSR | S_IWGRP,
|
||||
synaptics_rmi4_show_error,
|
||||
__ATTR(dorecovery, S_IWUSR | S_IWGRP,
|
||||
NULL,
|
||||
fwu_sysfs_do_recovery_store),
|
||||
__ATTR(doreflash, S_IRUGO | S_IWUSR | S_IWGRP,
|
||||
synaptics_rmi4_show_error,
|
||||
__ATTR(doreflash, 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(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(imagename, S_IRUGO | S_IWUSR | S_IWGRP,
|
||||
synaptics_rmi4_show_error,
|
||||
__ATTR(imagename, S_IWUSR | S_IWGRP,
|
||||
NULL,
|
||||
fwu_sysfs_image_name_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,
|
||||
synaptics_rmi4_store_error),
|
||||
NULL),
|
||||
__ATTR(fwblockcount, S_IRUGO,
|
||||
fwu_sysfs_firmware_block_count_show,
|
||||
synaptics_rmi4_store_error),
|
||||
NULL),
|
||||
__ATTR(configblockcount, S_IRUGO,
|
||||
fwu_sysfs_configuration_block_count_show,
|
||||
synaptics_rmi4_store_error),
|
||||
NULL),
|
||||
__ATTR(dispconfigblockcount, S_IRUGO,
|
||||
fwu_sysfs_disp_config_block_count_show,
|
||||
synaptics_rmi4_store_error),
|
||||
NULL),
|
||||
__ATTR(permconfigblockcount, S_IRUGO,
|
||||
fwu_sysfs_perm_config_block_count_show,
|
||||
synaptics_rmi4_store_error),
|
||||
NULL),
|
||||
__ATTR(blconfigblockcount, S_IRUGO,
|
||||
fwu_sysfs_bl_config_block_count_show,
|
||||
synaptics_rmi4_store_error),
|
||||
NULL),
|
||||
__ATTR(guestcodeblockcount, S_IRUGO,
|
||||
fwu_sysfs_guest_code_block_count_show,
|
||||
synaptics_rmi4_store_error),
|
||||
__ATTR(writeguestcode, S_IRUGO | S_IWUSR | S_IWGRP,
|
||||
synaptics_rmi4_show_error,
|
||||
NULL),
|
||||
__ATTR(writeguestcode, S_IWUSR | S_IWGRP,
|
||||
NULL,
|
||||
fwu_sysfs_write_guest_code_store),
|
||||
};
|
||||
|
||||
|
|
|
@ -389,47 +389,47 @@ struct synaptics_rmi4_udg_handle {
|
|||
|
||||
static struct device_attribute attrs[] = {
|
||||
__ATTR(engine_enable, S_IWUGO,
|
||||
synaptics_rmi4_show_error,
|
||||
NULL,
|
||||
udg_sysfs_engine_enable_store),
|
||||
__ATTR(detection_enable, S_IWUGO,
|
||||
synaptics_rmi4_show_error,
|
||||
NULL,
|
||||
udg_sysfs_detection_enable_store),
|
||||
__ATTR(detection_score, S_IRUGO,
|
||||
udg_sysfs_detection_score_show,
|
||||
synaptics_rmi4_store_error),
|
||||
NULL),
|
||||
__ATTR(detection_index, S_IRUGO,
|
||||
udg_sysfs_detection_index_show,
|
||||
synaptics_rmi4_store_error),
|
||||
NULL),
|
||||
__ATTR(registration_enable, S_IWUGO,
|
||||
synaptics_rmi4_show_error,
|
||||
NULL,
|
||||
udg_sysfs_registration_enable_store),
|
||||
__ATTR(registration_begin, S_IWUGO,
|
||||
synaptics_rmi4_show_error,
|
||||
NULL,
|
||||
udg_sysfs_registration_begin_store),
|
||||
__ATTR(registration_status, S_IRUGO,
|
||||
udg_sysfs_registration_status_show,
|
||||
synaptics_rmi4_store_error),
|
||||
NULL),
|
||||
__ATTR(template_size, S_IRUGO,
|
||||
udg_sysfs_template_size_show,
|
||||
synaptics_rmi4_store_error),
|
||||
NULL),
|
||||
__ATTR(template_max_index, S_IRUGO,
|
||||
udg_sysfs_template_max_index_show,
|
||||
synaptics_rmi4_store_error),
|
||||
NULL),
|
||||
__ATTR(template_detection, S_IRUGO,
|
||||
udg_sysfs_template_detection_show,
|
||||
synaptics_rmi4_store_error),
|
||||
NULL),
|
||||
__ATTR(template_index, S_IWUGO,
|
||||
synaptics_rmi4_show_error,
|
||||
NULL,
|
||||
udg_sysfs_template_index_store),
|
||||
__ATTR(template_valid, (S_IRUGO | S_IWUGO),
|
||||
udg_sysfs_template_valid_show,
|
||||
udg_sysfs_template_valid_store),
|
||||
__ATTR(template_clear, S_IWUGO,
|
||||
synaptics_rmi4_show_error,
|
||||
NULL,
|
||||
udg_sysfs_template_clear_store),
|
||||
__ATTR(trace_size, S_IRUGO,
|
||||
udg_sysfs_trace_size_show,
|
||||
synaptics_rmi4_store_error),
|
||||
NULL),
|
||||
};
|
||||
|
||||
static struct bin_attribute template_data = {
|
||||
|
|
|
@ -126,20 +126,20 @@ static struct bin_attribute attr_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(attn_state, S_IRUGO,
|
||||
rmidev_sysfs_attn_state_show,
|
||||
synaptics_rmi4_store_error),
|
||||
NULL),
|
||||
__ATTR(pid, S_IRUGO | S_IRUGO | S_IWUSR | S_IWGRP,
|
||||
rmidev_sysfs_pid_show,
|
||||
rmidev_sysfs_pid_store),
|
||||
__ATTR(term, S_IRUGO | S_IWUSR | S_IWGRP,
|
||||
synaptics_rmi4_show_error,
|
||||
__ATTR(term, S_IWUSR | S_IWGRP,
|
||||
NULL,
|
||||
rmidev_sysfs_term_store),
|
||||
__ATTR(intr_mask, S_IRUGO,
|
||||
rmidev_sysfs_intr_mask_show,
|
||||
|
|
|
@ -198,23 +198,13 @@
|
|||
static ssize_t concat(test_sysfs, _##propname##_show)(\
|
||||
struct device *dev,\
|
||||
struct device_attribute *attr,\
|
||||
char *buf);\
|
||||
\
|
||||
static struct device_attribute dev_attr_##propname =\
|
||||
__ATTR(propname, S_IRUGO,\
|
||||
concat(test_sysfs, _##propname##_show),\
|
||||
synaptics_rmi4_store_error);
|
||||
char *buf);
|
||||
|
||||
#define store_prototype(propname)\
|
||||
static ssize_t concat(test_sysfs, _##propname##_store)(\
|
||||
struct device *dev,\
|
||||
struct device_attribute *attr,\
|
||||
const char *buf, size_t count);\
|
||||
\
|
||||
static struct device_attribute dev_attr_##propname =\
|
||||
__ATTR(propname, S_IWUGO,\
|
||||
synaptics_rmi4_show_error,\
|
||||
concat(test_sysfs, _##propname##_store));
|
||||
const char *buf, size_t count);
|
||||
|
||||
#define show_store_prototype(propname)\
|
||||
static ssize_t concat(test_sysfs, _##propname##_show)(\
|
||||
|
|
|
@ -113,10 +113,10 @@ static struct dcs_command resume_sequence[] = {
|
|||
|
||||
static struct device_attribute attrs[] = {
|
||||
__ATTR(dcs_write, S_IWUGO,
|
||||
synaptics_rmi4_show_error,
|
||||
NULL,
|
||||
video_sysfs_dcs_write_store),
|
||||
__ATTR(param, S_IWUGO,
|
||||
synaptics_rmi4_show_error,
|
||||
NULL,
|
||||
video_sysfs_param_store),
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue