On Friday, November 18, 2016 3:50:16 PM CET Sakari Ailus wrote:
> Power on the sensor when the module is loaded and power it off when it is
> removed.
>
> Signed-off-by: Sakari Ailus <[email protected]>
> ---
> Hi Arnd and others,
>
> The patch is tested with CONFIG_PM set, as the system does I was testing
> on did not boot with CONFIG_PM disabled. I'm not really too worried about
> this though, the patch is very simple.
>
> static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
> {
> struct smiapp_hwconfig *hwcfg;
> @@ -2915,7 +2906,11 @@ static int smiapp_probe(struct i2c_client *client,
>
> pm_runtime_enable(&client->dev);
>
> +#ifdef CONFIG_PM
> rval = pm_runtime_get_sync(&client->dev);
> +#else
> + rval = smiapp_power_on(&client->dev);
> +#endif
> if (rval < 0) {
> rval = -ENODEV;
> goto out_power_off;
I would suggest writing this as
if (IS_ENABLED(CONFIG_PM))
rval = pm_runtime_get_sync(&client->dev);
else
rval = smiapp_power_on(&client->dev);
though that is a purely cosmetic change.
I think you are missing one other warning: with CONFIG_PM=y and
CONFIG_PM_SLEEP=n, the smiapp_suspend/smiapp_resume functions
are now unused and need to be marked as __maybe_unused.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html