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

Configure Feed

Select the types of activity you want to include in your feed.

clockevents: Use DEVICE_ATTR_[RO|WO] macros

Use the DEVICE_ATTR_[RO|WO] helpers instead of plain DEVICE_ATTR, which
makes the code a bit shorter and easier to read.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210523065825.19684-1-yuehaibing@huawei.com

authored by

YueHaibing and committed by
Thomas Gleixner
1fa98d96 8124c8a6

+8 -8
+8 -8
kernel/time/clockevents.c
··· 668 668 static DEFINE_PER_CPU(struct device, tick_percpu_dev); 669 669 static struct tick_device *tick_get_tick_dev(struct device *dev); 670 670 671 - static ssize_t sysfs_show_current_tick_dev(struct device *dev, 672 - struct device_attribute *attr, 673 - char *buf) 671 + static ssize_t current_device_show(struct device *dev, 672 + struct device_attribute *attr, 673 + char *buf) 674 674 { 675 675 struct tick_device *td; 676 676 ssize_t count = 0; ··· 682 682 raw_spin_unlock_irq(&clockevents_lock); 683 683 return count; 684 684 } 685 - static DEVICE_ATTR(current_device, 0444, sysfs_show_current_tick_dev, NULL); 685 + static DEVICE_ATTR_RO(current_device); 686 686 687 687 /* We don't support the abomination of removable broadcast devices */ 688 - static ssize_t sysfs_unbind_tick_dev(struct device *dev, 689 - struct device_attribute *attr, 690 - const char *buf, size_t count) 688 + static ssize_t unbind_device_store(struct device *dev, 689 + struct device_attribute *attr, 690 + const char *buf, size_t count) 691 691 { 692 692 char name[CS_NAME_LEN]; 693 693 ssize_t ret = sysfs_get_uname(buf, name, count); ··· 714 714 mutex_unlock(&clockevents_mutex); 715 715 return ret ? ret : count; 716 716 } 717 - static DEVICE_ATTR(unbind_device, 0200, NULL, sysfs_unbind_tick_dev); 717 + static DEVICE_ATTR_WO(unbind_device); 718 718 719 719 #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST 720 720 static struct device tick_bc_dev = {