Re: [PATCH v4 1/2] drivers: qcom: add command DB driver

From: Lina Iyer
Date: Tue Mar 06 2018 - 11:56:25 EST


On Tue, Mar 06 2018 at 09:21 -0700, Lina Iyer wrote:
On Mon, Mar 05 2018 at 11:42 -0700, Stephen Boyd wrote:
Quoting Lina Iyer (2018-02-26 09:58:01)
+size_t cmd_db_read_aux_data_len(const char *id)
+{
+ int ret;
+ struct entry_header ent;
+ struct rsc_hdr rsc_hdr;
+
+ ret = cmd_db_get_header_by_rsc_id(id, &ent, &rsc_hdr);

A bunch of code is calling this function. Why not change the user
interface to use an opaque 'resource' cookie that we can 'get' or 'find'
and then use that cookie in the rest of the API to pull out the data
that's desired?

Fair point. Let me find out. I suspect this was done to keep the API
similar to other non-Linux interfaces. I am not sure why they all didn't
use a handle instead of char *.

I was reminded that the APIs are generally used once for each resource
and are used for multiple resources and usually only at init. The handle
method doesn't buy much in benefits.

-- Lina