aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-24 10:34:53 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-24 10:34:53 -0700
commit3b7cf04f873d3317bdfeedb6c83396abd16f0955 (patch)
treebb302ca374ae2af35ae66b9c095803a8dcf7a2cb
parentstaging: keucr: be explicit to the sysfs file permissions (diff)
downloadlinux-dev-3b7cf04f873d3317bdfeedb6c83396abd16f0955.tar.xz
linux-dev-3b7cf04f873d3317bdfeedb6c83396abd16f0955.zip
staging: quickstart: fix up sysfs file permissions
Use the default DEVICE_ATTR_RO/RW macros to specify the file permissions better, and make them easier to audit. And did we really want any user to be able to write to this file, I kind of doubt it... Cc: Jiang Liu <jiang.liu@huawei.com> Cc: Toshi Kani <toshi.kani@hp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/quickstart/quickstart.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/staging/quickstart/quickstart.c b/drivers/staging/quickstart/quickstart.c
index adb8da564cf6..4247d60c9186 100644
--- a/drivers/staging/quickstart/quickstart.c
+++ b/drivers/staging/quickstart/quickstart.c
@@ -71,9 +71,8 @@ static struct quickstart_button *pressed;
static struct input_dev *quickstart_input;
/* Platform driver functions */
-static ssize_t quickstart_buttons_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t buttons_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
{
int count = 0;
struct quickstart_button *b;
@@ -94,18 +93,17 @@ static ssize_t quickstart_buttons_show(struct device *dev,
return count;
}
-static ssize_t quickstart_pressed_button_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t pressed_button_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
return scnprintf(buf, PAGE_SIZE, "%s\n",
(pressed ? pressed->name : "none"));
}
-static ssize_t quickstart_pressed_button_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t pressed_button_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
{
if (count < 2)
return -EINVAL;
@@ -319,9 +317,8 @@ static int quickstart_acpi_remove(struct acpi_device *device)
}
/* Platform driver structs */
-static DEVICE_ATTR(pressed_button, 0666, quickstart_pressed_button_show,
- quickstart_pressed_button_store);
-static DEVICE_ATTR(buttons, 0444, quickstart_buttons_show, NULL);
+static DEVICE_ATTR_RW(pressed_button);
+static DEVICE_ATTR_RO(buttons);
static struct platform_device *pf_device;
static struct platform_driver pf_driver = {
.driver = {