|
Lines 214-219
static BUS_ATTR_READER(linecompat_show, dev, buf)
Link Here
|
| 214 |
return len; |
214 |
return len; |
| 215 |
} |
215 |
} |
| 216 |
|
216 |
|
|
|
217 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) |
| 217 |
static struct device_attribute span_dev_attrs[] = { |
218 |
static struct device_attribute span_dev_attrs[] = { |
| 218 |
__ATTR_RO(name), |
219 |
__ATTR_RO(name), |
| 219 |
__ATTR_RO(desc), |
220 |
__ATTR_RO(desc), |
|
Lines 230-235
static struct device_attribute span_dev_attrs[] = {
Link Here
|
| 230 |
__ATTR_RO(linecompat), |
231 |
__ATTR_RO(linecompat), |
| 231 |
__ATTR_NULL, |
232 |
__ATTR_NULL, |
| 232 |
}; |
233 |
}; |
|
|
234 |
#else |
| 235 |
static DEVICE_ATTR_RO(name); |
| 236 |
static DEVICE_ATTR_RO(desc); |
| 237 |
static DEVICE_ATTR_RO(spantype); |
| 238 |
static DEVICE_ATTR_RO(local_spanno); |
| 239 |
static DEVICE_ATTR_RO(alarms); |
| 240 |
static DEVICE_ATTR_RO(lbo); |
| 241 |
static DEVICE_ATTR_RO(syncsrc); |
| 242 |
static DEVICE_ATTR_RO(is_digital); |
| 243 |
static DEVICE_ATTR_RO(is_sync_master); |
| 244 |
static DEVICE_ATTR_RO(basechan); |
| 245 |
static DEVICE_ATTR_RO(channels); |
| 246 |
static DEVICE_ATTR_RO(lineconfig); |
| 247 |
static DEVICE_ATTR_RO(linecompat); |
| 248 |
|
| 249 |
static struct attribute *span_dev_attrs[] = { |
| 250 |
&dev_attr_name.attr, |
| 251 |
&dev_attr_desc.attr, |
| 252 |
&dev_attr_spantype.attr, |
| 253 |
&dev_attr_local_spanno.attr, |
| 254 |
&dev_attr_lbo.attr, |
| 255 |
&dev_attr_alarms.attr, |
| 256 |
&dev_attr_syncsrc.attr, |
| 257 |
&dev_attr_is_digital.attr, |
| 258 |
&dev_attr_is_sync_master.attr, |
| 259 |
&dev_attr_basechan.attr, |
| 260 |
&dev_attr_channels.attr, |
| 261 |
&dev_attr_lineconfig.attr, |
| 262 |
&dev_attr_linecompat.attr, |
| 263 |
NULL, |
| 264 |
}; |
| 265 |
ATTRIBUTE_GROUPS(span_dev); |
| 266 |
#endif |
| 233 |
|
267 |
|
| 234 |
static ssize_t master_span_show(struct device_driver *driver, char *buf) |
268 |
static ssize_t master_span_show(struct device_driver *driver, char *buf) |
| 235 |
{ |
269 |
{ |
|
Lines 270-276
static struct bus_type spans_bus_type = {
Link Here
|
| 270 |
.name = "dahdi_spans", |
304 |
.name = "dahdi_spans", |
| 271 |
.match = span_match, |
305 |
.match = span_match, |
| 272 |
.uevent = span_uevent, |
306 |
.uevent = span_uevent, |
|
|
307 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) |
| 273 |
.dev_attrs = span_dev_attrs, |
308 |
.dev_attrs = span_dev_attrs, |
|
|
309 |
#else |
| 310 |
.dev_groups = span_dev_groups, |
| 311 |
#endif |
| 274 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) |
312 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) |
| 275 |
.drv_attrs = dahdi_attrs, |
313 |
.drv_attrs = dahdi_attrs, |
| 276 |
#else |
314 |
#else |
|
Lines 482-488
static int device_uevent(struct device *dev, struct kobj_uevent_env *kenv)
Link Here
|
| 482 |
#endif |
520 |
#endif |
| 483 |
|
521 |
|
| 484 |
static ssize_t |
522 |
static ssize_t |
| 485 |
dahdi_device_manufacturer_show(struct device *dev, |
523 |
manufacturer_show(struct device *dev, |
| 486 |
struct device_attribute *attr, char *buf) |
524 |
struct device_attribute *attr, char *buf) |
| 487 |
{ |
525 |
{ |
| 488 |
struct dahdi_device *ddev = to_ddev(dev); |
526 |
struct dahdi_device *ddev = to_ddev(dev); |
|
Lines 490-496
dahdi_device_manufacturer_show(struct device *dev,
Link Here
|
| 490 |
} |
528 |
} |
| 491 |
|
529 |
|
| 492 |
static ssize_t |
530 |
static ssize_t |
| 493 |
dahdi_device_type_show(struct device *dev, |
531 |
type_show(struct device *dev, |
| 494 |
struct device_attribute *attr, char *buf) |
532 |
struct device_attribute *attr, char *buf) |
| 495 |
{ |
533 |
{ |
| 496 |
struct dahdi_device *ddev = to_ddev(dev); |
534 |
struct dahdi_device *ddev = to_ddev(dev); |
|
Lines 498-504
dahdi_device_type_show(struct device *dev,
Link Here
|
| 498 |
} |
536 |
} |
| 499 |
|
537 |
|
| 500 |
static ssize_t |
538 |
static ssize_t |
| 501 |
dahdi_device_span_count_show(struct device *dev, |
539 |
span_count_show(struct device *dev, |
| 502 |
struct device_attribute *attr, char *buf) |
540 |
struct device_attribute *attr, char *buf) |
| 503 |
{ |
541 |
{ |
| 504 |
struct dahdi_device *ddev = to_ddev(dev); |
542 |
struct dahdi_device *ddev = to_ddev(dev); |
|
Lines 512-518
dahdi_device_span_count_show(struct device *dev,
Link Here
|
| 512 |
} |
550 |
} |
| 513 |
|
551 |
|
| 514 |
static ssize_t |
552 |
static ssize_t |
| 515 |
dahdi_device_hardware_id_show(struct device *dev, |
553 |
hardware_id_show(struct device *dev, |
| 516 |
struct device_attribute *attr, char *buf) |
554 |
struct device_attribute *attr, char *buf) |
| 517 |
{ |
555 |
{ |
| 518 |
struct dahdi_device *ddev = to_ddev(dev); |
556 |
struct dahdi_device *ddev = to_ddev(dev); |
|
Lines 522-528
dahdi_device_hardware_id_show(struct device *dev,
Link Here
|
| 522 |
} |
560 |
} |
| 523 |
|
561 |
|
| 524 |
static ssize_t |
562 |
static ssize_t |
| 525 |
dahdi_device_location_show(struct device *dev, |
563 |
location_show(struct device *dev, |
| 526 |
struct device_attribute *attr, char *buf) |
564 |
struct device_attribute *attr, char *buf) |
| 527 |
{ |
565 |
{ |
| 528 |
struct dahdi_device *ddev = to_ddev(dev); |
566 |
struct dahdi_device *ddev = to_ddev(dev); |
|
Lines 532-538
dahdi_device_location_show(struct device *dev,
Link Here
|
| 532 |
} |
570 |
} |
| 533 |
|
571 |
|
| 534 |
static ssize_t |
572 |
static ssize_t |
| 535 |
dahdi_device_auto_assign(struct device *dev, struct device_attribute *attr, |
573 |
auto_assign_store(struct device *dev, struct device_attribute *attr, |
| 536 |
const char *buf, size_t count) |
574 |
const char *buf, size_t count) |
| 537 |
{ |
575 |
{ |
| 538 |
struct dahdi_device *ddev = to_ddev(dev); |
576 |
struct dahdi_device *ddev = to_ddev(dev); |
|
Lines 541-547
dahdi_device_auto_assign(struct device *dev, struct device_attribute *attr,
Link Here
|
| 541 |
} |
579 |
} |
| 542 |
|
580 |
|
| 543 |
static ssize_t |
581 |
static ssize_t |
| 544 |
dahdi_device_assign_span(struct device *dev, struct device_attribute *attr, |
582 |
assign_span_store(struct device *dev, struct device_attribute *attr, |
| 545 |
const char *buf, size_t count) |
583 |
const char *buf, size_t count) |
| 546 |
{ |
584 |
{ |
| 547 |
int ret; |
585 |
int ret; |
|
Lines 576-582
dahdi_device_assign_span(struct device *dev, struct device_attribute *attr,
Link Here
|
| 576 |
} |
614 |
} |
| 577 |
|
615 |
|
| 578 |
static ssize_t |
616 |
static ssize_t |
| 579 |
dahdi_device_unassign_span(struct device *dev, struct device_attribute *attr, |
617 |
unassign_span_store(struct device *dev, struct device_attribute *attr, |
| 580 |
const char *buf, size_t count) |
618 |
const char *buf, size_t count) |
| 581 |
{ |
619 |
{ |
| 582 |
int ret; |
620 |
int ret; |
|
Lines 690-714
dahdi_registration_time_show(struct device *dev,
Link Here
|
| 690 |
return count; |
728 |
return count; |
| 691 |
} |
729 |
} |
| 692 |
|
730 |
|
|
|
731 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) |
| 693 |
static struct device_attribute dahdi_device_attrs[] = { |
732 |
static struct device_attribute dahdi_device_attrs[] = { |
| 694 |
__ATTR(manufacturer, S_IRUGO, dahdi_device_manufacturer_show, NULL), |
733 |
__ATTR(manufacturer, S_IRUGO, manufacturer_show, NULL), |
| 695 |
__ATTR(type, S_IRUGO, dahdi_device_type_show, NULL), |
734 |
__ATTR(type, S_IRUGO, type_show, NULL), |
| 696 |
__ATTR(span_count, S_IRUGO, dahdi_device_span_count_show, NULL), |
735 |
__ATTR(span_count, S_IRUGO, span_count_show, NULL), |
| 697 |
__ATTR(hardware_id, S_IRUGO, dahdi_device_hardware_id_show, NULL), |
736 |
__ATTR(hardware_id, S_IRUGO, hardware_id_show, NULL), |
| 698 |
__ATTR(location, S_IRUGO, dahdi_device_location_show, NULL), |
737 |
__ATTR(location, S_IRUGO, location_show, NULL), |
| 699 |
__ATTR(auto_assign, S_IWUSR, NULL, dahdi_device_auto_assign), |
738 |
__ATTR(auto_assign, S_IWUSR, NULL, auto_assign_store), |
| 700 |
__ATTR(assign_span, S_IWUSR, NULL, dahdi_device_assign_span), |
739 |
__ATTR(assign_span, S_IWUSR, NULL, assign_span_store), |
| 701 |
__ATTR(unassign_span, S_IWUSR, NULL, dahdi_device_unassign_span), |
740 |
__ATTR(unassign_span, S_IWUSR, NULL, unassign_span_store), |
| 702 |
__ATTR(spantype, S_IWUSR | S_IRUGO, dahdi_spantype_show, |
741 |
__ATTR(spantype, S_IWUSR | S_IRUGO, dahdi_spantype_show, |
| 703 |
dahdi_spantype_store), |
742 |
dahdi_spantype_store), |
| 704 |
__ATTR(registration_time, S_IRUGO, dahdi_registration_time_show, NULL), |
743 |
__ATTR(registration_time, S_IRUGO, dahdi_registration_time_show, NULL), |
| 705 |
__ATTR_NULL, |
744 |
__ATTR_NULL, |
| 706 |
}; |
745 |
}; |
|
|
746 |
#else |
| 747 |
static DEVICE_ATTR_RO(manufacturer); |
| 748 |
static DEVICE_ATTR_RO(type); |
| 749 |
static DEVICE_ATTR_RO(span_count); |
| 750 |
static DEVICE_ATTR_RO(hardware_id); |
| 751 |
static DEVICE_ATTR_RO(location); |
| 752 |
static DEVICE_ATTR_WO(auto_assign); |
| 753 |
static DEVICE_ATTR_WO(assign_span); |
| 754 |
static DEVICE_ATTR_WO(unassign_span); |
| 755 |
static DEVICE_ATTR_RW(dahdi_spantype); |
| 756 |
static DEVICE_ATTR_RO(dahdi_registration_time); |
| 757 |
static struct attribute *dahdi_device_attrs[] = { |
| 758 |
&dev_attr_manufacturer.attr, |
| 759 |
&dev_attr_type.attr, |
| 760 |
&dev_attr_span_count.attr, |
| 761 |
&dev_attr_hardware_id.attr, |
| 762 |
&dev_attr_location.attr, |
| 763 |
&dev_attr_auto_assign.attr, |
| 764 |
&dev_attr_assign_span.attr, |
| 765 |
&dev_attr_unassign_span.attr, |
| 766 |
&dev_attr_dahdi_spantype.attr, |
| 767 |
&dev_attr_dahdi_registration_time.attr, |
| 768 |
NULL, |
| 769 |
}; |
| 770 |
ATTRIBUTE_GROUPS(dahdi_device); |
| 771 |
#endif |
| 707 |
|
772 |
|
| 708 |
static struct bus_type dahdi_device_bus = { |
773 |
static struct bus_type dahdi_device_bus = { |
| 709 |
.name = "dahdi_devices", |
774 |
.name = "dahdi_devices", |
| 710 |
.uevent = device_uevent, |
775 |
.uevent = device_uevent, |
|
|
776 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) |
| 711 |
.dev_attrs = dahdi_device_attrs, |
777 |
.dev_attrs = dahdi_device_attrs, |
|
|
778 |
#else |
| 779 |
.dev_groups = dahdi_device_groups, |
| 780 |
#endif |
| 712 |
}; |
781 |
}; |
| 713 |
|
782 |
|
| 714 |
static void dahdi_sysfs_cleanup(void) |
783 |
static void dahdi_sysfs_cleanup(void) |