Skip to content

Commit ffa6364

Browse files
Zhen Leimartinkpetersen
authored andcommitted
scsi: qedi: 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-2-thunder.leizhen@huawei.com Acked-by: Manish Rangankar <mrangankar@marvell.com> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 1897c5c commit ffa6364

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

drivers/scsi/qedi/qedi_sysfs.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ static inline struct qedi_ctx *qedi_dev_to_hba(struct device *dev)
1616
return iscsi_host_priv(shost);
1717
}
1818

19-
static ssize_t qedi_show_port_state(struct device *dev,
20-
struct device_attribute *attr,
21-
char *buf)
19+
static ssize_t port_state_show(struct device *dev,
20+
struct device_attribute *attr,
21+
char *buf)
2222
{
2323
struct qedi_ctx *qedi = qedi_dev_to_hba(dev);
2424

@@ -28,8 +28,8 @@ static ssize_t qedi_show_port_state(struct device *dev,
2828
return sprintf(buf, "Linkdown\n");
2929
}
3030

31-
static ssize_t qedi_show_speed(struct device *dev,
32-
struct device_attribute *attr, char *buf)
31+
static ssize_t speed_show(struct device *dev,
32+
struct device_attribute *attr, char *buf)
3333
{
3434
struct qedi_ctx *qedi = qedi_dev_to_hba(dev);
3535
struct qed_link_output if_link;
@@ -39,8 +39,8 @@ static ssize_t qedi_show_speed(struct device *dev,
3939
return sprintf(buf, "%d Gbit\n", if_link.speed / 1000);
4040
}
4141

42-
static DEVICE_ATTR(port_state, 0444, qedi_show_port_state, NULL);
43-
static DEVICE_ATTR(speed, 0444, qedi_show_speed, NULL);
42+
static DEVICE_ATTR_RO(port_state);
43+
static DEVICE_ATTR_RO(speed);
4444

4545
struct device_attribute *qedi_shost_attrs[] = {
4646
&dev_attr_port_state,

0 commit comments

Comments
 (0)