]> Git Repo - linux.git/commitdiff
Merge back Intel thermal driver changes for 6.4-rc1.
authorRafael J. Wysocki <[email protected]>
Fri, 31 Mar 2023 17:32:43 +0000 (19:32 +0200)
committerRafael J. Wysocki <[email protected]>
Fri, 31 Mar 2023 17:32:43 +0000 (19:32 +0200)
1  2 
drivers/hwmon/hwmon.c
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c

diff --combined drivers/hwmon/hwmon.c
index d193ed3cb35e5b315f104b04e272862922028e17,3adf5c3c75ededa656fb3dd4a2c64b1c9ba02df3..11474b272aaff487f2c0a41f61700576d7c4a217
@@@ -154,7 -154,7 +154,7 @@@ static DEFINE_IDA(hwmon_ida)
  #ifdef CONFIG_THERMAL_OF
  static int hwmon_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
  {
-       struct hwmon_thermal_data *tdata = tz->devdata;
+       struct hwmon_thermal_data *tdata = thermal_zone_device_priv(tz);
        struct hwmon_device *hwdev = to_hwmon_device(tdata->dev);
        int ret;
        long t;
  
  static int hwmon_thermal_set_trips(struct thermal_zone_device *tz, int low, int high)
  {
-       struct hwmon_thermal_data *tdata = tz->devdata;
+       struct hwmon_thermal_data *tdata = thermal_zone_device_priv(tz);
        struct hwmon_device *hwdev = to_hwmon_device(tdata->dev);
        const struct hwmon_chip_info *chip = hwdev->chip;
        const struct hwmon_channel_info **info = chip->info;
@@@ -757,7 -757,6 +757,7 @@@ __hwmon_device_register(struct device *
        struct hwmon_device *hwdev;
        const char *label;
        struct device *hdev;
 +      struct device *tdev = dev;
        int i, err, id;
  
        /* Complain about invalid characters in hwmon name attribute */
        hwdev->name = name;
        hdev->class = &hwmon_class;
        hdev->parent = dev;
 -      hdev->of_node = dev ? dev->of_node : NULL;
 +      while (tdev && !tdev->of_node)
 +              tdev = tdev->parent;
 +      hdev->of_node = tdev ? tdev->of_node : NULL;
        hwdev->chip = chip;
        dev_set_drvdata(hdev, drvdata);
        dev_set_name(hdev, HWMON_ID_FORMAT, id);
  
        INIT_LIST_HEAD(&hwdev->tzdata);
  
 -      if (dev && dev->of_node && chip && chip->ops->read &&
 +      if (hdev->of_node && chip && chip->ops->read &&
            chip->info[0]->type == hwmon_chip &&
            (chip->info[0]->config[0] & HWMON_C_REGISTER_TZ)) {
                err = hwmon_thermal_register_sensors(hdev);
index 09ed6e5fa6c34e6db76d160d36cb5df28b67ac8d,b0a169e68df9ee921cfe52f09b06958f81a431c0..66dd42a8e72fe38341d52c973dc82e9a2c2301f1
@@@ -105,6 -105,7 +105,6 @@@ struct mlxsw_thermal 
        struct thermal_zone_device *tzdev;
        int polling_delay;
        struct thermal_cooling_device *cdevs[MLXSW_MFCR_PWMS_MAX];
 -      u8 cooling_levels[MLXSW_THERMAL_MAX_STATE + 1];
        struct thermal_trip trips[MLXSW_THERMAL_NUM_TRIPS];
        struct mlxsw_cooling_states cooling_states[MLXSW_THERMAL_NUM_TRIPS];
        struct mlxsw_thermal_area line_cards[];
@@@ -176,7 -177,7 +176,7 @@@ mlxsw_thermal_module_trips_update(struc
  
        if (crit_temp > emerg_temp) {
                dev_warn(dev, "%s : Critical threshold %d is above emergency threshold %d\n",
-                        tz->tzdev->type, crit_temp, emerg_temp);
+                        thermal_zone_device_type(tz->tzdev), crit_temp, emerg_temp);
                return 0;
        }
  
  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;
@@@ -280,7 -281,7 +280,7 @@@ static struct thermal_zone_device_ops m
  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;
  
@@@ -309,7 -310,7 +309,7 @@@ err_thermal_zone_bind_cooling_device
  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;
@@@ -355,7 -356,7 +355,7 @@@ mlxsw_thermal_module_temp_and_threshold
  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;
@@@ -390,7 -391,7 +390,7 @@@ static struct thermal_zone_device_ops m
  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;
@@@ -467,7 -468,7 +467,7 @@@ static int mlxsw_thermal_set_cur_state(
                return idx;
  
        /* Normalize the state to the valid speed range. */
 -      state = thermal->cooling_levels[state];
 +      state = max_t(unsigned long, MLXSW_THERMAL_MIN_STATE, state);
        mlxsw_reg_mfsc_pack(mfsc_pl, idx, mlxsw_state_to_duty(state));
        err = mlxsw_reg_write(thermal->core, MLXSW_REG(mfsc), mfsc_pl);
        if (err) {
@@@ -858,6 -859,10 +858,6 @@@ int mlxsw_thermal_init(struct mlxsw_cor
                }
        }
  
 -      /* Initialize cooling levels per PWM state. */
 -      for (i = 0; i < MLXSW_THERMAL_MAX_STATE; i++)
 -              thermal->cooling_levels[i] = max(MLXSW_THERMAL_MIN_STATE, i);
 -
        thermal->polling_delay = bus_info->low_frequency ?
                                 MLXSW_THERMAL_SLOW_POLL_INT :
                                 MLXSW_THERMAL_POLL_INT;
index d71ee50e7878f6c2dbb0b9ac84c1dd631f1b9c8c,1a9063f639b0d53f2b94306587546068bb55a7be..5d4fe48366ad0fc018af6b6d153c6d407720d024
@@@ -135,7 -135,7 +135,7 @@@ static irqreturn_t proc_thermal_irq_han
  
  static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp)
  {
-       struct proc_thermal_pci *pci_info = tzd->devdata;
+       struct proc_thermal_pci *pci_info = thermal_zone_device_priv(tzd);
        u32 _temp;
  
        proc_thermal_mmio_read(pci_info, PROC_THERMAL_MMIO_PKG_TEMP, &_temp);
  
  static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp)
  {
-       struct proc_thermal_pci *pci_info = tzd->devdata;
+       struct proc_thermal_pci *pci_info = thermal_zone_device_priv(tzd);
        int tjmax, _temp;
  
        if (temp <= 0) {
                cancel_delayed_work_sync(&pci_info->work);
                proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_INT_ENABLE_0, 0);
                proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_THRES_0, 0);
 -              thermal_zone_device_disable(tzd);
                pci_info->stored_thres = 0;
                return 0;
        }
This page took 0.119714 seconds and 4 git commands to generate.