#include <linux/kernel.h>
#include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)
/* Commit: 297d716 power_supply: Change ownership from driver to core */
-#define DRIVER_OWNS_PSY_STRUCT
+#define CORE_OWNS_PSY_STRUCT
#endif
#ifndef __ATTR_WO
struct gb_power_supply {
u8 id;
bool registered;
-#ifdef DRIVER_OWNS_PSY_STRUCT
+#ifndef CORE_OWNS_PSY_STRUCT
struct power_supply psy;
#define to_gb_power_supply(x) container_of(x, struct gb_power_supply, psy)
#else
gbpsy->update_interval = update_interval_max;
}
-#ifdef DRIVER_OWNS_PSY_STRUCT
+#ifndef CORE_OWNS_PSY_STRUCT
static void __gb_power_supply_changed(struct gb_power_supply *gbpsy)
{
power_supply_changed(&gbpsy->psy);
}
-#ifdef DRIVER_OWNS_PSY_STRUCT
+#ifndef CORE_OWNS_PSY_STRUCT
static int gb_power_supply_register(struct gb_power_supply *gbpsy)
{
struct gb_connection *connection = get_conn_from_psy(gbpsy);
gbpsy->update_interval = 0;
cancel_delayed_work_sync(&gbpsy->work);
-#ifdef DRIVER_OWNS_PSY_STRUCT
+#ifndef CORE_OWNS_PSY_STRUCT
if (gbpsy->registered)
power_supply_unregister(&gbpsy->psy);
#else