提交 2506f5dc 编写于 作者: Z Zhen Lei 提交者: Martin K. Petersen

scsi: mvsas: Use DEVICE_ATTR_RO()/RW() macro

Use DEVICE_ATTR_RO()/RW() 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-5-thunder.leizhen@huawei.comSigned-off-by: NZhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 4c92f898
...@@ -693,22 +693,17 @@ static struct pci_driver mvs_pci_driver = { ...@@ -693,22 +693,17 @@ static struct pci_driver mvs_pci_driver = {
.remove = mvs_pci_remove, .remove = mvs_pci_remove,
}; };
static ssize_t static ssize_t driver_version_show(struct device *cdev,
mvs_show_driver_version(struct device *cdev, struct device_attribute *attr, char *buffer)
struct device_attribute *attr, char *buffer)
{ {
return snprintf(buffer, PAGE_SIZE, "%s\n", DRV_VERSION); return snprintf(buffer, PAGE_SIZE, "%s\n", DRV_VERSION);
} }
static DEVICE_ATTR(driver_version, static DEVICE_ATTR_RO(driver_version);
S_IRUGO,
mvs_show_driver_version,
NULL);
static ssize_t static ssize_t interrupt_coalescing_store(struct device *cdev,
mvs_store_interrupt_coalescing(struct device *cdev, struct device_attribute *attr,
struct device_attribute *attr, const char *buffer, size_t size)
const char *buffer, size_t size)
{ {
unsigned int val = 0; unsigned int val = 0;
struct mvs_info *mvi = NULL; struct mvs_info *mvi = NULL;
...@@ -746,16 +741,13 @@ mvs_store_interrupt_coalescing(struct device *cdev, ...@@ -746,16 +741,13 @@ mvs_store_interrupt_coalescing(struct device *cdev,
return strlen(buffer); return strlen(buffer);
} }
static ssize_t mvs_show_interrupt_coalescing(struct device *cdev, static ssize_t interrupt_coalescing_show(struct device *cdev,
struct device_attribute *attr, char *buffer) struct device_attribute *attr, char *buffer)
{ {
return snprintf(buffer, PAGE_SIZE, "%d\n", interrupt_coalescing); return snprintf(buffer, PAGE_SIZE, "%d\n", interrupt_coalescing);
} }
static DEVICE_ATTR(interrupt_coalescing, static DEVICE_ATTR_RW(interrupt_coalescing);
S_IRUGO|S_IWUSR,
mvs_show_interrupt_coalescing,
mvs_store_interrupt_coalescing);
static int __init mvs_init(void) static int __init mvs_init(void)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册