Re: [PATCH V3] spi: spi-geni-qcom: Add SPI driver support for GENI based QUP

From: Stephen Boyd
Date: Thu Aug 30 2018 - 20:49:41 EST


Quoting Dilip Kota (2018-08-24 03:42:15)
> +
> +static int __maybe_unused spi_geni_suspend(struct device *dev)
> +{
> + if (!pm_runtime_status_suspended(dev))
> + return -EBUSY;

This looks odd. Why are we doing this? The i2c driver had a recent fix
from Evan squashed in that removed this logic so that suspend wouldn't
be called twice. Can this driver support the direct_complete PM
mechanism instead? Maybe that works to make this check unnecessary and
also allows us to avoid suspending subdevices and resuming on system
resume? It would be good if the i2c/uart/spi drivers could all agree on
how to handle this.

> + return 0;
> +}
> +
> +static const struct dev_pm_ops spi_geni_pm_ops = {
> + SET_RUNTIME_PM_OPS(spi_geni_runtime_suspend,
> + spi_geni_runtime_resume, NULL)
> + SET_SYSTEM_SLEEP_PM_OPS(spi_geni_suspend, NULL)
> +};
> +