[PATCH v12] thermal: drivers: mediatek: Add the Low Voltage Thermal Sensor driver

Balsam CHIHI bchihi at baylibre.com
Fri Feb 3 02:35:15 PST 2023


Hi Matthias,

On Wed, Feb 1, 2023 at 5:59 PM Matthias Brugger <matthias.bgg at gmail.com> wrote:
>
>
>
> On 01/02/2023 17:46, Balsam CHIHI wrote:
> > Hi Krzysztof,
> >
> > Thank you very much for the review!
> >
> > On Wed, Feb 1, 2023 at 8:55 AM Krzysztof Kozlowski
> > <krzysztof.kozlowski at linaro.org> wrote:
> >>
> >> On 31/01/2023 16:38, bchihi at baylibre.com wrote:
> >>> From: Balsam CHIHI <bchihi at baylibre.com>
> >>>
>
> [...]
>
> >>> +
> >>> +static irqreturn_t lvts_ctrl_irq_handler(struct lvts_ctrl *lvts_ctrl)
> >>> +{
> >>> +     irqreturn_t iret = IRQ_NONE;
> >>> +     u32 value, masks[] = {
> >>
> >> Don't mix different types in one declaration. u32 and a pointer are
> >> quite different types.
> >
> > I'm not sure to understand.
> > LVTS_INT_SENSORx are not pointers but register values.
> >
>
> u32 mask[] is a pointer to a array of u32 values of undefined length.
>

I will change this to :
u32 value;
u32 masks[] = {

> [...]
>
> >>> +static int __init lvts_golden_temp_init(struct device *dev, u32 *value)
> >>
> >> You did not test it, right? Build with section mismatch analysis...
> >
> > I'm not sure to fully understand this comment.
> > Would you explain, please?
> >
>
> AFAIU:
>
> lvts_golden_temp_init() and lvts_ctrl_init() are called from a function that is
> not in __init section:
> lvts_domain_init()
>
> So if you free up the first to functions after init but not the callers, things
> can explote.
>

__init will be removed for all functions.

> [...]
>
> >>> +
> >>> +static int lvts_probe(struct platform_device *pdev)
> >>> +{
> >>> +     struct lvts_data *lvts_data;
> >>> +     struct lvts_domain *lvts_td;
> >>> +     struct device *dev = &pdev->dev;
> >>> +     struct resource *res;
> >>> +     int irq, ret;
> >>> +
> >>> +     lvts_td = devm_kzalloc(dev, sizeof(*lvts_td), GFP_KERNEL);
> >>> +     if (!lvts_td)
> >>> +             return -ENOMEM;
> >>> +
> >>> +     lvts_data = (struct lvts_data *)of_device_get_match_data(dev);
> >>
> >> Why do you need case?
> >
> > Would you explain, please?
> >
>
> Typo by Krysztof, he meant the cast.
> lvts_data = of_device_get_match_data(dev);
> should be good enough.
>

OK,
It will be like you suggested.

> Regards,
> Matthias

Thank you for the review!

Best regards,
Balsam



More information about the Linux-mediatek mailing list