Skip to content

Commit

Permalink
Merge pull request #43 from mogrenp/master
Browse files Browse the repository at this point in the history
Do not use DRIVER_ATTR with newer versions of the kernel
  • Loading branch information
jean-edouard authored Mar 20, 2018
2 parents cfd4f64 + e738836 commit 7f98f43
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions openxt-vusb/openxt-vusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -3043,7 +3043,7 @@ static struct platform_driver vusb_platform_driver = {
static bool module_ref_counted = false;

static ssize_t
vusb_store_enable_unload(struct device_driver *drv,
enable_unload_store(struct device_driver *drv,
const char *buf, size_t count)
{

Expand All @@ -3061,11 +3061,15 @@ vusb_store_enable_unload(struct device_driver *drv,
return count;
}

#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0))
static DRIVER_ATTR(enable_unload, S_IWUSR,
NULL, vusb_store_enable_unload);
NULL, enable_unload_store);
#else
static DRIVER_ATTR_WO(enable_unload);
#endif

static ssize_t
vusb_show_logging_flags(struct device_driver *drv, char *buf)
logging_flags_show(struct device_driver *drv, char *buf)
{
struct vusb_vhcd *vhcd =
hcd_to_vhcd(platform_get_drvdata(vusb_platform_device));
Expand All @@ -3074,7 +3078,7 @@ vusb_show_logging_flags(struct device_driver *drv, char *buf)
}

static ssize_t
vusb_store_logging_flags(struct device_driver *drv,
logging_flags_store(struct device_driver *drv,
const char *buf, size_t count)
{
struct vusb_vhcd *vhcd =
Expand All @@ -3086,8 +3090,12 @@ vusb_store_logging_flags(struct device_driver *drv,
return strnlen(buf, count);
}

#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0))
static DRIVER_ATTR(logging_flags, S_IRUSR | S_IWUSR,
vusb_show_logging_flags, vusb_store_logging_flags);
logging_flags_show, logging_flags_store);
#else
static DRIVER_ATTR_RW(logging_flags);
#endif

static void
vusb_cleanup(void)
Expand Down

0 comments on commit 7f98f43

Please sign in to comment.