Skip to content

Commit 2506f5d

Browse files
Zhen Leimartinkpetersen
authored andcommitted
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.com Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 4c92f89 commit 2506f5d

1 file changed

Lines changed: 9 additions & 17 deletions

File tree

drivers/scsi/mvsas/mv_init.c

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -693,22 +693,17 @@ static struct pci_driver mvs_pci_driver = {
693693
.remove = mvs_pci_remove,
694694
};
695695

696-
static ssize_t
697-
mvs_show_driver_version(struct device *cdev,
698-
struct device_attribute *attr, char *buffer)
696+
static ssize_t driver_version_show(struct device *cdev,
697+
struct device_attribute *attr, char *buffer)
699698
{
700699
return snprintf(buffer, PAGE_SIZE, "%s\n", DRV_VERSION);
701700
}
702701

703-
static DEVICE_ATTR(driver_version,
704-
S_IRUGO,
705-
mvs_show_driver_version,
706-
NULL);
702+
static DEVICE_ATTR_RO(driver_version);
707703

708-
static ssize_t
709-
mvs_store_interrupt_coalescing(struct device *cdev,
710-
struct device_attribute *attr,
711-
const char *buffer, size_t size)
704+
static ssize_t interrupt_coalescing_store(struct device *cdev,
705+
struct device_attribute *attr,
706+
const char *buffer, size_t size)
712707
{
713708
unsigned int val = 0;
714709
struct mvs_info *mvi = NULL;
@@ -746,16 +741,13 @@ mvs_store_interrupt_coalescing(struct device *cdev,
746741
return strlen(buffer);
747742
}
748743

749-
static ssize_t mvs_show_interrupt_coalescing(struct device *cdev,
750-
struct device_attribute *attr, char *buffer)
744+
static ssize_t interrupt_coalescing_show(struct device *cdev,
745+
struct device_attribute *attr, char *buffer)
751746
{
752747
return snprintf(buffer, PAGE_SIZE, "%d\n", interrupt_coalescing);
753748
}
754749

755-
static DEVICE_ATTR(interrupt_coalescing,
756-
S_IRUGO|S_IWUSR,
757-
mvs_show_interrupt_coalescing,
758-
mvs_store_interrupt_coalescing);
750+
static DEVICE_ATTR_RW(interrupt_coalescing);
759751

760752
static int __init mvs_init(void)
761753
{

0 commit comments

Comments
 (0)