History

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.

YueHaibing committed 5 years ago

Commit 1fa98d91 parent 8124c8a1 file · +8 −8Browse files

Unified · Split

kernel/time/clockevents.c+8−8
@@ -668,9 +668,9 @@ static struct bus_type clockevents_subsys = { · 667 unmodified lines
668668 static DEFINE_PER_CPU(struct device, tick_percpu_dev);
669669 static struct tick_device *tick_get_tick_dev(struct device *dev);
670670
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)
674674 {
675675 struct tick_device *td;
676676 ssize_t count = 0;
@@ -682,12 +682,12 @@ static ssize_t sysfs_show_current_tick_dev(struct device *dev, · 5 unmodified lines
682682 raw_spin_unlock_irq(&clockevents_lock);
683683 return count;
684684 }
685−static DEVICE_ATTR(current_device, 0444, sysfs_show_current_tick_dev, NULL);
685+static DEVICE_ATTR_RO(current_device);
686686
687687 /* 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)
691691 {
692692 char name[CS_NAME_LEN];
693693 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
714714 mutex_unlock(&clockevents_mutex);
715715 return ret ? ret : count;
716716 }
717−static DEVICE_ATTR(unbind_device, 0200, NULL, sysfs_unbind_tick_dev);
717+static DEVICE_ATTR_WO(unbind_device);
718718
719719 #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
720720 static struct device tick_bc_dev = {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t