From: Christian Riesch <christian.riesch@omicron.at>
To: dedekind1@gmail.com
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH v2 1/4] mtd: cfi_cmdset_0002: Add support for reading OTP
Date: Wed, 29 May 2013 16:36:36 +0200 [thread overview]
Message-ID: <51A61274.70607@omicron.at> (raw)
In-Reply-To: <1369835589.24286.31.camel@sauron.fi.intel.com>
On 2013-05-29 15:53, Artem Bityutskiy wrote:
> On Wed, 2013-05-29 at 14:54 +0200, Christian Riesch wrote:
>> Artem,
>> Thank you very much for your comments!
>>
>> On 2013-05-29 09:11, Artem Bityutskiy wrote:
>>> On Fri, 2013-04-26 at 21:10 +0200, Christian Riesch wrote:
>>>> +static int cfi_amdstd_get_fact_prot_info(struct mtd_info *mtd,
>>>> + struct otp_info *buf,
>>>> size_t len)
>>>> +{
>>>> + size_t retlen;
>>>> + int ret;
>>>> +
>>>> + ret = cfi_amdstd_otp_walk(mtd, 0, len, &retlen, (u_char *)buf,
>>>> NULL, 0);
>>>> + return ret ? : retlen;
>>>> +}
>>>
>>> Hmm, I thought we would return 0 in case of success and a negative error
>>> code in case of error. Returning retlen looks wrong.
>>>
>>
>> I don't think so. Somehow the caller of this function should be told how
>> many bytes have been written into buf, there is no other way to return
>> the data length than the return value. Anyway, I just stole this code
>> from cfi_cmdset_0001.c (function cfi_intelext_get_fact_prot_info), it is
>> done in the same way there.
>
> But retlen is where you return the amount of bytes you actually wrote.
> The return code is either 0 or a negative error code number. This is
> what we do in mtd_write() and I'd expect the OTP functions to be
> consistent.
Unlike mtd_write, mtd->_get_fact_prot_info (which is a pointer to
cfi_amdstd_get_fact_prot_info here) does not have a retlen parameter. Do
you suggest to change this?
Regards, Christian
next prev parent reply other threads:[~2013-05-29 14:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1367003430-24584-1-git-send-email-christian.riesch@omicron.at>
2013-04-26 19:10 ` [PATCH v2 1/4] mtd: cfi_cmdset_0002: Add support for reading OTP Christian Riesch
2013-05-29 7:11 ` Artem Bityutskiy
2013-05-29 12:54 ` Christian Riesch
2013-05-29 13:53 ` Artem Bityutskiy
2013-05-29 14:36 ` Christian Riesch [this message]
2013-06-03 9:40 ` Artem Bityutskiy
2013-06-04 11:30 ` Christian Riesch
2013-04-26 19:10 ` [PATCH v2 2/4] mtd: cfi_cmdset_0002: Invalidate cache after entering/exiting OTP memory Christian Riesch
2013-04-26 19:10 ` [PATCH v2 3/4] mtd: cfi_cmdset_0002: Add support for writing " Christian Riesch
2013-04-26 19:10 ` [PATCH v2 4/4] mtd: cfi_cmdset_0002: Add support for locking " Christian Riesch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51A61274.70607@omicron.at \
--to=christian.riesch@omicron.at \
--cc=dedekind1@gmail.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).