[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4ddd0588-0ff5-4c31-94b0-c9f0e453d98f@salutedevices.com>
Date: Mon, 14 Oct 2024 15:27:46 +0300
From: Martin Kurbanov <mmkurbanov@...utedevices.com>
To: Miquel Raynal <miquel.raynal@...tlin.com>
CC: Richard Weinberger <richard@....at>, Vignesh Raghavendra
<vigneshr@...com>, Mika Westerberg <mika.westerberg@...ux.intel.com>,
"Michael Walle" <michael@...le.cc>, Mark Brown <broonie@...nel.org>, Chia-Lin
Kao <acelan.kao@...onical.com>, Md Sadre Alam <quic_mdalam@...cinc.com>,
"Ezra Buehler" <ezra.buehler@...qvarnagroup.com>, Sridharan S N
<quic_sridsn@...cinc.com>, Frieder Schrempf <frieder.schrempf@...tron.de>,
Alexey Romanov <avromanov@...utedevices.com>, <linux-kernel@...r.kernel.org>,
<linux-mtd@...ts.infradead.org>, <kernel@...utedevices.com>
Subject: Re: [PATCH v2 2/5] mtd: spinand: add OTP support
Hi Miquel,
On 10/1/24 12:12, Miquel Raynal wrote:
>> +/**
>> + * spinand_set_mtd_otp_ops() - Set up OTP methods
>> + * @spinand: the spinand device
>> + *
>> + * Set up OTP methods.
>> + */
>> +void spinand_set_mtd_otp_ops(struct spinand_device *spinand)
>> +{
>> + struct mtd_info *mtd = spinand_to_mtd(spinand);
>> +
>> + if (!spinand->otp->ops)
>
> Could we use something else as check? It feels odd to check for otp ops
> and then just ignore the fact that they are here. Maybe check npages or
> otp_size() ?
A developer may not specify OTP callbacks:
SPINAND_OTP_INFO(otp_pages, NULL /* OTP ops */)
Or do you mean that it is better to check in each function
spinand_mtd_otp_{info,read,write,lock}? E.g.:
static int spinand_mtd_otp_erase(struct mtd_info *mtd, loff_t ofs, size_t len)
{
struct spinand_device *spinand = mtd_to_spinand(mtd);
const struct spinand_otp_ops *ops = spinand->otp->ops;
int ret;
if (!ops || !ops->erase)
return -EOPNOTSUPP;
--
Best Regards,
Martin Kurbanov
Powered by blists - more mailing lists