-diff -ur lin_tape-3.0.8.orig/stmp.c lin_tape-3.0.8/stmp.c
---- lin_tape-3.0.8.orig/stmp.c 2016-03-17 03:52:34.000000000 +0100
-+++ lin_tape-3.0.8/stmp.c 2016-06-19 13:10:40.664509607 +0200
-@@ -121,7 +121,12 @@
-
- #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32)
- static struct class st_sysfs_class;
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
-+static const struct attribute_group *st_dev_groups[];
-+static const struct attribute_group *st_drv_groups[];
-+#else
- static struct device_attribute st_dev_attrs[];
-+#endif
- /* Paths are protected by st_index_lock */
- static struct device *old_active_path;
- static struct device *new_active_path;
-@@ -245,8 +250,10 @@
- static int st_probe(struct device *);
- static int st_remove(struct device *);
-
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
- static int do_create_sysfs_files(void);
- static void do_remove_sysfs_files(void);
-+#endif
- #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)
- static int do_create_class_files(struct scsi_tape *, int, int);
- #endif
-@@ -255,6 +262,9 @@
- .owner = THIS_MODULE,
- .gendrv = {
- .name = "st",
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)
-+ .groups = st_drv_groups,
-+#endif
- .probe = st_probe,
- .remove = st_remove,
- },
-@@ -4806,7 +4816,11 @@
- #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32)
- static struct class st_sysfs_class = {
- .name = "scsi_tape",
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
-+ .dev_groups = st_dev_groups,
-+#else
- .dev_attrs = st_dev_attrs,
-+#endif
- };
- #endif
-
-@@ -4845,9 +4859,11 @@
- if (err)
- goto err_chrdev;
-
-+#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,13,0)
- err = do_create_sysfs_files();
- if (err)
- goto err_scsidrv;
-+#endif
-
- return 0;
-
-@@ -4867,7 +4883,9 @@
-
- static void __exit exit_st(void)
- {
-+#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,13,0)
- do_remove_sysfs_files();
-+#endif
- pfo_unregister_st(&st_template.gendrv);
- unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0),
- ST_MAX_TAPE_ENTRIES);
-@@ -4884,6 +4902,7 @@
- module_exit(exit_st);
-
-
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
- /* The sysfs driver interface. Read-only at the moment */
- static ssize_t st_try_direct_io_show(struct device_driver *ddp, char *buf)
- {
-@@ -4947,10 +4966,48 @@
- driver_remove_file(sysfs, &driver_attr_fixed_buffer_size);
- driver_remove_file(sysfs, &driver_attr_try_direct_io);
- }
-+#else
-+/* The sysfs driver interface. Read-only at the moment */
-+static ssize_t try_direct_io_show(struct device_driver *ddp, char *buf)
-+{
-+ return scnprintf(buf, PAGE_SIZE, "%d\n", try_direct_io);
-+}
-+static DRIVER_ATTR_RO(try_direct_io);
-
-+static ssize_t fixed_buffer_size_show(struct device_driver *ddp, char *buf)
-+{
-+ return scnprintf(buf, PAGE_SIZE, "%d\n", st_fixed_buffer_size);
-+}
-+static DRIVER_ATTR_RO(fixed_buffer_size);
-+
-+static ssize_t max_sg_segs_show(struct device_driver *ddp, char *buf)
-+{
-+ return scnprintf(buf, PAGE_SIZE, "%d\n", st_max_sg_segs);
-+}
-+static DRIVER_ATTR_RO(max_sg_segs);
-+
-+static ssize_t version_show(struct device_driver *ddd, char *buf)
-+{
-+ return scnprintf(buf, PAGE_SIZE, "[%s]\n", verstr);
-+}
-+static DRIVER_ATTR_RO(version);
-+
-+static struct attribute *st_drv_attrs[] = {
-+ &driver_attr_try_direct_io.attr,
-+ &driver_attr_fixed_buffer_size.attr,
-+ &driver_attr_max_sg_segs.attr,
-+ &driver_attr_version.attr,
-+ NULL,
-+};
-+ATTRIBUTE_GROUPS(st_drv);
-+#endif
-
- /* The sysfs simple class interface */
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
-+static ssize_t lasterror_show(struct device *dev,
-+#else
- static ssize_t st_lasterror_show(struct device *dev,
-+#endif
- struct device_attribute *attr, char *buf)
- {
- struct st_modedef *STm = dev_get_drvdata(dev);
-@@ -4981,12 +5038,19 @@
- STp->last_checkcondition[2]);
- return l;
- }
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
-+static DEVICE_ATTR_RO(lasterror);
-+#endif
- #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)
- DEVICE_ATTR(lasterror, S_IRUGO, st_lasterror_show, NULL);
- #endif
-
- static ssize_t
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
-+defined_show(struct device *dev, struct device_attribute *attr, char *buf)
-+#else
- st_defined_show(struct device *dev, struct device_attribute *attr, char *buf)
-+#endif
- {
- struct st_modedef *STm = dev_get_drvdata(dev);
- ssize_t l = 0;
-@@ -4994,13 +5058,20 @@
- l = snprintf(buf, PAGE_SIZE, "%d\n", STm->defined);
- return l;
- }
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
-+static DEVICE_ATTR_RO(defined);
-+#endif
-
- #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)
- DEVICE_ATTR(defined, S_IRUGO, st_defined_show, NULL);
- #endif
-
- static ssize_t
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
-+default_blksize_show(struct device *dev, struct device_attribute *attr, char *buf)
-+#else
- st_defblk_show(struct device *dev, struct device_attribute *attr, char *buf)
-+#endif
- {
- struct st_modedef *STm = dev_get_drvdata(dev);
- ssize_t l = 0;
-@@ -5008,13 +5079,20 @@
- l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_blksize);
- return l;
- }
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
-+static DEVICE_ATTR_RO(default_blksize);
-+#endif
-
- #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)
- DEVICE_ATTR(default_blksize, S_IRUGO, st_defblk_show, NULL);
- #endif
-
- static ssize_t
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
-+default_density_show(struct device *dev, struct device_attribute *attr, char *buf)
-+#else
- st_defdensity_show(struct device *dev, struct device_attribute *attr, char *buf)
-+#endif
- {
- struct st_modedef *STm = dev_get_drvdata(dev);
- ssize_t l = 0;
-@@ -5024,13 +5102,20 @@
- l = snprintf(buf, PAGE_SIZE, fmt, STm->default_density);
- return l;
- }
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
-+static DEVICE_ATTR_RO(default_density);
-+#endif
-
- #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)
- DEVICE_ATTR(default_density, S_IRUGO, st_defdensity_show, NULL);
- #endif
-
- static ssize_t
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
-+default_compression_show(struct device *dev, struct device_attribute *attr,
-+#else
- st_defcompression_show(struct device *dev, struct device_attribute *attr,
-+#endif
- char *buf)
- {
- struct st_modedef *STm = dev_get_drvdata(dev);
-@@ -5039,13 +5124,20 @@
- l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_compression - 1);
- return l;
- }
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
-+static DEVICE_ATTR_RO(default_compression);
-+#endif
-
- #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)
- DEVICE_ATTR(default_compression, S_IRUGO, st_defcompression_show, NULL);
- #endif
-
- static ssize_t
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
-+options_show(struct device *dev, struct device_attribute *attr, char *buf)
-+#else
- st_options_show(struct device *dev, struct device_attribute *attr, char *buf)
-+#endif
- {
- struct st_modedef *STm = dev_get_drvdata(dev);
- int options;
-@@ -5090,7 +5182,30 @@
- l = snprintf(buf, PAGE_SIZE, "0x%08x\n", options);
- return l;
- }
--#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32)
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
-+static DEVICE_ATTR_RO(options);
-+#endif
-+
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(3,13,0)
-+static struct attribute *st_dev_attrs[] = {
-+ &dev_attr_defined.attr,
-+ &dev_attr_default_blksize.attr,
-+ &dev_attr_default_density.attr,
-+ &dev_attr_default_compression.attr,
-+ &dev_attr_options.attr,
-+ &dev_attr_lasterror.attr,
-+ NULL,
-+};
-+
-+static struct attribute_group st_group = {
-+ .attrs = st_dev_attrs,
-+};
-+
-+static const struct attribute_group *st_dev_groups[] = {
-+ &st_group,
-+ NULL,
-+};
-+#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32)
- static struct device_attribute st_dev_attrs[] = {
- __ATTR_RO(st_defined),
- __ATTR_RO(st_defblk),