From: Jishnu Prakash <jishnu.prakash@oss.qualcomm.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
agross@kernel.org, andersson@kernel.org,
dmitry.baryshkov@linaro.org, konradybcio@kernel.org,
daniel.lezcano@linaro.org, sboyd@kernel.org, amitk@kernel.org,
thara.gopinath@gmail.com, lee@kernel.org, rafael@kernel.org,
subbaraman.narayanamurthy@oss.qualcomm.com,
david.collins@oss.qualcomm.com,
anjelique.melendez@oss.qualcomm.com, quic_kamalw@quicinc.com,
rui.zhang@intel.com, lukasz.luba@arm.com, lars@metafoo.de,
devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org, cros-qcom-dts-watchers@chromium.org,
quic_skakitap@quicinc.com, neil.armstrong@linaro.org
Subject: Re: [PATCH V5 5/5] thermal: qcom: add support for PMIC5 Gen3 ADC thermal monitoring
Date: Wed, 26 Feb 2025 14:22:24 +0530 [thread overview]
Message-ID: <dafe240f-c531-43f9-8787-bb8ba4ddea49@oss.qualcomm.com> (raw)
In-Reply-To: <20250201122731.2762b1f8@jic23-huawei>
Hi Jonathan,
On 2/1/2025 5:57 PM, Jonathan Cameron wrote:
> On Sat, 1 Feb 2025 00:02:42 +0530
> Jishnu Prakash <jishnu.prakash@oss.qualcomm.com> wrote:
>
>> Add support for ADC_TM part of PMIC5 Gen3.
>>
>> This is an auxiliary driver under the Gen3 ADC driver, which
>> implements the threshold setting and interrupt generating
>> functionalities of QCOM ADC_TM drivers, used to support thermal
>> trip points.
>
> Very short wrap. For commit descriptions 75 chars is fine.
>
>>
>> Signed-off-by: Jishnu Prakash <jishnu.prakash@oss.qualcomm.com>
> Various minor comments inline.
>
> Jonathan
>
>> ---
>> Changes since v4:
>> - Fixed a compilation error and updated dependencies in config as suggested
>> by reviewer.
...
>>
>> +
>> +MODULE_DEVICE_TABLE(auxiliary, adctm5_auxiliary_id_table);
>> +
>> +static struct adc_tm5_auxiliary_drv adctm5gen3_auxiliary_drv = {
>> + .adrv = {
>> + .id_table = adctm5_auxiliary_id_table,
>> + .probe = adc_tm5_probe,
>> + },
>> + .tm_event_notify = adctm_event_handler,
>> +};
>> +
>> +static int __init adctm5_init_module(void)
>> +{
>> + return auxiliary_driver_register(&adctm5gen3_auxiliary_drv.adrv);
>> +}
>> +
>> +static void __exit adctm5_exit_module(void)
>> +{
>> + auxiliary_driver_unregister(&adctm5gen3_auxiliary_drv.adrv);
>> +}
>> +
>> +module_init(adctm5_init_module);
>> +module_exit(adctm5_exit_module);
>
> Can use module_auxiliary_driver() to replace this boilerplate.
> The embedded adrv shouldn't stop that working that I can see.
>
I tried to do this, but it does not work with the embedded adrv.
When I tried this change:
-static int __init adctm5_init_module(void)
-{
- return auxiliary_driver_register(&adctm5gen3_auxiliary_drv.adrv);
-}
-
-static void __exit adctm5_exit_module(void)
-{
- auxiliary_driver_unregister(&adctm5gen3_auxiliary_drv.adrv);
-}
-
-module_init(adctm5_init_module);
-module_exit(adctm5_exit_module);
+module_auxiliary_driver(adctm5gen3_auxiliary_drv.adrv);
Ideally this should have worked as I see module_auxiliary_driver() takes a single argument of type struct auxiliary_driver. But it failed with errors like this:
drivers/thermal/qcom/qcom-spmi-adc-tm5-gen3.c:474:49: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
module_auxiliary_driver(adctm5gen3_auxiliary_drv.adrv);
^
drivers/thermal/qcom/qcom-spmi-adc-tm5-gen3.c:474:49: error: 'struct adc_tm5_auxiliary_drv' has no member named 'adrv_init'
module_auxiliary_driver(adctm5gen3_auxiliary_drv.adrv);
^
drivers/thermal/qcom/qcom-spmi-adc-tm5-gen3.c:474:49: error: 'struct adc_tm5_auxiliary_drv' has no member named 'adrv_exit'
module_auxiliary_driver(adctm5gen3_auxiliary_drv.adrv);
^
I think this happens because module_auxiliary_driver() is defined as a macro, like this:
#define module_auxiliary_driver(__auxiliary_driver) \
module_driver(__auxiliary_driver, auxiliary_driver_register, auxiliary_driver_unregister)
And when the text substitution for the argument is done, we would end up with lines like this in the expansion finally:
module_init(adctm5gen3_auxiliary_drv.adrv_init);
module_exit(adctm5gen3_auxiliary_drv.adrv_exit);
I'm facing similar issues, of the input argument being misinterpreted, if I use a pointer to the struct auxiliary_driver member (adrv), and dereference it as argument to module_auxiliary_driver().
I think module_auxiliary_driver() can only take a simple variable name as input, because in all the examples of its usage I found, I see there is a "struct auxiliary_driver" initialization just before the initialized variable is passed to module_auxiliary_driver().
In this auxiliary driver, I need to have adrv embedded within the struct adc_tm5_auxiliary_drv wrapper, as I also need to have the .tm_event_notify member, to expose a callback to the main driver, so I don't think I can change this.
I'll address your other comments in the next patch series.
Thanks,
Jishnu
>
>> +
>> +MODULE_DESCRIPTION("SPMI PMIC Thermal Monitor ADC driver");
>> +MODULE_LICENSE("GPL");
>> +MODULE_IMPORT_NS("QCOM_SPMI_ADC5_GEN3");
>
next prev parent reply other threads:[~2025-02-26 8:52 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-31 18:32 [PATCH V5 0/5] Add support for QCOM SPMI PMIC5 Gen3 ADC Jishnu Prakash
2025-01-31 18:32 ` [PATCH V5 1/5] dt-bindings: iio/adc: Move QCOM ADC bindings to iio/adc folder Jishnu Prakash
2025-01-31 19:41 ` Rob Herring (Arm)
2025-02-02 13:29 ` Krzysztof Kozlowski
2025-02-26 8:51 ` Jishnu Prakash
2025-02-26 9:11 ` Krzysztof Kozlowski
2025-03-03 13:56 ` Jishnu Prakash
2025-03-10 14:19 ` Jishnu Prakash
2025-01-31 18:32 ` [PATCH V5 2/5] dt-bindings: iio: adc: Split out QCOM VADC channel properties Jishnu Prakash
2025-01-31 19:41 ` Rob Herring (Arm)
2025-02-02 13:32 ` Krzysztof Kozlowski
2025-01-31 18:32 ` [PATCH V5 3/5] dt-bindings: iio: adc: Add support for QCOM PMIC5 Gen3 ADC Jishnu Prakash
2025-01-31 19:42 ` Rob Herring (Arm)
2025-02-01 11:33 ` Jonathan Cameron
2025-02-26 8:51 ` Jishnu Prakash
2025-02-02 13:38 ` Krzysztof Kozlowski
2025-02-26 8:51 ` Jishnu Prakash
2025-02-26 9:42 ` Krzysztof Kozlowski
2025-01-31 18:32 ` [PATCH V5 4/5] " Jishnu Prakash
2025-02-01 10:06 ` kernel test robot
2025-02-01 12:11 ` Jonathan Cameron
2025-02-26 8:52 ` Jishnu Prakash
2025-03-01 3:25 ` Jonathan Cameron
2025-03-03 13:56 ` Jishnu Prakash
2025-03-04 0:09 ` Jonathan Cameron
2025-02-01 23:36 ` kernel test robot
2025-01-31 18:32 ` [PATCH V5 5/5] thermal: qcom: add support for PMIC5 Gen3 ADC thermal monitoring Jishnu Prakash
2025-02-01 12:27 ` Jonathan Cameron
2025-02-26 8:52 ` Jishnu Prakash [this message]
2025-03-01 3:29 ` Jonathan Cameron
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=dafe240f-c531-43f9-8787-bb8ba4ddea49@oss.qualcomm.com \
--to=jishnu.prakash@oss.qualcomm.com \
--cc=agross@kernel.org \
--cc=amitk@kernel.org \
--cc=andersson@kernel.org \
--cc=anjelique.melendez@oss.qualcomm.com \
--cc=conor+dt@kernel.org \
--cc=cros-qcom-dts-watchers@chromium.org \
--cc=daniel.lezcano@linaro.org \
--cc=david.collins@oss.qualcomm.com \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=jic23@kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=lee@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=neil.armstrong@linaro.org \
--cc=quic_kamalw@quicinc.com \
--cc=quic_skakitap@quicinc.com \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=rui.zhang@intel.com \
--cc=sboyd@kernel.org \
--cc=subbaraman.narayanamurthy@oss.qualcomm.com \
--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