Lines Matching +full:- +full:groups
1 // SPDX-License-Identifier: GPL-2.0
13 #include "rtc-core.h"
19 * ideally UTC. However, PCs that also boot to MS-Windows normally use
27 return sysfs_emit(buf, "%s %s\n", dev_driver_string(dev->parent), in name_show()
28 dev_name(dev->parent)); in name_show()
77 return sysfs_emit(buf, "%d\n", to_rtc_device(dev)->max_user_freq); in max_user_freq_show()
93 return -EINVAL; in max_user_freq_store()
95 rtc->max_user_freq = (int)val; in max_user_freq_store()
102 * hctosys_show - indicate if the given RTC set the system time
115 strcmp(dev_name(&to_rtc_device(dev)->dev), in hctosys_show()
130 * conceptually one-shot, even though some common RTCs (on PCs) in wakealarm_show()
134 * exact YYYY-MM-DD HH:MM[:SS] date *must* disable their RTC in wakealarm_show()
135 * alarms after they trigger, to ensure one-shot semantics. in wakealarm_show()
195 return -EBUSY; in wakealarm_store()
197 return -EINVAL; in wakealarm_store()
245 return sysfs_emit(buf, "[%lld,%llu]\n", to_rtc_device(dev)->range_min, in range_show()
246 to_rtc_device(dev)->range_max); in range_show()
264 * is its side effect: waking from a system state like suspend-to-RAM or
265 * suspend-to-disk. So: no attribute unless that side effect is possible.
270 if (!device_can_wakeup(rtc->dev.parent)) in rtc_does_wakealarm()
273 return !!test_bit(RTC_FEATURE_ALARM, rtc->features); in rtc_does_wakealarm()
281 umode_t mode = attr->mode; in rtc_attr_is_visible()
287 if (!rtc->ops->set_offset) in rtc_attr_is_visible()
290 if (!(rtc->range_max - rtc->range_min)) in rtc_attr_is_visible()
311 const struct attribute_group **groups, **old; in rtc_add_groups() local
314 for (groups = grps; *groups; groups++) in rtc_add_groups()
316 /* No need to modify current groups if nothing new is provided */ in rtc_add_groups()
320 return -EINVAL; in rtc_add_groups()
323 groups = rtc->dev.groups; in rtc_add_groups()
324 if (groups) in rtc_add_groups()
325 for (; *groups; groups++) in rtc_add_groups()
329 groups = devm_kcalloc(&rtc->dev, new_cnt, sizeof(*groups), GFP_KERNEL); in rtc_add_groups()
330 if (!groups) in rtc_add_groups()
331 return -ENOMEM; in rtc_add_groups()
332 memcpy(groups, rtc->dev.groups, old_cnt * sizeof(*groups)); in rtc_add_groups()
333 memcpy(groups + old_cnt, grps, add_cnt * sizeof(*groups)); in rtc_add_groups()
334 groups[old_cnt + add_cnt] = NULL; in rtc_add_groups()
336 old = rtc->dev.groups; in rtc_add_groups()
337 rtc->dev.groups = groups; in rtc_add_groups()
339 devm_kfree(&rtc->dev, old); in rtc_add_groups()
347 const struct attribute_group *groups[] = { grp, NULL }; in rtc_add_group() local
349 return rtc_add_groups(rtc, groups); in rtc_add_group()