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>
This commit is contained in:
parent
ffa636470a
commit
80068f8228
|
@ -24,8 +24,7 @@ static struct qedf_ctx *qedf_get_base_qedf(struct qedf_ctx *qedf)
|
||||||
return lport_priv(base_lport);
|
return lport_priv(base_lport);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t fcoe_mac_show(struct device *dev,
|
||||||
qedf_fcoe_mac_show(struct device *dev,
|
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct fc_lport *lport = shost_priv(class_to_shost(dev));
|
struct fc_lport *lport = shost_priv(class_to_shost(dev));
|
||||||
|
@ -42,8 +41,7 @@ qedf_fcoe_mac_show(struct device *dev,
|
||||||
return scnprintf(buf, PAGE_SIZE, "%pM\n", fcoe_mac);
|
return scnprintf(buf, PAGE_SIZE, "%pM\n", fcoe_mac);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t fka_period_show(struct device *dev,
|
||||||
qedf_fka_period_show(struct device *dev,
|
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct fc_lport *lport = shost_priv(class_to_shost(dev));
|
struct fc_lport *lport = shost_priv(class_to_shost(dev));
|
||||||
|
@ -59,8 +57,8 @@ qedf_fka_period_show(struct device *dev,
|
||||||
return scnprintf(buf, PAGE_SIZE, "%d\n", fka_period);
|
return scnprintf(buf, PAGE_SIZE, "%d\n", fka_period);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DEVICE_ATTR(fcoe_mac, S_IRUGO, qedf_fcoe_mac_show, NULL);
|
static DEVICE_ATTR_RO(fcoe_mac);
|
||||||
static DEVICE_ATTR(fka_period, S_IRUGO, qedf_fka_period_show, NULL);
|
static DEVICE_ATTR_RO(fka_period);
|
||||||
|
|
||||||
struct device_attribute *qedf_host_attrs[] = {
|
struct device_attribute *qedf_host_attrs[] = {
|
||||||
&dev_attr_fcoe_mac,
|
&dev_attr_fcoe_mac,
|
||||||
|
|
Loading…
Reference in New Issue