Skip to content

Commit

Permalink
i2c: mux: pca954x: Remove #ifdef guards for PM related functions
Browse files Browse the repository at this point in the history
Use the new PM macros for the suspend and resume functions to be
automatically dropped by the compiler when CONFIG_PM or
CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Acked-by: Peter Rosin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Andi Shyti <[email protected]>
  • Loading branch information
pcercuei authored and Andi Shyti committed Aug 8, 2023
1 parent b221df9 commit ea738c0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/i2c/muxes/i2c-mux-pca954x.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,6 @@ static void pca954x_remove(struct i2c_client *client)
pca954x_cleanup(muxc);
}

#ifdef CONFIG_PM_SLEEP
static int pca954x_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
Expand All @@ -544,14 +543,13 @@ static int pca954x_resume(struct device *dev)

return ret;
}
#endif

static SIMPLE_DEV_PM_OPS(pca954x_pm, NULL, pca954x_resume);
static DEFINE_SIMPLE_DEV_PM_OPS(pca954x_pm, NULL, pca954x_resume);

static struct i2c_driver pca954x_driver = {
.driver = {
.name = "pca954x",
.pm = &pca954x_pm,
.pm = pm_sleep_ptr(&pca954x_pm),
.of_match_table = pca954x_of_match,
},
.probe = pca954x_probe,
Expand Down

0 comments on commit ea738c0

Please sign in to comment.