Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Zhen Lei and committed by
Martin K. Petersen
2506f5dc 4c92f898

+9 -17
+9 -17
drivers/scsi/mvsas/mv_init.c
··· 693 693 .remove = mvs_pci_remove, 694 694 }; 695 695 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) 699 698 { 700 699 return snprintf(buffer, PAGE_SIZE, "%s\n", DRV_VERSION); 701 700 } 702 701 703 - static DEVICE_ATTR(driver_version, 704 - S_IRUGO, 705 - mvs_show_driver_version, 706 - NULL); 702 + static DEVICE_ATTR_RO(driver_version); 707 703 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) 712 707 { 713 708 unsigned int val = 0; 714 709 struct mvs_info *mvi = NULL; ··· 741 746 return strlen(buffer); 742 747 } 743 748 744 - static ssize_t mvs_show_interrupt_coalescing(struct device *cdev, 745 - struct device_attribute *attr, char *buffer) 749 + static ssize_t interrupt_coalescing_show(struct device *cdev, 750 + struct device_attribute *attr, char *buffer) 746 751 { 747 752 return snprintf(buffer, PAGE_SIZE, "%d\n", interrupt_coalescing); 748 753 } 749 754 750 - static DEVICE_ATTR(interrupt_coalescing, 751 - S_IRUGO|S_IWUSR, 752 - mvs_show_interrupt_coalescing, 753 - mvs_store_interrupt_coalescing); 755 + static DEVICE_ATTR_RW(interrupt_coalescing); 754 756 755 757 static int __init mvs_init(void) 756 758 {