From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Anjelique Melendez <anjelique.melendez@oss.qualcomm.com>,
amitk@kernel.org, thara.gopinath@gmail.com, rafael@kernel.org,
daniel.lezcano@linaro.org
Cc: rui.zhang@intel.com, lukasz.luba@arm.com,
david.collins@oss.qualcomm.com, srinivas.kandagatla@linaro.org,
stefan.schmidt@linaro.org, quic_tsoni@quicinc.com,
linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org, dmitry.baryshkov@linaro.org,
dmitry.baryshkov@oss.qualcomm.com
Subject: Re: [PATCH v4 4/5] thermal: qcom-spmi-temp-alarm: add support for GEN2 rev 2 PMIC peripherals
Date: Thu, 29 May 2025 11:59:47 +0100 [thread overview]
Message-ID: <07ecd160-5bb5-4e39-ab5c-9f761e7db0af@linaro.org> (raw)
In-Reply-To: <20250528235026.4171109-5-anjelique.melendez@oss.qualcomm.com>
On 29/05/2025 00:50, Anjelique Melendez wrote:
> +static int qpnp_tm_gen2_rev2_set_temp_thresh(struct qpnp_tm_chip *chip, int trip, int temp)
> +{
> + int ret, temp_cfg;
> + u8 reg;
> +
> + WARN_ON(!mutex_is_locked(&chip->lock));
> +
> + if (trip < 0 || trip >= STAGE_COUNT) {
trip < 0 can never be true because the value passed to this function
comes from an unsigned int
include/linux/thermal.h:#define THERMAL_TRIP_PRIV_TO_INT(_val_)
(uintptr_t)(_val_)
actually why is it int trip here instead of unsigned int trip ?
> + dev_err(chip->dev, "invalid TEMP_DAC trip = %d\n", trip);
> + return -EINVAL;
> + } else if (temp < TEMP_DAC_MIN || temp > temp_dac_max[trip]) {
> + dev_err(chip->dev, "invalid TEMP_DAC temp = %d\n", temp);
> + return -EINVAL;
> + }
> +
> + reg = TEMP_DAC_TEMP_TO_REG(temp);
> + temp_cfg = TEMP_DAC_REG_TO_TEMP(reg);
> +
> + ret = qpnp_tm_write(chip, QPNP_TM_REG_TEMP_DAC_STG1 + trip, reg);
> + if (ret < 0) {
> + dev_err(chip->dev, "TEMP_DAC_STG write failed, ret=%d\n", ret);
> + return ret;
> + }
> +
> + chip->temp_thresh_map[trip] = temp_cfg;
> +
> + return 0;
> +}
> +
> +static int qpnp_tm_gen2_rev2_set_trip_temp(struct thermal_zone_device *tz,
> + const struct thermal_trip *trip, int temp)
> +{
> + unsigned int trip_index = THERMAL_TRIP_PRIV_TO_INT(trip->priv);
> + struct qpnp_tm_chip *chip = thermal_zone_device_priv(tz);
> + int ret;
> +
> + mutex_lock(&chip->lock);
> + ret = qpnp_tm_gen2_rev2_set_temp_thresh(chip, trip_index, temp);The sign conversion in the integer seems questionable. I see that the
intel code does the same thing but I think that's just an error being
replicated here.
---
bod
next prev parent reply other threads:[~2025-05-29 10:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-28 23:50 [PATCH v4 0/5] thermal: qcom-spmi-temp-alarm: Add support for new TEMP_ALARM subtypes Anjelique Melendez
2025-05-28 23:50 ` [PATCH v4 1/5] thermal: qcom-spmi-temp-alarm: enable stage 2 shutdown when required Anjelique Melendez
2025-05-29 10:34 ` Bryan O'Donoghue
2025-06-03 10:50 ` Dmitry Baryshkov
2025-05-28 23:50 ` [PATCH v4 2/5] thermal: qcom-spmi-temp-alarm: Add temp alarm data struct based on HW subtype Anjelique Melendez
2025-05-28 23:50 ` [PATCH v4 3/5] thermal: qcom-spmi-temp-alarm: Prepare to support additional Temp Alarm subtypes Anjelique Melendez
2025-05-29 10:48 ` Bryan O'Donoghue
2025-05-28 23:50 ` [PATCH v4 4/5] thermal: qcom-spmi-temp-alarm: add support for GEN2 rev 2 PMIC peripherals Anjelique Melendez
2025-05-29 10:59 ` Bryan O'Donoghue [this message]
2025-05-28 23:50 ` [PATCH v4 5/5] thermal: qcom-spmi-temp-alarm: add support for LITE " Anjelique Melendez
2025-06-03 10:51 ` Dmitry Baryshkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=07ecd160-5bb5-4e39-ab5c-9f761e7db0af@linaro.org \
--to=bryan.odonoghue@linaro.org \
--cc=amitk@kernel.org \
--cc=anjelique.melendez@oss.qualcomm.com \
--cc=daniel.lezcano@linaro.org \
--cc=david.collins@oss.qualcomm.com \
--cc=dmitry.baryshkov@linaro.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=quic_tsoni@quicinc.com \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=srinivas.kandagatla@linaro.org \
--cc=stefan.schmidt@linaro.org \
--cc=thara.gopinath@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®