forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Input: adxl34x - unify dev_pm_ops using EXPORT_SIMPLE_DEV_PM_OPS()
The I2C and SPI PM callbacks were identical (though wrapped in some bouncing out to the bus specific container of the struct device and then back again to get the drvdata). As such rather than just moving these to SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() take the opportunity to unify the struct dev_pm_ops and use the new EXPORT_SIMPLE_DEV_PM_OPS() macro so that we can drop the unused suspend and resume callbacks as well as the structure if !CONFIG_PM_SLEEP without needing to mark the callbacks __maybe_unused. Signed-off-by: Jonathan Cameron <[email protected]> Cc: Michael Hennerich <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
- Loading branch information
Showing
4 changed files
with
16 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -412,8 +412,10 @@ static void __adxl34x_enable(struct adxl34x *ac) | |
AC_WRITE(ac, POWER_CTL, ac->pdata.power_mode | PCTL_MEASURE); | ||
} | ||
|
||
void adxl34x_suspend(struct adxl34x *ac) | ||
static int adxl34x_suspend(struct device *dev) | ||
{ | ||
struct adxl34x *ac = dev_get_drvdata(dev); | ||
|
||
mutex_lock(&ac->mutex); | ||
|
||
if (!ac->suspended && !ac->disabled && ac->opened) | ||
|
@@ -422,11 +424,14 @@ void adxl34x_suspend(struct adxl34x *ac) | |
ac->suspended = true; | ||
|
||
mutex_unlock(&ac->mutex); | ||
|
||
return 0; | ||
} | ||
EXPORT_SYMBOL_GPL(adxl34x_suspend); | ||
|
||
void adxl34x_resume(struct adxl34x *ac) | ||
static int adxl34x_resume(struct device *dev) | ||
{ | ||
struct adxl34x *ac = dev_get_drvdata(dev); | ||
|
||
mutex_lock(&ac->mutex); | ||
|
||
if (ac->suspended && !ac->disabled && ac->opened) | ||
|
@@ -435,8 +440,9 @@ void adxl34x_resume(struct adxl34x *ac) | |
ac->suspended = false; | ||
|
||
mutex_unlock(&ac->mutex); | ||
|
||
return 0; | ||
} | ||
EXPORT_SYMBOL_GPL(adxl34x_resume); | ||
|
||
static ssize_t adxl34x_disable_show(struct device *dev, | ||
struct device_attribute *attr, char *buf) | ||
|
@@ -906,6 +912,8 @@ void adxl34x_remove(struct adxl34x *ac) | |
} | ||
EXPORT_SYMBOL_GPL(adxl34x_remove); | ||
|
||
EXPORT_GPL_SIMPLE_DEV_PM_OPS(adxl34x_pm, adxl34x_suspend, adxl34x_resume); | ||
|
||
MODULE_AUTHOR("Michael Hennerich <[email protected]>"); | ||
MODULE_DESCRIPTION("ADXL345/346 Three-Axis Digital Accelerometer Driver"); | ||
MODULE_LICENSE("GPL"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters