From: Guenter Roeck <linux@roeck-us.net>
To: Eugene Shalygin <eugene.shalygin@gmail.com>
Cc: Jean Delvare <jdelvare@suse.com>,
linux-hwmon@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/4] hwmon: (asus-ec-sensors) introduce ec_board_info struct for board data
Date: Wed, 27 Apr 2022 06:20:01 -0700 [thread overview]
Message-ID: <8a8579df-1fd6-32bb-3e27-297efefe28c4@roeck-us.net> (raw)
In-Reply-To: <CAB95QARDq1Tr64dvPVemXHRNyu=T5P7LJ_DUn7sdHauUB6daaw@mail.gmail.com>
On 4/27/22 05:16, Eugene Shalygin wrote:
>> Sorry, I don't follow that part. One can add "__init" or "__initdata",
>> as in
>>
>> static struct platform_driver asus_ec_sensors_platform_driver __initdata = {
>>
>> to mark a function or data structure as __init. I don't think adding
>> "_probe" to the struct platform_driver variable name does that.
>>
>
> __initdata leads to modpost warning:
> WARNING: modpost: drivers/hwmon/asus-ec-sensors.o(.exit.text+0x3):
> Section mismatch in reference from the function cleanup_module() to
> the variable .init.data:asus_ec_sensors_platform_driver
> The function __exit cleanup_module() references
> a variable __initdata asus_ec_sensors_platform_driver.
> This is often seen when error handling in the exit function
> uses functionality in the init path.
> The fix is often to remove the __initdata annotation of
> asus_ec_sensors_platform_driver so it may be used outside an init section.
>
> Compiling without attributes resulted in another message:
> WARNING: modpost: drivers/hwmon/asus-ec-sensors.o(.data+0x0): Section
> mismatch in reference from the variable
> asus_ec_sensors_platform_driver to the function
> .init.text:asus_ec_probe()
> The variable asus_ec_sensors_platform_driver references
> the function __init asus_ec_probe()
> If the reference is valid then annotate the
> variable with __init* or __refdata (see linux/init.h) or name the variable:
> *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
>
> Here is why I added the "_probe" suffix.
>
> Eugene
Ah yes, I forgot about the exit function. It needs a pointer to
the structure, which would be gone if marked __initdata.
Please add a comment to the structure name explaining why
it is named _probe.
Thanks,
Guenter
next prev parent reply other threads:[~2022-04-27 13:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-26 9:23 [PATCH v2 0/4] asus-ec-sensors: add support for board families Eugene Shalygin
2022-04-26 9:23 ` [PATCH v2 1/4] hwmon: (asus-ec-sensors) introduce ec_board_info struct for board data Eugene Shalygin
2022-04-26 15:16 ` Guenter Roeck
2022-04-27 9:32 ` Eugene Shalygin
2022-04-27 12:04 ` Guenter Roeck
2022-04-27 12:16 ` Eugene Shalygin
2022-04-27 13:20 ` Guenter Roeck [this message]
2022-04-27 13:34 ` Eugene Shalygin
2022-04-27 13:41 ` Guenter Roeck
2022-04-27 13:46 ` Eugene Shalygin
2022-04-26 9:23 ` [PATCH v2 2/4] hwmon: (asus-ec-sensors) implement locking via the ACPI global lock Eugene Shalygin
2022-04-26 9:23 ` [PATCH v2 3/4] hwmon: (asus-ec-sensors) add support for board families Eugene Shalygin
2022-04-26 15:24 ` Guenter Roeck
2022-04-26 21:50 ` Eugene Shalygin
2022-04-26 9:23 ` [PATCH v2 4/4] hwmon: (asus-ec-sensors) add PRIME X470-PRO board Eugene Shalygin
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=8a8579df-1fd6-32bb-3e27-297efefe28c4@roeck-us.net \
--to=linux@roeck-us.net \
--cc=eugene.shalygin@gmail.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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