Skip to content

Commit

Permalink
Merge branch 'platform-drivers-x86-platform-profile' into for-next
Browse files Browse the repository at this point in the history
  • Loading branch information
ij-intel committed Dec 30, 2024
2 parents 03f8e0e + b651ea8 commit c416a3f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions drivers/acpi/platform_profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,35 @@ int platform_profile_remove(struct platform_profile_handler *pprof)
}
EXPORT_SYMBOL_GPL(platform_profile_remove);

static void devm_platform_profile_release(struct device *dev, void *res)
{
struct platform_profile_handler **pprof = res;

platform_profile_remove(*pprof);
}

int devm_platform_profile_register(struct platform_profile_handler *pprof)
{
struct platform_profile_handler **dr;
int ret;

dr = devres_alloc(devm_platform_profile_release, sizeof(*dr), GFP_KERNEL);
if (!dr)
return -ENOMEM;

ret = platform_profile_register(pprof);
if (ret) {
devres_free(dr);
return ret;
}

*dr = pprof;
devres_add(pprof->dev, dr);

return 0;
}
EXPORT_SYMBOL_GPL(devm_platform_profile_register);

static int __init platform_profile_init(void)
{
int err;
Expand Down
1 change: 1 addition & 0 deletions include/linux/platform_profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ struct platform_profile_handler {

int platform_profile_register(struct platform_profile_handler *pprof);
int platform_profile_remove(struct platform_profile_handler *pprof);
int devm_platform_profile_register(struct platform_profile_handler *pprof);
int platform_profile_cycle(void);
void platform_profile_notify(struct platform_profile_handler *pprof);

Expand Down

0 comments on commit c416a3f

Please sign in to comment.