static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
 {
-       struct acpi_thermal *tz = thermal->devdata;
+       struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
        int result;
 
        if (!tz)
 static int thermal_get_trip_type(struct thermal_zone_device *thermal,
                                 int trip, enum thermal_trip_type *type)
 {
-       struct acpi_thermal *tz = thermal->devdata;
+       struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
        int i;
 
        if (!tz || trip < 0)
 static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
                                 int trip, int *temp)
 {
-       struct acpi_thermal *tz = thermal->devdata;
+       struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
        int i;
 
        if (!tz || trip < 0)
 static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
                                int *temperature)
 {
-       struct acpi_thermal *tz = thermal->devdata;
+       struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
 
        if (tz->trips.critical.flags.valid) {
                *temperature = deci_kelvin_to_millicelsius_with_offset(
 static int thermal_get_trend(struct thermal_zone_device *thermal,
                             int trip, enum thermal_trend *trend)
 {
-       struct acpi_thermal *tz = thermal->devdata;
+       struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
        enum thermal_trip_type type;
        int i;
 
 
 static void acpi_thermal_zone_device_hot(struct thermal_zone_device *thermal)
 {
-       struct acpi_thermal *tz = thermal->devdata;
+       struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
 
        acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
                                        dev_name(&tz->device->dev),
 
 static void acpi_thermal_zone_device_critical(struct thermal_zone_device *thermal)
 {
-       struct acpi_thermal *tz = thermal->devdata;
+       struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
 
        acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
                                        dev_name(&tz->device->dev),
                                          bool bind)
 {
        struct acpi_device *device = cdev->devdata;
-       struct acpi_thermal *tz = thermal->devdata;
+       struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
        struct acpi_device *dev;
        acpi_handle handle;
        int i;
 
 
 static int sata_ahci_read_temperature(struct thermal_zone_device *tz, int *temp)
 {
-       return __sata_ahci_read_temperature(tz->devdata, temp);
+       return __sata_ahci_read_temperature(thermal_zone_device_priv(tz), temp);
 }
 
 static ssize_t sata_ahci_show_temp(struct device *dev,
 
 
 static int sun4i_gpadc_get_temp(struct thermal_zone_device *tz, int *temp)
 {
-       struct sun4i_gpadc_iio *info = tz->devdata;
+       struct sun4i_gpadc_iio *info = thermal_zone_device_priv(tz);
        int val, scale, offset;
 
        if (sun4i_gpadc_temp_read(info->indio_dev, &val))
 
 
 static int sun4i_get_tz_temp(struct thermal_zone_device *tz, int *temp)
 {
-       return sun4i_get_temp(tz->devdata, temp);
+       return sun4i_get_temp(thermal_zone_device_priv(tz), temp);
 }
 
 static const struct thermal_zone_device_ops sun4i_ts_tz_ops = {
 
 static int cxgb4_thermal_get_temp(struct thermal_zone_device *tzdev,
                                  int *temp)
 {
-       struct adapter *adap = tzdev->devdata;
+       struct adapter *adap = thermal_zone_device_priv(tzdev);
        u32 param, val;
        int ret;
 
 
 static int mlxsw_thermal_bind(struct thermal_zone_device *tzdev,
                              struct thermal_cooling_device *cdev)
 {
-       struct mlxsw_thermal *thermal = tzdev->devdata;
+       struct mlxsw_thermal *thermal = thermal_zone_device_priv(tzdev);
        struct device *dev = thermal->bus_info->dev;
        int i, err;
 
 static int mlxsw_thermal_unbind(struct thermal_zone_device *tzdev,
                                struct thermal_cooling_device *cdev)
 {
-       struct mlxsw_thermal *thermal = tzdev->devdata;
+       struct mlxsw_thermal *thermal = thermal_zone_device_priv(tzdev);
        struct device *dev = thermal->bus_info->dev;
        int i;
        int err;
 static int mlxsw_thermal_get_temp(struct thermal_zone_device *tzdev,
                                  int *p_temp)
 {
-       struct mlxsw_thermal *thermal = tzdev->devdata;
+       struct mlxsw_thermal *thermal = thermal_zone_device_priv(tzdev);
        struct device *dev = thermal->bus_info->dev;
        char mtmp_pl[MLXSW_REG_MTMP_LEN];
        int temp;
 static int mlxsw_thermal_module_bind(struct thermal_zone_device *tzdev,
                                     struct thermal_cooling_device *cdev)
 {
-       struct mlxsw_thermal_module *tz = tzdev->devdata;
+       struct mlxsw_thermal_module *tz = thermal_zone_device_priv(tzdev);
        struct mlxsw_thermal *thermal = tz->parent;
        int i, j, err;
 
 static int mlxsw_thermal_module_unbind(struct thermal_zone_device *tzdev,
                                       struct thermal_cooling_device *cdev)
 {
-       struct mlxsw_thermal_module *tz = tzdev->devdata;
+       struct mlxsw_thermal_module *tz = thermal_zone_device_priv(tzdev);
        struct mlxsw_thermal *thermal = tz->parent;
        int i;
        int err;
 static int mlxsw_thermal_module_temp_get(struct thermal_zone_device *tzdev,
                                         int *p_temp)
 {
-       struct mlxsw_thermal_module *tz = tzdev->devdata;
+       struct mlxsw_thermal_module *tz = thermal_zone_device_priv(tzdev);
        struct mlxsw_thermal *thermal = tz->parent;
        int temp, crit_temp, emerg_temp;
        struct device *dev;
 static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device *tzdev,
                                          int *p_temp)
 {
-       struct mlxsw_thermal_module *tz = tzdev->devdata;
+       struct mlxsw_thermal_module *tz = thermal_zone_device_priv(tzdev);
        struct mlxsw_thermal *thermal = tz->parent;
        char mtmp_pl[MLXSW_REG_MTMP_LEN];
        u16 index;
 
 static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device,
                                  int *temperature)
 {
-       struct iwl_mvm *mvm = (struct iwl_mvm *)device->devdata;
+       struct iwl_mvm *mvm = thermal_zone_device_priv(device);
        int ret;
        int temp;
 
 static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device,
                                       int trip, int temp)
 {
-       struct iwl_mvm *mvm = (struct iwl_mvm *)device->devdata;
+       struct iwl_mvm *mvm = thermal_zone_device_priv(device);
        struct iwl_mvm_thermal_device *tzone;
        int ret;
 
 
        int ret;
 
        WARN_ON(tzd == NULL);
-       psy = tzd->devdata;
+       psy = thermal_zone_device_priv(tzd);
        ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_TEMP, &val);
        if (ret)
                return ret;
 
 
 static int max8973_thermal_read_temp(struct thermal_zone_device *tz, int *temp)
 {
-       struct max8973_chip *mchip = tz->devdata;
+       struct max8973_chip *mchip = thermal_zone_device_priv(tz);
        unsigned int val;
        int ret;