On 17/10/2018 07:37, Timo Alho wrote: > Add a helper function to check that firmware is supporting a given MRQ > command. > > Signed-off-by: Timo Alho <talho@xxxxxxxxxx> > --- > drivers/firmware/tegra/bpmp.c | 28 ++++++++++++++++++++++++++++ > include/soc/tegra/bpmp.h | 7 +++++++ > 2 files changed, 35 insertions(+) > > diff --git a/drivers/firmware/tegra/bpmp.c b/drivers/firmware/tegra/bpmp.c > index 41448ba..5bb46a5 100644 > --- a/drivers/firmware/tegra/bpmp.c > +++ b/drivers/firmware/tegra/bpmp.c > @@ -470,6 +470,34 @@ void tegra_bpmp_free_mrq(struct tegra_bpmp *bpmp, unsigned int mrq, void *data) > } > EXPORT_SYMBOL_GPL(tegra_bpmp_free_mrq); > > +bool tegra_bpmp_mrq_is_supported(struct tegra_bpmp *bpmp, unsigned int mrq) > +{ > + struct mrq_query_abi_request req = { .mrq = cpu_to_le32(mrq) }; > + struct mrq_query_abi_response resp; > + struct tegra_bpmp_message msg = { > + .mrq = MRQ_QUERY_ABI, > + .tx = { > + .data = &req, > + .size = sizeof(req), > + }, > + .rx = { > + .data = &resp, > + .size = sizeof(resp), > + }, > + }; > + int ret; > + > + ret = tegra_bpmp_transfer(bpmp, &msg); > + if (ret != 0 || msg.rx.ret != 0) { > + /* something went wrong; assume not supported */ > + dev_warn(bpmp->dev, "tegra_bpmp_transfer failed\n"); Should we make this a dev_dbg? I am wondering if we want to avoid this print in the case of someone using and older version of the firmware where this is not a critical error? In other words, should the caller of this function be responsible for printing any error messages? Cheers Jon -- nvpublic