Use the DEVICE_ATTR_[RO|WO] helpers instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -668,9 +668,9 @@ static struct bus_type clockevents_subsys = { · 667 unmodified lines | ||
| 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,12 +682,12 @@ static ssize_t sysfs_show_current_tick_dev(struct device *dev, · 5 unmodified lines | ||
| 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,7 +714,7 @@ static ssize_t sysfs_unbind_tick_dev(struct device *dev, · 20 unmodified lines | ||
| 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 = { |