[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5BFFA875.6020002@ti.com>
Date: Thu, 29 Nov 2018 10:51:01 +0200
From: Roger Quadros <rogerq@...com>
To: David Lechner <david@...hnology.com>, <ohad@...ery.com>,
<bjorn.andersson@...aro.org>
CC: <tony@...mide.com>, <robh+dt@...nel.org>, <bcousson@...libre.com>,
<ssantosh@...nel.org>, <s-anna@...com>, <nsekhar@...com>,
<t-kristo@...com>, <nsaulnier@...com>, <jreeder@...com>,
<m-karicheri2@...com>, <woods.technical@...il.com>,
<linux-omap@...r.kernel.org>, <linux-remoteproc@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>
Subject: Re: [PATCH 02/16] remoteproc: Add a rproc_set_firmware() API
On 26/11/18 23:41, David Lechner wrote:
> On 11/26/18 1:52 AM, Roger Quadros wrote:
>> From: Suman Anna <s-anna@...com>
>>
>> A new API, rproc_set_firmware() is added to allow the remoteproc platform
>> drivers and remoteproc client drivers to be able to configure a custom
>> firmware name that is different from the default name used during
>> remoteproc registration. This function is being introduced to provide
>> a kernel-level equivalent of the current sysfs interface to remoteproc
>> client drivers. This allows some remoteproc drivers to choose different
>> firmwares at runtime when the remote processor is not running based on
>> the functional feature it is providing using that remote processor.
>> The TI PRU Ethernet driver will be an example of such usage as it
>> requires to use different firmwares for different supported protocols.
>>
>> Also, update the firmware_store() function used by the sysfs interface
>> to reuse this function to avoid code duplication.
>>
>> Signed-off-by: Suman Anna <s-anna@...com>
>> ---
>> drivers/remoteproc/remoteproc_core.c | 61 +++++++++++++++++++++++++++++++++++
>> drivers/remoteproc/remoteproc_sysfs.c | 33 ++-----------------
>> include/linux/remoteproc.h | 1 +
>> 3 files changed, 64 insertions(+), 31 deletions(-)
>>
>> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
>> index 39458a7..581e6e8 100644
>> --- a/drivers/remoteproc/remoteproc_core.c
>> +++ b/drivers/remoteproc/remoteproc_core.c
>> @@ -2151,6 +2151,67 @@ void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type)
>
> ...
>
>> +int rproc_set_firmware(struct rproc *rproc, const char *fw_name)
>> +{
>> + struct device *dev = rproc->dev.parent;
>> + int ret, len;
>> + char *p;
>> +
>> + if (!rproc || !fw_name)
>> + return -EINVAL;
>> +
>> + ret = mutex_lock_interruptible(&rproc->lock);
>> + if (ret) {
>> + dev_err(dev, "can't lock rproc %s: %d\n", rproc->name, ret);
>> + return -EINVAL;
>> + }
>> +
>> + if (rproc->state != RPROC_OFFLINE) {
>> + dev_err(dev, "can't change firmware while running\n");
>> + ret = -EBUSY;
>> + goto out;
>> + }
>> +
>> + len = strcspn(fw_name, "\n");
>> + if (!len) {
>> + dev_err(dev, "can't provide a NULL firmware\n");
>
> I realize this was just copied, but technically, this would be an
> empty string rather than NULL.
>
Noted. Thanks.
cheers,
-roger
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Powered by blists - more mailing lists