Index: dahdi-linux-2.11.1~dfsg/drivers/dahdi/dahdi-sysfs.c =================================================================== --- dahdi-linux-2.11.1~dfsg.orig/drivers/dahdi/dahdi-sysfs.c +++ dahdi-linux-2.11.1~dfsg/drivers/dahdi/dahdi-sysfs.c @@ -214,6 +214,7 @@ static BUS_ATTR_READER(linecompat_show, return len; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) static struct device_attribute span_dev_attrs[] = { __ATTR_RO(name), __ATTR_RO(desc), @@ -230,6 +231,39 @@ static struct device_attribute span_dev_ __ATTR_RO(linecompat), __ATTR_NULL, }; +#else +static DEVICE_ATTR_RO(name); +static DEVICE_ATTR_RO(desc); +static DEVICE_ATTR_RO(spantype); +static DEVICE_ATTR_RO(local_spanno); +static DEVICE_ATTR_RO(alarms); +static DEVICE_ATTR_RO(lbo); +static DEVICE_ATTR_RO(syncsrc); +static DEVICE_ATTR_RO(is_digital); +static DEVICE_ATTR_RO(is_sync_master); +static DEVICE_ATTR_RO(basechan); +static DEVICE_ATTR_RO(channels); +static DEVICE_ATTR_RO(lineconfig); +static DEVICE_ATTR_RO(linecompat); + +static struct attribute *span_dev_attrs[] = { + &dev_attr_name.attr, + &dev_attr_desc.attr, + &dev_attr_spantype.attr, + &dev_attr_local_spanno.attr, + &dev_attr_alarms.attr, + &dev_attr_lbo.attr, + &dev_attr_syncsrc.attr, + &dev_attr_is_digital.attr, + &dev_attr_is_sync_master.attr, + &dev_attr_basechan.attr, + &dev_attr_channels.attr, + &dev_attr_lineconfig.attr, + &dev_attr_linecompat.attr, + NULL, +}; +ATTRIBUTE_GROUPS(span_dev); +#endif static ssize_t master_span_show(struct device_driver *driver, char *buf) { @@ -270,10 +304,11 @@ static struct bus_type spans_bus_type = .name = "dahdi_spans", .match = span_match, .uevent = span_uevent, - .dev_attrs = span_dev_attrs, #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) + .dev_attrs = span_dev_attrs, .drv_attrs = dahdi_attrs, #else + .dev_groups = span_dev_groups, .drv_groups = dahdi_groups, #endif }; @@ -690,6 +725,7 @@ dahdi_registration_time_show(struct devi return count; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) static struct device_attribute dahdi_device_attrs[] = { __ATTR(manufacturer, S_IRUGO, dahdi_device_manufacturer_show, NULL), __ATTR(type, S_IRUGO, dahdi_device_type_show, NULL), @@ -704,11 +740,48 @@ static struct device_attribute dahdi_dev __ATTR(registration_time, S_IRUGO, dahdi_registration_time_show, NULL), __ATTR_NULL, }; +#else +static DEVICE_ATTR(manufacturer, S_IRUGO, dahdi_device_manufacturer_show, NULL); +static DEVICE_ATTR(type, S_IRUGO, dahdi_device_type_show, NULL); +static DEVICE_ATTR(span_count, S_IRUGO, dahdi_device_span_count_show, NULL); +static DEVICE_ATTR(hardware_id, S_IRUGO, dahdi_device_hardware_id_show, NULL); +static DEVICE_ATTR(location, S_IRUGO, dahdi_device_location_show, NULL); +static DEVICE_ATTR(auto_assign, S_IWUSR, NULL, dahdi_device_auto_assign); +static DEVICE_ATTR(assign_span, S_IWUSR, NULL, dahdi_device_assign_span); +static DEVICE_ATTR(unassign_span, S_IWUSR, NULL, dahdi_device_unassign_span); +/* + * Using DEVICE_ATTR for spantype attribute here will conflict with the + * span device attribute definition above. Define it somewhat more + * manually to give it a unique name. + */ +static struct device_attribute dahdi_dev_attr_spantype = + __ATTR(spantype, S_IWUSR | S_IRUGO, dahdi_spantype_show, dahdi_spantype_store); +static DEVICE_ATTR(registration_time, S_IRUGO, dahdi_registration_time_show, NULL); + +static struct attribute *dahdi_device_attrs[] = { + &dev_attr_manufacturer.attr, + &dev_attr_type.attr, + &dev_attr_span_count.attr, + &dev_attr_hardware_id.attr, + &dev_attr_location.attr, + &dev_attr_auto_assign.attr, + &dev_attr_assign_span.attr, + &dev_attr_unassign_span.attr, + &dahdi_dev_attr_spantype.attr, + &dev_attr_registration_time.attr, + NULL, +}; +ATTRIBUTE_GROUPS(dahdi_device); +#endif static struct bus_type dahdi_device_bus = { .name = "dahdi_devices", .uevent = device_uevent, +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) .dev_attrs = dahdi_device_attrs, +#else + .dev_groups = dahdi_device_groups, +#endif }; static void dahdi_sysfs_cleanup(void) Index: dahdi-linux-2.11.1~dfsg/drivers/dahdi/dahdi-sysfs-chan.c =================================================================== --- dahdi-linux-2.11.1~dfsg.orig/drivers/dahdi/dahdi-sysfs-chan.c +++ dahdi-linux-2.11.1~dfsg/drivers/dahdi/dahdi-sysfs-chan.c @@ -158,6 +158,7 @@ static BUS_ATTR_READER(ec_state_show, de return len; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) static struct device_attribute chan_dev_attrs[] = { __ATTR_RO(name), __ATTR_RO(channo), @@ -174,6 +175,39 @@ static struct device_attribute chan_dev_ __ATTR_RO(in_use), __ATTR_NULL, }; +#else +static DEVICE_ATTR_RO(name); +static DEVICE_ATTR_RO(channo); +static DEVICE_ATTR_RO(chanpos); +static DEVICE_ATTR_RO(sig); +static DEVICE_ATTR_RO(sigcap); +static DEVICE_ATTR_RO(alarms); +static DEVICE_ATTR_RO(ec_factory); +static DEVICE_ATTR_RO(ec_state); +static DEVICE_ATTR_RO(blocksize); +#ifdef OPTIMIZE_CHANMUTE +static DEVICE_ATTR_RO(chanmute); +#endif +static DEVICE_ATTR_RO(in_use); + +static struct attribute *chan_dev_attrs[] = { + &dev_attr_name.attr, + &dev_attr_channo.attr, + &dev_attr_chanpos.attr, + &dev_attr_sig.attr, + &dev_attr_sigcap.attr, + &dev_attr_alarms.attr, + &dev_attr_ec_factory.attr, + &dev_attr_ec_state.attr, + &dev_attr_blocksize.attr, +#ifdef OPTIMIZE_CHANMUTE + &dev_attr_chanmute.attr, +#endif + &dev_attr_in_use.attr, + NULL, +}; +ATTRIBUTE_GROUPS(chan_dev); +#endif static void chan_release(struct device *dev) { @@ -196,7 +230,11 @@ static int chan_match(struct device *dev static struct bus_type chan_bus_type = { .name = "dahdi_channels", .match = chan_match, +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) .dev_attrs = chan_dev_attrs, +#else + .dev_groups = chan_dev_groups, +#endif }; static int chan_probe(struct device *dev) Index: dahdi-linux-2.11.1~dfsg/drivers/dahdi/xpp/xbus-sysfs.c =================================================================== --- dahdi-linux-2.11.1~dfsg.orig/drivers/dahdi/xpp/xbus-sysfs.c +++ dahdi-linux-2.11.1~dfsg/drivers/dahdi/xpp/xbus-sysfs.c @@ -339,6 +339,7 @@ static DEVICE_ATTR_READER(dahdi_registra return len; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) static struct device_attribute xbus_dev_attrs[] = { __ATTR_RO(connector), __ATTR_RO(label), @@ -358,6 +359,42 @@ static struct device_attribute xbus_dev_ dahdi_registration_store), __ATTR_NULL, }; +#else +static DEVICE_ATTR_RO(connector); +static DEVICE_ATTR_RO(label); +static DEVICE_ATTR_RO(status); +static DEVICE_ATTR_RO(timing); +static DEVICE_ATTR_RO(refcount_xbus); +static DEVICE_ATTR_RO(waitfor_xpds); +static DEVICE_ATTR_RO(driftinfo); +static DEVICE_ATTR(cls, S_IWUSR, NULL, cls_store); +static DEVICE_ATTR(xbus_state, S_IRUGO | S_IWUSR, xbus_state_show, + xbus_state_store); +#ifdef SAMPLE_TICKS +static DEVICE_ATTR(samples, S_IWUSR | S_IRUGO, samples_show, samples_store); +#endif +static DEVICE_ATTR(dahdi_registration, S_IRUGO | S_IWUSR, + dahdi_registration_show, + dahdi_registration_store); + +static struct attribute *xbus_dev_attrs[] = { + &dev_attr_connector.attr, + &dev_attr_label.attr, + &dev_attr_status.attr, + &dev_attr_timing.attr, + &dev_attr_refcount_xbus.attr, + &dev_attr_waitfor_xpds.attr, + &dev_attr_driftinfo.attr, + &dev_attr_cls.attr, + &dev_attr_xbus_state.attr, +#ifdef SAMPLE_TICKS + &dev_attr_samples.attr, +#endif + &dev_attr_dahdi_registration.attr, + NULL, +}; +ATTRIBUTE_GROUPS(xbus_dev); +#endif static int astribank_match(struct device *dev, struct device_driver *driver) { @@ -457,10 +494,11 @@ static struct bus_type toplevel_bus_type .name = "astribanks", .match = astribank_match, .uevent = astribank_uevent, - .dev_attrs = xbus_dev_attrs, #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) + .dev_attrs = xbus_dev_attrs, .drv_attrs = xpp_attrs, #else + .dev_groups = xbus_dev_groups, .drv_groups = xpp_groups, #endif }; @@ -744,6 +782,7 @@ static int xpd_match(struct device *dev, return 1; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) static struct device_attribute xpd_dev_attrs[] = { __ATTR(chipregs, S_IRUGO | S_IWUSR, chipregs_show, chipregs_store), __ATTR(blink, S_IRUGO | S_IWUSR, blink_show, blink_store), @@ -754,11 +793,36 @@ static struct device_attribute xpd_dev_a __ATTR_RO(refcount_xpd), __ATTR_NULL, }; +#else +DEVICE_ATTR(chipregs, S_IRUGO | S_IWUSR, chipregs_show, chipregs_store); +DEVICE_ATTR(blink, S_IRUGO | S_IWUSR, blink_show, blink_store); +DEVICE_ATTR(span, S_IRUGO | S_IWUSR, span_show, span_store); +DEVICE_ATTR_RO(type); +DEVICE_ATTR_RO(offhook); +DEVICE_ATTR_RO(timing_priority); +DEVICE_ATTR_RO(refcount_xpd); + +static struct attribute *xpd_dev_attrs[] = { + &dev_attr_chipregs.attr, + &dev_attr_blink.attr, + &dev_attr_span.attr, + &dev_attr_type.attr, + &dev_attr_offhook.attr, + &dev_attr_timing_priority.attr, + &dev_attr_refcount_xpd.attr, + NULL, +}; +ATTRIBUTE_GROUPS(xpd_dev); +#endif static struct bus_type xpd_type = { .name = "xpds", .match = xpd_match, +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) .dev_attrs = xpd_dev_attrs, +#else + .dev_groups = xpd_dev_groups, +#endif }; int xpd_driver_register(struct device_driver *driver)