Skip to content

Commit

Permalink
ACPI: APEI: EINJ: mark remove callback as __exit
Browse files Browse the repository at this point in the history
The einj_driver driver is registered using platform_driver_probe(). In
this case it cannot get unbound via sysfs and it's ok to put the remove
callback into an exit section. To prevent the modpost warning about
einj_driver referencing .exit.text, mark the driver struct with
__refdata and explain the situation in a comment.

This is an improvement over commit a24118a ("ACPI: APEI: EINJ: mark
remove callback as non-__exit") which recently addressed the same issue,
but picked a less optimal variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Uwe Kleine-König authored and Rafael J. Wysocki committed Apr 8, 2024
1 parent fec50db commit 5a87e00
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions drivers/acpi/apei/einj-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ static int __init einj_probe(struct platform_device *pdev)
return rc;
}

static void einj_remove(struct platform_device *pdev)
static void __exit einj_remove(struct platform_device *pdev)
{
struct apei_exec_context ctx;

Expand All @@ -873,8 +873,14 @@ static void einj_remove(struct platform_device *pdev)
}

static struct platform_device *einj_dev;
static struct platform_driver einj_driver = {
.remove_new = einj_remove,
/*
* einj_remove() lives in .exit.text. For drivers registered via
* platform_driver_probe() this is ok because they cannot get unbound at
* runtime. So mark the driver struct with __refdata to prevent modpost
* triggering a section mismatch warning.
*/
static struct platform_driver einj_driver __refdata = {
.remove_new = __exit_p(einj_remove),
.driver = {
.name = "acpi-einj",
},
Expand Down

0 comments on commit 5a87e00

Please sign in to comment.