Re: [PATCH 2/5] memory: renesas-rpc-if: Make rpcif_enable/disable_rpm() as static inline

From: Lad, Prabhakar
Date: Wed Nov 25 2020 - 10:33:00 EST


Hi Geert,

Thank you for the review.

On Tue, Nov 24, 2020 at 3:43 PM Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
>
> Hi Prabhakar,
>
> On Tue, Nov 24, 2020 at 12:27 PM Lad Prabhakar
> <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx> wrote:
> > Define rpcif_enable_rpm() and rpcif_disable_rpm() as static
> > inline in the header instead of exporting it.
> >
> > Suggested-by: Pavel Machek <pavel@xxxxxxx>
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
>
> Thanks for your patch, which is an improvement.
>
> > --- a/include/memory/renesas-rpc-if.h
> > +++ b/include/memory/renesas-rpc-if.h
> > @@ -10,6 +10,7 @@
> > #ifndef __RENESAS_RPC_IF_H
> > #define __RENESAS_RPC_IF_H
> >
> > +#include <linux/pm_runtime.h>
> > #include <linux/types.h>
> >
> > enum rpcif_data_dir {
> > @@ -77,11 +78,19 @@ struct rpcif {
> >
> > int rpcif_sw_init(struct rpcif *rpc, struct device *dev);
> > void rpcif_hw_init(struct rpcif *rpc, bool hyperflash);
> > -void rpcif_enable_rpm(struct rpcif *rpc);
> > -void rpcif_disable_rpm(struct rpcif *rpc);
> > void rpcif_prepare(struct rpcif *rpc, const struct rpcif_op *op, u64 *offs,
> > size_t *len);
> > int rpcif_manual_xfer(struct rpcif *rpc);
> > ssize_t rpcif_dirmap_read(struct rpcif *rpc, u64 offs, size_t len, void *buf);
> >
> > +static inline void rpcif_enable_rpm(struct rpcif *rpc)
> > +{
> > + pm_runtime_enable(rpc->dev);
> > +}
> > +
> > +static inline void rpcif_disable_rpm(struct rpcif *rpc)
> > +{
> > + pm_runtime_put_sync(rpc->dev);
>
> Looking at how this is used, this should call pm_runtime_disable()
> instead.
>
> And probably this should be moved inside the core RPC-IF driver:
> 1. pm_runtime_enable() could be called from rpcif_sw_init(),
> 2. pm_runtime_put_sync() can be called from a new rpc_sw_deinit()
> function, to be called by the SPI and MTD drivers on probe failure
> and on remove.
>
Totally agree.

Sergei are you OK with the above suggestions ?

Cheers,
Prabhakar