Skip to content

Commit 80068f8

Browse files
Zhen Leimartinkpetersen
authored andcommitted
scsi: qedf: Use DEVICE_ATTR_RO() macro
Use DEVICE_ATTR_RO() macro helper instead of plain DEVICE_ATTR(), which makes the code a bit shorter and easier to read. Link: https://lore.kernel.org/r/20210616034419.725-3-thunder.leizhen@huawei.com Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent ffa6364 commit 80068f8

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

drivers/scsi/qedf/qedf_attr.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ static struct qedf_ctx *qedf_get_base_qedf(struct qedf_ctx *qedf)
2424
return lport_priv(base_lport);
2525
}
2626

27-
static ssize_t
28-
qedf_fcoe_mac_show(struct device *dev,
29-
struct device_attribute *attr, char *buf)
27+
static ssize_t fcoe_mac_show(struct device *dev,
28+
struct device_attribute *attr, char *buf)
3029
{
3130
struct fc_lport *lport = shost_priv(class_to_shost(dev));
3231
u32 port_id;
@@ -42,9 +41,8 @@ qedf_fcoe_mac_show(struct device *dev,
4241
return scnprintf(buf, PAGE_SIZE, "%pM\n", fcoe_mac);
4342
}
4443

45-
static ssize_t
46-
qedf_fka_period_show(struct device *dev,
47-
struct device_attribute *attr, char *buf)
44+
static ssize_t fka_period_show(struct device *dev,
45+
struct device_attribute *attr, char *buf)
4846
{
4947
struct fc_lport *lport = shost_priv(class_to_shost(dev));
5048
struct qedf_ctx *qedf = lport_priv(lport);
@@ -59,8 +57,8 @@ qedf_fka_period_show(struct device *dev,
5957
return scnprintf(buf, PAGE_SIZE, "%d\n", fka_period);
6058
}
6159

62-
static DEVICE_ATTR(fcoe_mac, S_IRUGO, qedf_fcoe_mac_show, NULL);
63-
static DEVICE_ATTR(fka_period, S_IRUGO, qedf_fka_period_show, NULL);
60+
static DEVICE_ATTR_RO(fcoe_mac);
61+
static DEVICE_ATTR_RO(fka_period);
6462

6563
struct device_attribute *qedf_host_attrs[] = {
6664
&dev_attr_fcoe_mac,

0 commit comments

Comments
 (0)