Skip to content

Commit

Permalink
s390/stp: allow group and users to read stp sysfs files
Browse files Browse the repository at this point in the history
There are no secrets in these files, so allow all users
to read it.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
  • Loading branch information
Sven Schnelle authored and Heiko Carstens committed Jul 1, 2020
1 parent 28ccce5 commit 66a049b
Showing 1 changed file with 22 additions and 27 deletions.
49 changes: 22 additions & 27 deletions arch/s390/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ static struct bus_type stp_subsys = {
.dev_name = "stp",
};

static ssize_t stp_ctn_id_show(struct device *dev,
static ssize_t ctn_id_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
Expand All @@ -693,9 +693,9 @@ static ssize_t stp_ctn_id_show(struct device *dev,
*(unsigned long long *) stp_info.ctnid);
}

static DEVICE_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL);
static DEVICE_ATTR_RO(ctn_id);

static ssize_t stp_ctn_type_show(struct device *dev,
static ssize_t ctn_type_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
Expand All @@ -704,9 +704,9 @@ static ssize_t stp_ctn_type_show(struct device *dev,
return sprintf(buf, "%i\n", stp_info.ctn);
}

static DEVICE_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL);
static DEVICE_ATTR_RO(ctn_type);

static ssize_t stp_dst_offset_show(struct device *dev,
static ssize_t dst_offset_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
Expand All @@ -715,9 +715,9 @@ static ssize_t stp_dst_offset_show(struct device *dev,
return sprintf(buf, "%i\n", (int)(s16) stp_info.dsto);
}

static DEVICE_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL);
static DEVICE_ATTR_RO(dst_offset);

static ssize_t stp_leap_seconds_show(struct device *dev,
static ssize_t leap_seconds_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
Expand All @@ -726,9 +726,9 @@ static ssize_t stp_leap_seconds_show(struct device *dev,
return sprintf(buf, "%i\n", (int)(s16) stp_info.leaps);
}

static DEVICE_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL);
static DEVICE_ATTR_RO(leap_seconds);

static ssize_t stp_stratum_show(struct device *dev,
static ssize_t stratum_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
Expand All @@ -737,9 +737,9 @@ static ssize_t stp_stratum_show(struct device *dev,
return sprintf(buf, "%i\n", (int)(s16) stp_info.stratum);
}

static DEVICE_ATTR(stratum, 0400, stp_stratum_show, NULL);
static DEVICE_ATTR_RO(stratum);

static ssize_t stp_time_offset_show(struct device *dev,
static ssize_t time_offset_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
Expand All @@ -748,9 +748,9 @@ static ssize_t stp_time_offset_show(struct device *dev,
return sprintf(buf, "%i\n", (int) stp_info.tto);
}

static DEVICE_ATTR(time_offset, 0400, stp_time_offset_show, NULL);
static DEVICE_ATTR_RO(time_offset);

static ssize_t stp_time_zone_offset_show(struct device *dev,
static ssize_t time_zone_offset_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
Expand All @@ -759,10 +759,9 @@ static ssize_t stp_time_zone_offset_show(struct device *dev,
return sprintf(buf, "%i\n", (int)(s16) stp_info.tzo);
}

static DEVICE_ATTR(time_zone_offset, 0400,
stp_time_zone_offset_show, NULL);
static DEVICE_ATTR_RO(time_zone_offset);

static ssize_t stp_timing_mode_show(struct device *dev,
static ssize_t timing_mode_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
Expand All @@ -771,9 +770,9 @@ static ssize_t stp_timing_mode_show(struct device *dev,
return sprintf(buf, "%i\n", stp_info.tmd);
}

static DEVICE_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL);
static DEVICE_ATTR_RO(timing_mode);

static ssize_t stp_timing_state_show(struct device *dev,
static ssize_t timing_state_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
Expand All @@ -782,16 +781,16 @@ static ssize_t stp_timing_state_show(struct device *dev,
return sprintf(buf, "%i\n", stp_info.tst);
}

static DEVICE_ATTR(timing_state, 0400, stp_timing_state_show, NULL);
static DEVICE_ATTR_RO(timing_state);

static ssize_t stp_online_show(struct device *dev,
static ssize_t online_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
return sprintf(buf, "%i\n", stp_online);
}

static ssize_t stp_online_store(struct device *dev,
static ssize_t online_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
Expand All @@ -817,18 +816,14 @@ static ssize_t stp_online_store(struct device *dev,
* Can't use DEVICE_ATTR because the attribute should be named
* stp/online but dev_attr_online already exists in this file ..
*/
static struct device_attribute dev_attr_stp_online = {
.attr = { .name = "online", .mode = 0600 },
.show = stp_online_show,
.store = stp_online_store,
};
static DEVICE_ATTR_RW(online);

static struct device_attribute *stp_attributes[] = {
&dev_attr_ctn_id,
&dev_attr_ctn_type,
&dev_attr_dst_offset,
&dev_attr_leap_seconds,
&dev_attr_stp_online,
&dev_attr_online,
&dev_attr_stratum,
&dev_attr_time_offset,
&dev_attr_time_zone_offset,
Expand Down

0 comments on commit 66a049b

Please sign in to comment.