* [PATCH 1/2] HID: hid-lg4ff: fix sysfs attribute permission
@ 2015-01-19 7:03 Vivien Didelot
2015-01-19 7:03 ` [PATCH 2/2] HID: hid-lg4ff: use DEVICE_ATTR_RW macro Vivien Didelot
2015-01-19 13:00 ` [PATCH 1/2] HID: hid-lg4ff: fix sysfs attribute permission Jiri Kosina
0 siblings, 2 replies; 3+ messages in thread
From: Vivien Didelot @ 2015-01-19 7:03 UTC (permalink / raw)
To: linux-input; +Cc: Vivien Didelot, Jiri Kosina, linux-kernel, kernel
There is no reason to set the range attribute executable to the user and
group, and writable to the group. Fix the permission to 0644.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/hid/hid-lg4ff.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index 7835717..4b668bf 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -52,7 +52,8 @@ static void hid_lg4ff_set_range_g25(struct hid_device *hid, u16 range);
static ssize_t lg4ff_range_show(struct device *dev, struct device_attribute *attr, char *buf);
static ssize_t lg4ff_range_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
-static DEVICE_ATTR(range, S_IRWXU | S_IRWXG | S_IROTH, lg4ff_range_show, lg4ff_range_store);
+static DEVICE_ATTR(range, S_IRUGO | S_IWUSR, lg4ff_range_show,
+ lg4ff_range_store);
struct lg4ff_device_entry {
__u32 product_id;
--
2.2.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] HID: hid-lg4ff: use DEVICE_ATTR_RW macro
2015-01-19 7:03 [PATCH 1/2] HID: hid-lg4ff: fix sysfs attribute permission Vivien Didelot
@ 2015-01-19 7:03 ` Vivien Didelot
2015-01-19 13:00 ` [PATCH 1/2] HID: hid-lg4ff: fix sysfs attribute permission Jiri Kosina
1 sibling, 0 replies; 3+ messages in thread
From: Vivien Didelot @ 2015-01-19 7:03 UTC (permalink / raw)
To: linux-input; +Cc: Vivien Didelot, Jiri Kosina, linux-kernel, kernel
Use the DEVICE_ATTR_RW macro to reduce boiler plate and move the
attribute declaration to get rid of function signatures.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/hid/hid-lg4ff.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index 4b668bf..db0dd9b 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -49,11 +49,6 @@
static void hid_lg4ff_set_range_dfp(struct hid_device *hid, u16 range);
static void hid_lg4ff_set_range_g25(struct hid_device *hid, u16 range);
-static ssize_t lg4ff_range_show(struct device *dev, struct device_attribute *attr, char *buf);
-static ssize_t lg4ff_range_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
-
-static DEVICE_ATTR(range, S_IRUGO | S_IWUSR, lg4ff_range_show,
- lg4ff_range_store);
struct lg4ff_device_entry {
__u32 product_id;
@@ -417,7 +412,8 @@ static void hid_lg4ff_switch_native(struct hid_device *hid, const struct lg4ff_n
}
/* Read current range and display it in terminal */
-static ssize_t lg4ff_range_show(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t range_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
{
struct hid_device *hid = to_hid_device(dev);
struct lg4ff_device_entry *entry;
@@ -442,7 +438,8 @@ static ssize_t lg4ff_range_show(struct device *dev, struct device_attribute *att
/* Set range to user specified value, call appropriate function
* according to the type of the wheel */
-static ssize_t lg4ff_range_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+static ssize_t range_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct hid_device *hid = to_hid_device(dev);
struct lg4ff_device_entry *entry;
@@ -473,6 +470,7 @@ static ssize_t lg4ff_range_store(struct device *dev, struct device_attribute *at
return count;
}
+static DEVICE_ATTR_RW(range);
#ifdef CONFIG_LEDS_CLASS
static void lg4ff_set_leds(struct hid_device *hid, __u8 leds)
--
2.2.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] HID: hid-lg4ff: fix sysfs attribute permission
2015-01-19 7:03 [PATCH 1/2] HID: hid-lg4ff: fix sysfs attribute permission Vivien Didelot
2015-01-19 7:03 ` [PATCH 2/2] HID: hid-lg4ff: use DEVICE_ATTR_RW macro Vivien Didelot
@ 2015-01-19 13:00 ` Jiri Kosina
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2015-01-19 13:00 UTC (permalink / raw)
To: Vivien Didelot; +Cc: linux-input, linux-kernel, kernel
On Mon, 19 Jan 2015, Vivien Didelot wrote:
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Both patches applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-19 13:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-19 7:03 [PATCH 1/2] HID: hid-lg4ff: fix sysfs attribute permission Vivien Didelot
2015-01-19 7:03 ` [PATCH 2/2] HID: hid-lg4ff: use DEVICE_ATTR_RW macro Vivien Didelot
2015-01-19 13:00 ` [PATCH 1/2] HID: hid-lg4ff: fix sysfs attribute permission Jiri Kosina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).